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
[#2356] Enable publish & add project buttons only if user has perms #2601
Conversation
3f47117
to
766dbb2
Compare
766dbb2
to
a031286
Compare
The Publish button can be enabled/disabled in setPageCompletionPercentage(). Only set/remove disabled in setPageCompletionPercentage() if the user can publish the project.
Superusers should be able to create/publish projects no matter what.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your initial fixes look good apart from the bug where the react code goes and sets/removes disabled!
So check out my fixes and if OK I think we're there.
akvo/rsr/models/user.py
Outdated
:return: Boolean to indicate whether the user has a reportable organisation | ||
""" | ||
if self.is_superuser or self.is_admin: | ||
if self.is_superuser: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep god-mode. Not sure about self.is_admin, I think this is Akvo staff only and if so it might apply to them too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.has_perm
automatically gives all permissions to any user who is a superuser
. Also, if a user is_admin
they have the rsr.add_project
permissions given to them in our permission config. So, I don't think this special case is required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When adding a new project, approved employments of a user are used to determine which organisation to add the project to. Having an admin/super user without any employments trying to add a new project will be a problem, if we have this special case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah...OK you have to have an employment then I guess.
This reverts commit 3165f3a.
Closes #2356
Closes #2362