mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Rework permission handling
Add a new function has_credential() that checks whether the currently logged in user is allowed to perform a given action. Moving all permission handling to this central place makes adding new user groups and adjusting permissions much more convenient. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
9e6b861b6f
commit
03c6304e19
24 changed files with 187 additions and 237 deletions
|
@ -17,7 +17,7 @@
|
|||
</p>
|
||||
<?php
|
||||
# Only TUs or Devs can promote/demote/suspend a user
|
||||
if ($UTYPE == "Trusted User" || $UTYPE == "Developer"):
|
||||
if (has_credential(CRED_ACCOUNT_CHANGE_TYPE)):
|
||||
?>
|
||||
<p>
|
||||
<label for="id_type"><?= __("Account Type") ?>:</label>
|
||||
|
@ -32,10 +32,7 @@
|
|||
<?php else: ?>
|
||||
<option value="2"><?= __("Trusted user") ?></option>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
# Only developers can make another account a developer
|
||||
if ($UTYPE == "Developer"):
|
||||
?>
|
||||
<?php if (has_credential(CRED_ACCOUNT_EDIT_DEV)): ?>
|
||||
<option value="3"
|
||||
<?php $T == 3 ? print " selected=\"selected\">" : print ">";
|
||||
print __("Developer")."\n"; ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue