Skip to content

Commit

Permalink
Fix indentation in _load_additional_permissions in deposit/permission…
Browse files Browse the repository at this point in the history
…s.py
  • Loading branch information
gcakir committed May 3, 2024
1 parent 1c8202a commit a366841
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions b2share/modules/deposit/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,23 +315,23 @@ def _load_additional_permissions(self):
state_permission.explicit_needs.add(UserNeed(owner_id))
permissions.append(state_permission)

# Create permission for updating generic metadata fields.
# Only superadmin can modify published draft.
if self.deposit['publication_state'] != 'published':
new_state = new_deposit['publication_state']
# Check if any metadata has been changed
del new_deposit['publication_state']
original_metadata = deepcopy(self.deposit)
del original_metadata['publication_state']
if original_metadata != new_deposit:
permissions.append(
UpdateDepositMetadataPermission(self.deposit, new_state)
)

if external_pids_changed:
permissions.append(
DepositFilesPermission(self.deposit, 'bucket-update')
)
# Create permission for updating generic metadata fields.
# Only superadmin can modify published draft.
if self.deposit['publication_state'] != 'published':
new_state = new_deposit['publication_state']
# Check if any metadata has been changed
del new_deposit['publication_state']
original_metadata = deepcopy(self.deposit)
del original_metadata['publication_state']
if original_metadata != new_deposit:
permissions.append(
UpdateDepositMetadataPermission(self.deposit, new_state)
)

if external_pids_changed:
permissions.append(
DepositFilesPermission(self.deposit, 'bucket-update')
)

if len(permissions) > 1:
self.permissions.add(AndPermissions(*permissions))
Expand Down

0 comments on commit a366841

Please sign in to comment.