summaryrefslogtreecommitdiffstats
path: root/web/template/pkg_search_results.php
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2014-07-15 20:52:54 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2014-07-15 22:56:57 +0200
commit03c6304e19d5d3ecd276dd3f42220db301ab511d (patch)
tree25f58ac23290a9e57f6bd93f6b5c8986bd9fcbef /web/template/pkg_search_results.php
parent9e6b861b6f40a90363c402b4d26602f33964cf41 (diff)
downloadaurweb-03c6304e19d5d3ecd276dd3f42220db301ab511d.tar.xz
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>
Diffstat (limited to 'web/template/pkg_search_results.php')
-rw-r--r--web/template/pkg_search_results.php10
1 files changed, 2 insertions, 8 deletions
diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php
index 75131fc..e901408 100644
--- a/web/template/pkg_search_results.php
+++ b/web/template/pkg_search_results.php
@@ -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") ?>