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

Add extra permissions and link permisions with views #2390

Merged
merged 10 commits into from
Jan 28, 2024

Conversation

linh-trant
Copy link
Contributor

No description provided.

Copy link
Member

@tienne-B tienne-B 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!

tabbycat/adjallocation/views.py Show resolved Hide resolved
tabbycat/users/permissions.py Outdated Show resolved Hide resolved
tabbycat/draw/views.py Outdated Show resolved Hide resolved
tabbycat/users/permissions.py Outdated Show resolved Hide resolved
tabbycat/draw/views.py Outdated Show resolved Hide resolved
tabbycat/options/views.py Outdated Show resolved Hide resolved
tabbycat/participants/views.py Outdated Show resolved Hide resolved
Permission.EDIT_MOTION,
Permission.EDIT_RELEASEDRAW,
Permission.EDIT_UNRELEASEDRAW,
Permission.EDIT_SETBREAKING,
Copy link
Member

@tienne-B tienne-B Jan 24, 2024

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?)

Comment on lines 76 to 100
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,
]
Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2024-01-24 at 14 18 12

I think there are way more permissions in this list than what they can actually do currently.

@@ -69,6 +70,7 @@ def get_context_data(self, **kwargs):


class AdminParticipantsListView(AdministratorMixin, BaseParticipantsListView):
view_permission = Permission.VIEW_TEAMS and Permission.VIEW_ADJUDICATORS
Copy link
Member

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
Copy link
Member

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.

Comment on lines 128 to 130
Permission.VIEW_ADJUDICATORS,
Permission.VIEW_ROOMS,
Permission.VIEW_INSTITUTIONS,
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Comment on lines 83 to 117
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,
Copy link
Member

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?

@tienne-B tienne-B merged commit ac73229 into TabbycatDebate:user-permissions Jan 28, 2024
3 checks passed
@linh-trant linh-trant deleted the user-permissions branch January 28, 2024 00:15
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