Skip to content

Conversation

@ihorsokhanexoft
Copy link
Contributor

Purpose

set_published method checks if this action is performed by admin contributor, however admins in admin app should be able to perform this action without the permission

Changes

Handle this case with an additional parameter in method because if we add check like "if is_admin or is_admin_contributor" there may be a case when admin user opens preprint and publishes it via API that he shouldn't be able to do

Ticket

https://openscience.atlassian.net/jira/software/c/projects/ENG/boards/145/backlog?assignee=712020%3A7c7368dc-40cb-475f-bae8-b07a8bd2dd6c&selectedIssue=ENG-7749

Copy link
Collaborator

@brianjgeiger brianjgeiger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one small change for readability.

def post(self, request, *args, **kwargs):
preprint = self.get_object()
preprint.set_published(True, request, True)
preprint.set_published(True, request, True, True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of unlabeled args there. Could you replace those with kwargs so it's more clear what's going on?

@brianjgeiger brianjgeiger merged commit f4d06dd into CenterForOpenScience:feature/pbs-25-07 Apr 9, 2025
6 checks passed
Johnetordoff added a commit to Johnetordoff/osf.io that referenced this pull request Apr 11, 2025
…cience/osf.io into remove-registration-metadata

* 'feature/pbs-25-07' of https://github.com/CenterForOpenScience/osf.io:
  [ENG-7289] Fix Search Index Discrepancy in Collection Facets (CenterForOpenScience#11085)
  [ENG-7750] Preprint creator cannot remove bibliographic citation status (CenterForOpenScience#11087)
  [ENG-7799] Update authors' names format in metadata (CenterForOpenScience#11091)
  [ENG-5751] remove old keen logic (CenterForOpenScience#11082)
  [ENG-7751] Fixed contributors reordering on registration metadata page (CenterForOpenScience#11083)
  [ENG-7749] admin user can publish preprint in admin app even if he isn't a contributor (CenterForOpenScience#11084)
  [ENG-7761] Edit scopes with Personal Access Tokens (CenterForOpenScience#11081)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants