Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update permission for Project document upload button #4277

Merged
merged 2 commits into from
Dec 20, 2024

Conversation

sandeepsajan0
Copy link
Member

Fixes #4275

image

Test Steps

@sandeepsajan0 sandeepsajan0 marked this pull request as ready for review December 11, 2024 12:55
@frjo
Copy link
Member

frjo commented Dec 11, 2024

@sandeepsajan0 @theskumar Should we use the "rolepermissions" module for these kind of permissions? I believe it will handle things like template tags automatically.

Implemented here e.g.:

@register_object_checker()
def delete_submission(role, user, submission) -> bool:
"""
Determines if a user has permission to delete a submission.
Permissions are granted if:
- User is a Superuser, or StaffAdmin
- User has explicit delete_applicationsubmission permission
- User is the applicant of the submission and it is in draft state
"""
if role == StaffAdmin:
return True
if user.has_perm("funds.delete_applicationsubmission"):
return True
# Allow the user to delete their own draft submissions
if user == submission.user and submission.status == DRAFT_STATE:
return True
return False

@theskumar
Copy link
Member

@sandeepsajan0 @theskumar Should we use the "rolepermissions" module for these kind of permissions? I believe it will handle things like template tags automatically.

Yes, please.

@frjo frjo added Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Patch Mini change, used in release drafter labels Dec 12, 2024
@frjo frjo added Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels Dec 18, 2024
@wes-otf wes-otf added Status: Tested - approved for live ✅ and removed Status: Needs testing Tickets that need testing/qa Status: Needs dev testing 🧑‍💻 Tasks that should be tested by the dev team labels Dec 19, 2024
@frjo frjo merged commit de1e4fe into main Dec 20, 2024
7 checks passed
@frjo frjo deleted the fix/gh-4275-project-document-permission branch March 11, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Tested - approved for live ✅ Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Patch Mini change, used in release drafter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project Document Categories upload button visible for applicant/vendor
4 participants