mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add User.is_elevated()
This one returns true if the user is either a Trusted User or a Developer. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
b59601a8b7
commit
c006386079
2 changed files with 14 additions and 0 deletions
|
@ -165,6 +165,15 @@ class User(Base):
|
|||
aurweb.models.account_type.TRUSTED_USER_AND_DEV_ID
|
||||
}
|
||||
|
||||
def is_elevated(self):
|
||||
""" A User is 'elevated' when they have either a
|
||||
Trusted User or Developer AccountType. """
|
||||
return self.AccountType.ID in {
|
||||
aurweb.models.account_type.TRUSTED_USER_ID,
|
||||
aurweb.models.account_type.DEVELOPER_ID,
|
||||
aurweb.models.account_type.TRUSTED_USER_AND_DEV_ID,
|
||||
}
|
||||
|
||||
def can_edit_user(self, user):
|
||||
""" Can this account record edit the target user? It must either
|
||||
be the target user or a user with enough permissions to do so.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue