-
Notifications
You must be signed in to change notification settings - Fork 296
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
Permissions for labels #3173
Permissions for labels #3173
Conversation
engine/apps/api/permissions.py
Outdated
def user_is_authorized_basic_role(user: "User", required_permission: LegacyAccessControlRole) -> bool: | ||
""" | ||
This function checks user basic role | ||
|
||
user - The user to check permissions for | ||
required_permission - A basic role that a user must have to be considered authorized | ||
""" | ||
return user.role <= required_permission |
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.
I would suggest trying to reuse the less-than-or-equal-to auth logic that is defined above in user_is_authorized
(or somehow refactoring that function such that we don't need two separate ones like this)
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.
LGTM 🚢 🚢 🚢
What this PR does
Adds check for basic role permissions on get/create/update labels
Which issue(s) this PR fixes
https://github.com/grafana/oncall-private/issues/2194
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)