summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr/local/www/system_groupmanager.php569
-rw-r--r--usr/local/www/system_groupmanager_addprivs.php159
-rw-r--r--usr/local/www/system_usermanager.php25
3 files changed, 212 insertions, 541 deletions
diff --git a/usr/local/www/system_groupmanager.php b/usr/local/www/system_groupmanager.php
index 7132a45..9cb7513 100644
--- a/usr/local/www/system_groupmanager.php
+++ b/usr/local/www/system_groupmanager.php
@@ -60,10 +60,10 @@ $a_group = &$config['system']['group'];
unset($id);
if (isset($_POST['groupid']) && is_numericint($_POST['groupid']))
$id = $_POST['groupid'];
+elseif (isset($_GET['groupid']) && is_numericint($_GET['groupid']))
+ $id = $_GET['groupid'];
-$act = (isset($_POST['act']) ? $_POST['act'] : '');
-
-if ($act == "delgroup") {
+if ($_POST['act'] == "delgroup") {
if (!isset($id) || !isset($_POST['groupname']) || !isset($a_group[$id]) || ($_POST['groupname'] != $a_group[$id]['name'])) {
pfSenseHeader("system_groupmanager.php");
@@ -80,31 +80,23 @@ if ($act == "delgroup") {
gettext("successfully deleted")."<br />";
}
-if ($act == "delpriv") {
-
- if (!isset($id) || !isset($a_group[$id])) {
- pfSenseHeader("system_groupmanager.php");
- exit;
- }
-
- $privdeleted = $priv_list[$a_group[$id]['priv'][$_POST['privid']]]['name'];
- unset($a_group[$id]['priv'][$_POST['privid']]);
+if ($_GET['act'] == "edit") {
+ // This used to be a separate act=delpriv
+ if (isset($a_group[$id]) && !empty($_POST['delpriv'])) {
+ foreach ($_POST['delpriv'] as $i)
+ unset($a_group[$id]['priv'][ $i ]);
- if (is_array($a_group[$id]['member'])) {
- foreach ($a_group[$id]['member'] as $uid) {
- $user = getUserEntryByUID($uid);
- if ($user)
- local_user_set($user);
+ if (is_array($a_group[$id]['member'])) {
+ foreach ($a_group[$id]['member'] as $uid) {
+ $user = getUserEntryByUID($uid);
+ if ($user)
+ local_user_set($user);
+ }
}
- }
- write_config();
- $act = "edit";
- $savemsg = gettext("Privilege")." {$privdeleted} ".
- gettext("successfully deleted")."<br />";
-}
+ write_config();
+ }
-if ($act == "edit") {
if (isset($id) && isset($a_group[$id])) {
$pconfig['name'] = $a_group[$id]['name'];
$pconfig['gid'] = $a_group[$id]['gid'];
@@ -115,26 +107,7 @@ if ($act == "edit") {
}
}
-if(isset($_POST['dellall_x'])) {
-
- $del_groups = $_POST['delete_check'];
-
- if(!empty($del_groups)) {
- foreach($del_groups as $groupid) {
- if(isset($a_group[$groupid]) && $a_group[$groupid]['scope'] != "system") {
- conf_mount_rw();
- local_group_del($a_group[$groupid]);
- conf_mount_ro();
- unset($a_group[$groupid]);
- }
- }
- $savemsg = gettext("Selected groups removed successfully!");
- write_config($savemsg);
- }
-}
-
if (isset($_POST['save'])) {
-
unset($input_errors);
$pconfig = $_POST;
@@ -202,384 +175,164 @@ if (isset($_POST['save'])) {
include("head.inc");
+if ($input_errors)
+ print_input_errors($input_errors);
+if ($savemsg)
+ print_info_box($savemsg);
+
+$tab_array = array();
+$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
+$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
+$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
+$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
+display_top_tabs($tab_array);
+
+if (!($_GET['act'] == "new" || $_GET['act'] == "edit"))
+{
+?>
+<table class="table">
+ <thead>
+ <tr>
+ <th><?=gettext("Group name")?></th>
+ <th><?=gettext("Description")?></th>
+ <th><?=gettext("Member Count")?></th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ foreach($a_group as $i => $group):
+ if ($group["name"] == "all")
+ $groupcount = count($config['system']['user']);
+ else
+ $groupcount = count($group['member']);
+?>
+ <tr>
+ <td>
+ <?=htmlspecialchars($group['name'])?>
+ </td>
+ <td>
+ <?=htmlspecialchars($group['description'])?>
+ </td>
+ <td>
+ <?=$groupcount?>
+ </td>
+ <td>
+ <a href="?act=edit&amp;groupid=<?=$i?>" class="btn btn-xs btn-primary">edit</a>
+ <?php if($group['scope'] != "system"): ?>
+ <a href="?act=delgroup&amp;groupid=<?=$i?>&amp;groupname=<?=$group['name']?>" class="btn btn-xs btn-danger">delete</a>
+ <?php endif;?>
+ </td>
+ </tr>
+<?php
+ endforeach;
?>
+ </tbody>
+ </table>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript" src="/javascript/row_toggle.js"></script>
-<script type="text/javascript">
-//<![CDATA[
-
-function setall_selected(id) {
- selbox = document.getElementById(id);
- count = selbox.options.length;
- for (index = 0; index<count; index++)
- selbox.options[index].selected = true;
+ <a href="?act=new" class="btn btn-success">add new</a>
+<?php
+ include('foot.inc');
+ exit;
}
-function delete_empty(id) {
- selbox = document.getElementById(id);
- count = selbox.options.length;
- for (index = 0; index<count; index++)
- if (selbox.options[index].value == '')
- selbox.remove(index);
+require('classes/Form.class.php');
+$form = new Form;
+$form->setAction('system_groupmanager.php?act=edit');
+$form->addGlobal(new Form_Input(
+ 'groupid',
+ null,
+ 'hidden',
+ $id
+));
+
+if (isset($id) && $a_group[$id]){
+ $form->addGlobal(new Form_Input(
+ 'id',
+ null,
+ 'hidden',
+ $id
+ ));
+
+ $form->addGlobal(new Form_Input(
+ 'gid',
+ null,
+ 'hidden',
+ $pconfig['gid']
+ ));
}
-function clear_selected(id) {
- selbox = document.getElementById(id);
- count = selbox.options.length;
- for (index = 0; index<count; index++)
- selbox.options[index].selected = false;
+$ro = ($pconfig['gtype'] == "system");
+
+$section = new Form_Section('Group properties');
+
+if ($_GET['act'] != "new")
+{
+ $section->addInput(new Form_StaticText(
+ 'Defined by',
+ strtoupper($pconfig['gtype'])
+ ));
}
-function remove_selected(id) {
- selbox = document.getElementById(id);
- index = selbox.options.length - 1;
- for (; index >= 0; index--)
- if (selbox.options[index].selected)
- selbox.remove(index);
+$section->addInput(new Form_Input(
+ 'groupname',
+ 'Group name',
+ 'text',
+ $pconfig['name']
+));
+
+$section->addInput(new Form_Input(
+ 'description',
+ 'Description',
+ 'text',
+ $pconfig['description']
+))->setHelp('Group description, for your own information only');
+
+$form->add($section);
+if ($pconfig['gid'] != 1998) // all users group
+{
+ $section = new Form_Section('Group Memberships');
+
+ $allUsers = array_map(function($u){ return $u['name']; }, $config['system']['user']);
+ $section->addInput(new Form_Select(
+ 'members',
+ 'Members',
+ $pconfig['members'],
+ $allUsers,
+ true
+ ))->setHelp('Hold down CTRL (pc)/COMMAND (mac) key to select');
+
+ $form->add($section);
}
-function copy_selected(srcid, dstid) {
- src_selbox = document.getElementById(srcid);
- dst_selbox = document.getElementById(dstid);
- count = dst_selbox.options.length;
- for (index = count - 1; index >= 0; index--) {
- if (dst_selbox.options[index].value == '') {
- dst_selbox.remove(index);
- }
- }
- count = src_selbox.options.length;
- for (index = 0; index < count; index++) {
- if (src_selbox.options[index].selected) {
- option = document.createElement('option');
- option.text = src_selbox.options[index].text;
- option.value = src_selbox.options[index].value;
- dst_selbox.add(option, null);
- }
+if ($_GET['act'] != "new")
+{
+ $section = new Form_Section('Assigned Privileges');
+
+ foreach ((array)$pconfig['priv'] as $i => $priv)
+ {
+ // We reverse name and action for readability of longer names
+ $group = new Form_Group('Revoke privilege');
+
+ $group->add(new Form_Checkbox(
+ 'delpriv[]',
+ null,
+ $priv_list[ $priv ]['name'],
+ false,
+ $i
+ ));
+
+ $section->add($group);
}
-}
-function move_selected(srcid, dstid) {
- copy_selected(srcid, dstid);
- remove_selected(srcid);
-}
+ $section->addInput(new Form_StaticText(
+ null,
+ new Form_Button(null, 'grant more privileges', 'system_groupmanager_addprivs.php?groupid='. $id)
+ ));
-function presubmit() {
- delete_empty('members');
- delete_empty('notmembers');
- clear_selected('notmembers');
- setall_selected('members');
+ $form->add($section);
}
-//]]>
-</script>
-<?php
- if ($input_errors)
- print_input_errors($input_errors);
- if ($savemsg)
- print_info_box($savemsg);
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager">
- <tr>
- <td>
-<?php
- $tab_array = array();
- $tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
- $tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
- $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
- $tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
- display_top_tabs($tab_array);
-?>
- </td>
- </tr>
- <tr>
- <td id="mainarea">
- <div class="tabcont">
+print $form;
-<?php
- if($act == "new" || $act == "edit"):
-?>
- <form action="system_groupmanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
- <input type="hidden" id="act" name="act" value="" />
- <input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
- <input type="hidden" id="privid" name="privid" value="" />
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
-<?php
- $ro = "";
- if ($pconfig['gtype'] == "system")
- $ro = "readonly=\"readonly\"";
-?>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
- <td width="78%" class="vtable">
- <strong><?=strtoupper($pconfig['gtype']);?></strong>
- <input name="gtype" type="hidden" value="<?=htmlspecialchars($pconfig['gtype'])?>"/>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Group name");?></td>
- <td width="78%" class="vtable">
- <input name="groupname" type="text" class="formfld group" id="groupname" size="20" maxlength="16" value="<?=htmlspecialchars($pconfig['name']);?>" <?=$ro;?> />
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
- <td width="78%" class="vtable">
- <input name="description" type="text" class="formfld unknown" id="description" size="20" value="<?=htmlspecialchars($pconfig['description']);?>" />
- <br />
- <?=gettext("Group description, for your own information only");?>
- </td>
- </tr>
-<?php
- if ($pconfig['gid'] != 1998): // all users group
-?>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
- <td width="78%" class="vtable" align="center">
- <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="membership">
- <tr>
- <td align="center" width="50%">
- <strong><?=gettext("Not Members");?></strong><br />
- <br />
- <select size="10" style="width: 75%" name="notmembers[]" class="formselect" id="notmembers" onchange="clear_selected('members')" multiple="multiple">
-<?php
- $rowIndex = 0;
- foreach ($config['system']['user'] as $user):
- if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
- continue;
- $rowIndex++;
-?>
- <option value="<?=$user['uid'];?>" <?=$selected;?>>
- <?=htmlspecialchars($user['name']);?>
- </option>
-<?php
- endforeach;
- if ($rowIndex == 0)
- echo "<option></option>";
-?>
- </select>
- <br />
- </td>
- <td>
- <br />
- <a href="javascript:move_selected('notmembers','members')">
- <img src="/themes/<?= $g['theme'];?>/images/icons/icon_right.gif" title="<?=gettext("Add Members");?>" alt="<?=gettext("Add Members");?>" width="17" height="17" border="0" />
- </a>
- <br /><br />
- <a href="javascript:move_selected('members','notmembers')">
- <img src="/themes/<?= $g['theme'];?>/images/icons/icon_left.gif" title="<?=gettext("Remove Members");?>" alt="<?=gettext("Remove Members");?>" width="17" height="17" border="0" />
- </a>
- </td>
- <td align="center" width="50%">
- <strong><?=gettext("Members");?></strong><br />
- <br />
- <select size="10" style="width: 75%" name="members[]" class="formselect" id="members" onchange="clear_selected('notmembers')" multiple="multiple">
-<?php
- $rowIndex = 0;
- foreach ($config['system']['user'] as $user):
- if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
- continue;
- $rowIndex++;
-?>
- <option value="<?=$user['uid'];?>">
- <?=htmlspecialchars($user['name']);?>
- </option>
-<?php
- endforeach;
- if ($rowIndex == 0)
- echo "<option></option>";
-?>
- </select>
- <br />
- </td>
- </tr>
- </table>
- <?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
- </td>
- </tr>
-<?php
- endif;
- if ($act != "new"):
-?>
- <tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Assigned Privileges");?></td>
- <td width="78%" class="vtable">
- <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0" summary="privileges">
- <tr>
- <td width="40%" class="listhdrr"><?=gettext("Name");?></td>
- <td width="60%" class="listhdrr"><?=gettext("Description");?></td>
- <td class="list"></td>
- </tr>
-<?php
- if(is_array($pconfig['priv'])):
- $i = 0;
- foreach ($pconfig['priv'] as $priv):
-?>
- <tr>
- <td class="listr">
- <?=htmlspecialchars($priv_list[$priv]['name']);?>
- </td>
- <td class="listbg">
- <?=htmlspecialchars($priv_list[$priv]['descr']);?>
- </td>
- <td valign="middle" class="list nowrap">
- <input type="image" name="delpriv[]" width="17" height="17" border="0"
- src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
- onclick="document.getElementById('privid').value='<?=$i;?>';
- document.getElementById('groupid').value='<?=$id;?>';
- document.getElementById('act').value='<?php echo "delpriv";?>';
- return confirm('<?=gettext("Do you really want to delete this privilege?");?>');"
- title="<?=gettext("delete privilege");?>" />
- </td>
- </tr>
-<?php
- $i++;
- endforeach;
- endif;
-?>
- <tr>
- <td class="list" colspan="2"></td>
- <td class="list">
- <a href="system_groupmanager_addprivs.php?groupid=<?=htmlspecialchars($id)?>">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" />
- </a>
-
- </td>
- </tr>
-
- </table>
- </td>
- </tr>
-<?php
- endif;
-?>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- <input type="button" class="formbtn" value="<?=gettext("Cancel");?>" onclick="window.location.href='/system_groupmanager.php'" />
- <?php if (isset($id) && $a_group[$id]): ?>
- <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
- <input name="gid" type="hidden" value="<?=htmlspecialchars($pconfig['gid']);?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
-<?php
- else:
-?>
- <form action="system_groupmanager.php" method="post" name="iform2" id="iform2">
- <input type="hidden" id="act" name="act" value="" />
- <input type="hidden" id="groupid" name="groupid" value="<?=(isset($id) ? $id : '');?>" />
- <input type="hidden" id="groupname" name="groupname" value="" />
- <table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
- <thead>
- <tr>
- <th width="5%" class="list">&nbsp;</th>
- <th width="25%" class="listhdrr"><?=gettext("Group name");?></th>
- <th width="25%" class="listhdrr"><?=gettext("Description");?></th>
- <th width="30%" class="listhdrr"><?=gettext("Member Count");?></th>
- <th width="10%" class="list"></th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <td class="list" colspan="4"></td>
- <td class="list">
- <input type="image" name="addcert" width="17" height="17" border="0"
- src="/themes/<?=$g['theme'];?>/images/icons/icon_plus.gif"
- onclick="document.getElementById('act').value='<?php echo "new";?>';"
- title="<?=gettext("add group");?>" />
- <input type="image" src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" name="dellall" title="<?=gettext('Delete selected groups')?>" onClick="return confirm('<?=gettext("Do you really want to delete selected groups?");?>')" />
- </td>
- </tr>
- <tr>
- <td colspan="4">
- <p>
- <?=gettext("Additional webConfigurator groups can be added here.
- Group permissions can be assigned which are inherited by users who are members of the group.
- An icon that appears grey indicates that it is a system defined object.
- Some system object properties can be modified but they cannot be deleted.");?>
- </p>
- </td>
- </tr>
- </tfoot>
- <tbody>
-<?php
- $i = 0;
- foreach($a_group as $group):
- if($group['scope'] == "system")
- $grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
- else
- $grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
- $groupcount = count($group['member']);
- if ($group["name"] == "all")
- $groupcount = count($config['system']['user']);
-?>
- <tr ondblclick="document.getElementById('act').value='<?php echo "edit";?>';
- document.getElementById('groupid').value='<?=$i;?>';
- document.iform2.submit();" id="fr<?=$i?>">
- <td class="list" id="frd<?=$i?>">
- <?php if($group['scope'] != "system") : ?>
- <input type="checkbox" id="frc<?=$i?>" onclick="fr_bgcolor(<?=$i?>)" name="delete_check[]" value="<?=$i?>" />
- <?php endif; ?>
- </td>
- <td class="listlr" id="frd<?=$i?>" onclick="fr_toggle(<?=$i?>)">
- <table border="0" cellpadding="0" cellspacing="0" summary="">
- <tr>
- <td align="left" valign="middle">
- <img src="<?=$grpimg;?>" alt="<?=gettext("User");?>" title="<?=gettext("User");?>" border="0" height="16" width="16" />
- </td>
- <td align="left" valign="middle">
- <?=htmlspecialchars($group['name']); ?>&nbsp;
- </td>
- </tr>
- </table>
- </td>
- <td class="listr" id="frd<?=$i?>" onclick="fr_toggle(<?=$i?>)">
- <?=htmlspecialchars($group['description']);?>&nbsp;
- </td>
- <td class="listbg" onclick="fr_toggle(<?=$i?>)">
- <?=$groupcount;?>
- </td>
- <td valign="middle" class="list nowrap">
- <input type="image" name="editgroup[]" width="17" height="17" border="0"
- src="/themes/<?=$g['theme'];?>/images/icons/icon_e.gif"
- onclick="document.getElementById('groupid').value='<?=$i;?>';
- document.getElementById('act').value='<?php echo "edit";?>';"
- title="<?=gettext("edit group");?>" />
- &nbsp;
-<?php
- if($group['scope'] != "system"):
-?>
- <input type="image" name="delgroup[]" width="17" height="17" border="0"
- src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif"
- onclick="document.getElementById('groupid').value='<?=$i;?>';
- document.getElementById('groupname').value='<?=$group['name'];?>';
- document.getElementById('act').value='<?php echo "delgroup";?>';
- return confirm('<?=gettext("Do you really want to delete this group?");?>');"
- title="<?=gettext("delete group");?>" />
-<?php
- endif;
-?>
- </td>
- </tr>
-<?php
- $i++;
- endforeach;
-?>
- </tbody>
- </table>
- </form>
-<?php
- endif;
-?>
- </div>
- </td>
- </tr>
-</table>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+include('foot.inc'); \ No newline at end of file
diff --git a/usr/local/www/system_groupmanager_addprivs.php b/usr/local/www/system_groupmanager_addprivs.php
index ae7e884..3b06039 100644
--- a/usr/local/www/system_groupmanager_addprivs.php
+++ b/usr/local/www/system_groupmanager_addprivs.php
@@ -44,12 +44,12 @@ function cpusercmp($a, $b) {
}
function admin_groups_sort() {
- global $config;
+ global $config;
- if (!is_array($config['system']['group']))
- return;
+ if (!is_array($config['system']['group']))
+ return;
- usort($config['system']['group'], "cpusercmp");
+ usort($config['system']['group'], "cpusercmp");
}
require("guiconfig.inc");
@@ -58,7 +58,7 @@ $pgtitle = array(gettext("System"),gettext("Group manager"),gettext("Add privile
if (is_numericint($_GET['groupid']))
$groupid = $_GET['groupid'];
-if (isset($_POST['groupid']) && is_numericint($_POST['groupid']))
+elseif (isset($_POST['groupid']) && is_numericint($_POST['groupid']))
$groupid = $_POST['groupid'];
$a_group = & $config['system']['group'][$groupid];
@@ -111,7 +111,7 @@ if ($_POST) {
$retval = write_config();
$savemsg = get_std_save_message($retval);
- pfSenseHeader("system_groupmanager.php?act=edit&amp;id={$groupid}");
+ pfSenseHeader("system_groupmanager.php?act=edit&groupid={$groupid}");
exit;
}
}
@@ -121,121 +121,46 @@ if(isAjax())
print_info_box_np($savemsg);
include("head.inc");
-?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?= $jsevents["body"]["onload"] ?>">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
+if ($input_errors)
+ print_input_errors($input_errors);
+if ($savemsg)
+ print_info_box($savemsg);
+
+$tab_array = array();
+$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
+$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
+$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
+$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
+display_top_tabs($tab_array);
+
+require('classes/Form.class.php');
+$form = new Form;
+if (isset($groupid))
+{
+ $form->addGlobal(new Form_Input(
+ 'groupid',
+ null,
+ 'hidden',
+ $groupid
+ ));
+}
-<?php
+$section = new Form_Section('Add privileges for '. $a_group['name']);
-if (is_array($priv_list)) {
- $id = 0;
+$priv_list = array_map(function($p){ return $p['name']; }, $priv_list);
+asort($priv_list);
- $jdescs = "var descs = new Array();\n";
- foreach($priv_list as $pname => $pdata) {
- if (in_array($pname, $a_group['priv']))
- continue;
- $desc = addslashes($pdata['descr']);
- $jdescs .= "descs[{$id}] = '{$desc}';\n";
- $id++;
- }
+$section->addInput(new Form_Select(
+ 'sysprivs',
+ 'Assigned privileges',
+ $a_group['priv'],
+ $priv_list,
+ true
+))->setHelp('Hold down CTRL (pc)/COMMAND (mac) key to select')->setAttribute('size', 30);
- echo $jdescs;
-}
+$form->add($section);
-?>
+print $form;
-function update_description() {
- var index = document.iform.sysprivs.selectedIndex;
- document.getElementById("pdesc").innerHTML = descs[index];
-}
-
-//]]>
-</script>
-<?php
- if ($input_errors)
- print_input_errors($input_errors);
- if ($savemsg)
- print_info_box($savemsg);
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager add privileges">
- <tr>
- <td>
- <?php
- $tab_array = array();
- $tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
- $tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
- $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
- $tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
- display_top_tabs($tab_array);
- ?>
- </td>
- </tr>
- <tr>
- <td id="mainarea">
- <div class="tabcont">
- <form action="system_groupmanager_addprivs.php" method="post" name="iform" id="iform">
- <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("System Privileges");?></td>
- <td width="78%" class="vtable">
- <table>
- <tr><td>
- <select name="sysprivs[]" id="sysprivs" class="formselect" onchange="update_description();" multiple="multiple" size="35">
- <?php
- foreach($priv_list as $pname => $pdata):
- if (in_array($pname, $a_group['priv']))
- continue;
- ?>
- <option value="<?=$pname;?>"><?=$pdata['name'];?></option>
- <?php endforeach; ?>
- </select>
- <br />
- <?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
- </td><td>
- <a href='#'onClick="selectAll();">Select all</a>
- <script type="text/javascript">
- //<![CDATA[
- function selectAll() {
- var options = jQuery('select#sysprivs option');
- var len = options.length;
- for (var i = 0; i < len; i++) {
- options[i].selected = true;
- }
- }
- selectAll();
- //]]>
- </script>
- <br />
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr height="60">
- <td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
- <td width="78%" valign="top" class="vtable" id="pdesc">
- <em><?=gettext("Select a privilege from the list above for a description");?></em>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input id="submitt" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- <input id="cancelbutton" class="formbtn" type="button" value="<?=gettext("Cancel");?>" onclick="history.back()" />
- <?php if (isset($groupid)): ?>
- <input name="groupid" type="hidden" value="<?=htmlspecialchars($groupid);?>" />
- <?php endif; ?>
- </td>
- </tr>
- </table>
- </form>
- </div>
- </td>
- </tr>
-</table>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+include('foot.inc'); \ No newline at end of file
diff --git a/usr/local/www/system_usermanager.php b/usr/local/www/system_usermanager.php
index fdb9b80..8db54be 100644
--- a/usr/local/www/system_usermanager.php
+++ b/usr/local/www/system_usermanager.php
@@ -323,7 +323,7 @@ display_top_tabs($tab_array);
if (!($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors))
{
- ?>
+?>
<table class="table">
<thead>
<tr>
@@ -358,17 +358,9 @@ foreach($a_user as $i => $userent):
<td><?php if(isset($userent['disabled'])) echo "*"?></td>
<td><?=implode(",",local_user_get_groups($userent))?></td>
<td>
- <form>
- <input type="hidden" name="act" value="edit">
- <input type="hidden" name="userid" value="<?=$i?>">
- <input type="submit" class="btn btn-warning" value="edit" />
- </form>
+ <a href="?act=edit&amp;userid=<?=$i?>" class="btn btn-xs btn-primary">edit</a>
<?php if($userent['scope'] != "system"): ?>
- <form>
- <input type="hidden" name="act" value="del">
- <input type="hidden" name="userid" value="<?=$i?>">
- <input type="submit" class="btn btn-danger" value="delete" />
- </form>
+ <a href="?act=del&amp;userid=<?=$i?>" class="btn btn-xs btn-danger">delete</a>
<?php endif; ?>
</td>
</tr>
@@ -442,7 +434,7 @@ $section->addInput($input = new Form_Input(
if ($ro)
$input->setAttribute('disabled', 'disabled');
-$group = new Form_Group($input->getTitle());
+$group = new Form_Group('Password');
$group->add(new Form_Input(
'passwordfld1',
'Password',
@@ -461,7 +453,7 @@ $section->addInput($input = new Form_Input(
'Full name',
'text',
htmlspecialchars($pconfig['descr'])
-))->setHelp('User"s full name, for your own information only');
+))->setHelp('User\'s full name, for your own information only');
if ($ro)
$input->setAttribute('disabled', 'disabled');
@@ -549,10 +541,10 @@ if (isset($pconfig['uid']))
}
else
{
- $section = new Form_Section('Create certificate for user');
-
if (is_array($config['ca']) && count($config['ca']) > 0)
{
+ $section = new Form_Section('Create certificate for user');
+
$nonPrvCas = array();
foreach( $config['ca'] as $ca)
{
@@ -597,10 +589,11 @@ else
$pconfig['lifetime']
));
}
+
+ $form->add($section);
}
}
-$form->add($section);
$section = new Form_Section('Keys');
$section->addInput(new Form_Textarea(
OpenPOWER on IntegriCloud