summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/system_groupmanager.php
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-03-29 15:03:57 -0400
committerStephen Beaver <sbeaver@netgate.com>2016-03-29 15:19:57 -0400
commit79ed8ce0628f18fb65b5897a1d64c40781f56907 (patch)
tree1e263c4e985533a4eca51a14a0a6159b8bc9d42a /src/usr/local/www/system_groupmanager.php
parent792adb45108d8d5b6eff079b3e14d7197b5c2670 (diff)
downloadpfsense-79ed8ce0628f18fb65b5897a1d64c40781f56907.zip
pfsense-79ed8ce0628f18fb65b5897a1d64c40781f56907.tar.gz
Revised scope handling to allow user to set to remote or local, but only if it is not currently "system"
Diffstat (limited to 'src/usr/local/www/system_groupmanager.php')
-rw-r--r--src/usr/local/www/system_groupmanager.php33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php
index 94d16da..d94d6e0 100644
--- a/src/usr/local/www/system_groupmanager.php
+++ b/src/usr/local/www/system_groupmanager.php
@@ -142,7 +142,7 @@ if ($act == "edit") {
if (isset($id) && isset($a_group[$id])) {
$pconfig['name'] = $a_group[$id]['name'];
$pconfig['gid'] = $a_group[$id]['gid'];
- $pconfig['gtype'] = $a_group[$id]['scope'];
+ $pconfig['gtype'] = empty($a_group[$id]['scope']) ? "local" : $a_group[$id]['scope'];
$pconfig['description'] = $a_group[$id]['description'];
$pconfig['members'] = $a_group[$id]['member'];
$pconfig['priv'] = $a_group[$id]['priv'];
@@ -177,10 +177,17 @@ if (isset($_POST['save'])) {
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
- if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['groupname'])) {
- $input_errors[] = gettext("The group name contains invalid characters.");
+ if ($_POST['gtype'] == local) {
+ if (preg_match("/[^a-zA-Z0-9\.\-_]/", $_POST['groupname'])) {
+ $input_errors[] = gettext("The group name contains invalid characters.");
+ }
+ } else {
+ if (preg_match("/[^a-zA-Z0-9\.\- _]/", $_POST['groupname'])) {
+ $input_errors[] = gettext("The group name contains invalid characters.");
+ }
}
+
if (strlen($_POST['groupname']) > 16) {
$input_errors[] = gettext("The group name is longer than 16 characters.");
}
@@ -203,6 +210,7 @@ if (isset($_POST['save'])) {
$group['name'] = $_POST['groupname'];
$group['description'] = $_POST['description'];
+ $group['scope'] = $_POST['gtype'];
if (empty($_POST['members'])) {
unset($group['member']);
@@ -382,14 +390,14 @@ if (isset($id) && $a_group[$id]){
}
$section = new Form_Section('Group Properties');
-
+/*
if ($_GET['act'] != "new") {
$section->addInput(new Form_StaticText(
'Defined by',
strtoupper($pconfig['gtype'])
));
}
-
+*/
$section->addInput($input = new Form_Input(
'groupname',
'Group name',
@@ -399,6 +407,20 @@ $section->addInput($input = new Form_Input(
if ($pconfig['gtype'] == "system") {
$input->setReadonly();
+
+ $section->addInput(new Form_Input(
+ 'gtype',
+ 'Scope',
+ 'text',
+ $pconfig['gtype']
+ ))->setReadonly();
+} else {
+ $section->addInput(new Form_Select(
+ 'gtype',
+ 'Scope',
+ $pconfig['gtype'],
+ ["local" => "Local", "remote" => "Remote"]
+ ));
}
$section->addInput(new Form_Input(
@@ -408,6 +430,7 @@ $section->addInput(new Form_Input(
$pconfig['description']
))->setHelp('Group description, for administrative information only');
+
$form->add($section);
if ($pconfig['gid'] != 1998) { // all users group
OpenPOWER on IntegriCloud