mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 09:43:03 +00: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
|
@ -1,10 +1,4 @@
|
|||
<?php
|
||||
if (isset($_COOKIE['AURSID'])) {
|
||||
$atype = account_from_sid($_COOKIE['AURSID']);
|
||||
} else {
|
||||
$atype = "";
|
||||
}
|
||||
|
||||
if (!$result): ?>
|
||||
<div class="box"><p><?= __("Error retrieving package list.") ?></p></div>
|
||||
<?php elseif ($total == 0): ?>
|
||||
|
@ -119,13 +113,13 @@ if (!$result): ?>
|
|||
<option value="do_UnFlag"><?= __("Unflag Out-of-date") ?></option>
|
||||
<option value="do_Adopt"><?= __("Adopt Packages") ?></option>
|
||||
<option value="do_Disown"><?= __("Disown Packages") ?></option>
|
||||
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
|
||||
<option value="do_Delete"><?= __("Delete Packages") ?></option>
|
||||
<?php endif; ?>
|
||||
<option value="do_Notify"><?= __("Notify") ?></option>
|
||||
<option value="do_UnNotify"><?= __("UnNotify") ?></option>
|
||||
</select>
|
||||
<?php if ($atype == "Trusted User" || $atype == "Developer"): ?>
|
||||
<?php if (has_credential(CRED_PKGBASE_DELETE)): ?>
|
||||
<label for="merge_Into"><?= __("Merge into") ?></label>
|
||||
<input type="text" id="merge_Into" name="merge_Into" />
|
||||
<input type="checkbox" name="confirm_Delete" value="1" /> <?= __("Confirm") ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue