Commit 58a8f00e authored by Franco Fichtner's avatar Franco Fichtner

acl: partially merge GUI changes, description dropped

parent edf77d2a
......@@ -666,16 +666,29 @@ $( document ).ready(function() {
<td>
<table class="table table-hover table-condensed">
<tr>
<td><b><?=gettext("Inherited From");?></b></td>
<td><b><?=gettext("Inherited from");?></b></td>
<td><b><?=gettext("Type");?></b></td>
<td><b><?=gettext("Name");?></b></td>
<td><b><?=gettext("Description");?></b></td>
</tr>
<?php
foreach (get_user_privdesc($a_user[$id]) as $priv) :?>
<tr>
<td><?=!empty($priv['group']) ? $priv['group'] : ""?></td>
<td><?=!empty($priv['group']) ? $priv['group'] : ''?></td>
<td>
<?php
switch (substr($priv['id'], 0, 5)) {
case 'page-':
echo gettext('GUI');
break;
case 'user-':
echo gettext('User');
break;
default:
echo gettext('N/A');
break;
} ?>
</td>
<td><?=$priv['name']?></td>
<td><?=!empty($priv['descr']) ? $priv['descr'] : ""?></td>
</tr>
<?php
endforeach;?>
......
......@@ -34,9 +34,10 @@ function cpusercmp($a, $b)
return strcasecmp($a['name'], $b['name']);
}
function sort_user_privs($privs) {
// Privileges to place first, to redirect properly.
$priority_privs = array("page-dashboard-all", "page-system-login/logout");
function sort_user_privs($privs)
{
/* Privileges to place first, to redirect properly. */
$priority_privs = array('page-dashboard-all', 'page-system-login/logout');
$fprivs = array_intersect($privs, $priority_privs);
$sprivs = array_diff($privs, $priority_privs);
......@@ -200,19 +201,33 @@ include("head.inc");
<tr>
<th style="width:70px;"></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<?php
foreach ($priv_list as $pname => $pdata) :?>
<tr class="acl_item" data-search-phrase="<?=$pdata['name'];?> <?=!empty($pdata['descr']) ? $pdata['descr'] : "";?>">
foreach ($priv_list as $pname => $pdata) {
$pnamesafe = !empty($pdata['name']) ? $pdata['name'] : $pname;
switch (substr($pname, 0, 5)) {
case 'page-':
$pdesc = gettext('GUI');
break;
case 'user-':
$pdesc = gettext('User');
break;
default:
$pdesc = gettext('N/A');
break;
} ?>
<tr class="acl_item" data-search-phrase="<?= $pdesc . ' ' . $pnamesafe ?>">
<td>
<input name="sysprivs[]" type="checkbox" value="<?=$pname;?>" <?=in_array($pname, $a_privs) ? "checked=\"checked\"" : "";?>>
</td>
<td><small data-toggle="tooltip" title="<?=!empty($pdata['descr']) ? $pdata['descr'] : "";?>"><?=!empty($pdata['name']) ? $pdata['name'] : $pname;?></small></td>
<td><?= $pdesc ?></td>
<td><?= $pnamesafe ?></td>
</tr>
<?php
endforeach; ?>
} ?>
</tbody>
</table>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment