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

[#2356] Enable publish & add project buttons only if user has perms #2601

Merged
merged 4 commits into from Apr 10, 2017

Conversation

punchagan
Copy link
Contributor

@punchagan punchagan commented Mar 31, 2017

  • Test plan | Unit test | Integration test
  • Copyright header
  • Code formatting
  • Documentation
  • Change log entry

Closes #2356
Closes #2362

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.
Copy link
Contributor

@zzgvh zzgvh left a 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.

:return: Boolean to indicate whether the user has a reportable organisation
"""
if self.is_superuser or self.is_admin:
if self.is_superuser:
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@punchagan punchagan merged commit 1a73e47 into develop Apr 10, 2017
@punchagan punchagan deleted the issue/2356-publish-button branch April 10, 2017 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants