-
-
Notifications
You must be signed in to change notification settings - Fork 870
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
Add extra permissions and link permisions with views #2390
Add extra permissions and link permisions with views #2390
Conversation
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.
Looks good!
tabbycat/users/groups.py
Outdated
Permission.EDIT_MOTION, | ||
Permission.EDIT_RELEASEDRAW, | ||
Permission.EDIT_UNRELEASEDRAW, | ||
Permission.EDIT_SETBREAKING, |
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.
Do we want them to? I think this one refers to teams. (Could we rename this to be clearer?)
tabbycat/users/groups.py
Outdated
permissions = [ | ||
Permission.EDIT_ROUNDAVAILABILITIES_ADJ, | ||
Permission.EDIT_ROUNDAVAILABILITIES_TEAM, | ||
Permission.EDIT_ROUNDAVAILABILITIES_VENUE, | ||
Permission.EDIT_ROOMCATEGORIES, | ||
Permission.EDIT_ROOMCONSTRAINTS, | ||
Permission.VIEW_ADMIN_DRAW, | ||
Permission.EDIT_OLD_BALLOTSUBMISSIONS, | ||
Permission.EDIT_BALLOTSUBMISSIONS, | ||
Permission.ADD_BALLOTSUBMISSIONS, | ||
Permission.MARK_BALLOTSUBMISSIONS, | ||
Permission.MARK_OTHERS_BALLOTSUBMISSIONS, | ||
Permission.VIEW_BALLOTSUBMISSION_GRAPH, | ||
Permission.VIEW_FEEDBACK, | ||
Permission.VIEW_FEEDBACK_OVERVIEW, | ||
Permission.VIEW_FEEDBACK_UNSUBMITTED, | ||
Permission.EDIT_FEEDBACK_CONFIRM, | ||
Permission.EDIT_FEEDBACK_IGNORE, | ||
Permission.ADD_FEEDBACK, | ||
Permission.EDIT_BREAK_ELIGIBILITY, | ||
Permission.EDIT_SPEAKER_CATEGORIES, | ||
Permission.VIEW_PRIVATE_URLS, | ||
Permission.GENERATE_PRIVATE_URLS, | ||
Permission.SEND_PRIVATE_URLS, | ||
] |
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.
tabbycat/participants/views.py
Outdated
@@ -69,6 +70,7 @@ def get_context_data(self, **kwargs): | |||
|
|||
|
|||
class AdminParticipantsListView(AdministratorMixin, BaseParticipantsListView): | |||
view_permission = Permission.VIEW_TEAMS and Permission.VIEW_ADJUDICATORS |
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.
This won't work either. To annotate my earlier comment:
I don't remember supporting a list of permissions, but it could be done easily. I'm assuming this is an
and
.
Meant that you can't have a view be dependent on multiple permissions, but giving a list of permissions could be supported by editing the mixin. You'd also need to specify that all (and) of the listed permissions must be present, rather than merely any.
I'd rather you create a new permission to access this page, rather than try to do permission "logic".
@@ -149,7 +152,7 @@ def post(self, request: 'HttpRequest', *args, **kwargs) -> 'HttpResponseRedirect | |||
|
|||
class EmailRandomisedUrlsView(RoleColumnMixin, TournamentTemplateEmailCreateView): | |||
page_subtitle = _("Private URLs") | |||
|
|||
edit_permission = Permission.SEND_PRIVATE_URLS |
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.
Should also add a view permission here, maybe a new one as this also has email addresses, so more personal details.
tabbycat/users/groups.py
Outdated
Permission.VIEW_ADJUDICATORS, | ||
Permission.VIEW_ROOMS, | ||
Permission.VIEW_INSTITUTIONS, |
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.
Why?
tabbycat/users/groups.py
Outdated
Permission.EDIT_ROUNDAVAILABILITIES_ADJ, | ||
Permission.EDIT_ROUNDAVAILABILITIES_TEAM, | ||
Permission.EDIT_ROUNDAVAILABILITIES_VENUE, | ||
Permission.EDIT_ROOMCATEGORIES, | ||
Permission.EDIT_ROOMCONSTRAINTS, | ||
Permission.VIEW_ADMIN_DRAW, | ||
Permission.EDIT_OLD_BALLOTSUBMISSIONS, | ||
Permission.EDIT_BALLOTSUBMISSIONS, | ||
Permission.ADD_BALLOTSUBMISSIONS, | ||
Permission.MARK_BALLOTSUBMISSIONS, | ||
Permission.MARK_OTHERS_BALLOTSUBMISSIONS, | ||
Permission.VIEW_BALLOTSUBMISSION_GRAPH, | ||
Permission.VIEW_FEEDBACK, | ||
Permission.VIEW_FEEDBACK_OVERVIEW, | ||
Permission.VIEW_FEEDBACK_UNSUBMITTED, | ||
Permission.EDIT_FEEDBACK_CONFIRM, | ||
Permission.EDIT_FEEDBACK_IGNORE, | ||
Permission.ADD_FEEDBACK, | ||
Permission.EDIT_BREAK_ELIGIBILITY, | ||
Permission.EDIT_SPEAKER_CATEGORIES, | ||
Permission.VIEW_PRIVATE_URLS, | ||
Permission.GENERATE_PRIVATE_URLS, | ||
Permission.SEND_PRIVATE_URLS, | ||
Permission.EDIT_PARTICIPANT_CHECKIN, | ||
Permission.EDIT_ROOM_CHECKIN, | ||
Permission.VIEW_TEAMS, | ||
Permission.VIEW_ADJUDICATORS, | ||
Permission.VIEW_ROOMS, | ||
Permission.VIEW_INSTITUTIONS, | ||
Permission.VIEW_PARTICIPANTS, | ||
Permission.VIEW_ADMIN_DRAW, | ||
Permission.VIEW_DEBATES, | ||
Permission.RELEASE_DRAW, | ||
Permission.UNRELEASE_DRAW, | ||
Permission.EDIT_STARTTIME, |
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.
What were the changes here to the previous comment?
No description provided.