Commit b1f0507 1 parent f9901ce commit b1f0507 Copy full SHA for b1f0507
File tree 4 files changed +11
-18
lines changed
backend/src/openarchiefbeheer/destruction
4 files changed +11
-18
lines changed Original file line number Diff line number Diff line change @@ -748,12 +748,8 @@ class Meta:
748
748
749
749
def validate (self , attrs : dict ) -> dict :
750
750
destruction_list = attrs ["review" ].destruction_list
751
- request = self .context ["request" ]
752
751
753
- if not (
754
- request .user == destruction_list .author
755
- and destruction_list .status == ListStatus .changes_requested
756
- ):
752
+ if not (destruction_list .status == ListStatus .changes_requested ):
757
753
raise ValidationError (
758
754
_ (
759
755
"This user is either not allowed to update the destruction list or "
Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ def test_create_review_response(self):
133
133
134
134
self .assertEqual (item_response3 .action_zaak ["archiefactiedatum" ], "2030-01-01" )
135
135
136
- def test_cannot_create_response_if_not_author (self ):
136
+ def test_can_create_response_if_not_author (self ):
137
137
record_manager1 = UserFactory .create (post__can_start_destruction = True )
138
138
record_manager2 = UserFactory .create (post__can_start_destruction = True )
139
139
@@ -156,14 +156,7 @@ def test_cannot_create_response_if_not_author(self):
156
156
format = "json" ,
157
157
)
158
158
159
- self .assertEqual (response .status_code , status .HTTP_400_BAD_REQUEST )
160
- self .assertEqual (
161
- response .json ()["nonFieldErrors" ][0 ],
162
- _ (
163
- "This user is either not allowed to update the destruction list or "
164
- "the destruction list cannot currently be updated."
165
- ),
166
- )
159
+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
167
160
168
161
def test_cannot_create_response_if_not_changes_requested (self ):
169
162
record_manager = UserFactory .create (post__can_start_destruction = True )
Original file line number Diff line number Diff line change @@ -310,9 +310,13 @@ DESTRUCTION_LIST_STATUSES.forEach((status) => {
310
310
expect ( canUpdateDestructionList ( user , destructionList ) ) . toBe ( false ) ;
311
311
} ) ;
312
312
313
- test ( "should not allow a user to update if they are not the assignee" , ( ) => {
314
- destructionList . assignee = anotherUser ;
315
- expect ( canUpdateDestructionList ( user , destructionList ) ) . toBe ( false ) ;
313
+ test ( "should allow a user to update if they are not the author" , ( ) => {
314
+ expect (
315
+ canUpdateDestructionList (
316
+ user ,
317
+ destructionListFactory ( { status : "changes_requested" } ) ,
318
+ ) ,
319
+ ) . toBe ( true ) ;
316
320
} ) ;
317
321
} ) ;
318
322
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export function canUpdateDestructionList(
97
97
return false ;
98
98
}
99
99
100
- return user . pk === destructionList . assignee . pk ;
100
+ return true ;
101
101
}
102
102
103
103
export function canViewDestructionList (
You can’t perform that action at this time.
0 commit comments