Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
f9df4803
Commit
f9df4803
authored
Jul 28, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) some minor style fixes in system_usermanager.php
parent
19918879
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
36 deletions
+44
-36
system_usermanager.php
src/www/system_usermanager.php
+44
-36
No files found.
src/www/system_usermanager.php
View file @
f9df4803
...
@@ -31,36 +31,43 @@
...
@@ -31,36 +31,43 @@
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
function
get_user_privdesc
(
&
$user
)
{
function
get_user_privdesc
(
&
$user
)
{
global
$priv_list
;
global
$priv_list
;
$privs
=
array
();
$privs
=
array
();
$user_privs
=
$user
[
'priv'
];
$user_privs
=
$user
[
'priv'
];
if
(
!
is_array
(
$user_privs
))
if
(
!
is_array
(
$user_privs
))
{
$user_privs
=
array
();
$user_privs
=
array
();
}
$names
=
local_user_get_groups
(
$user
,
true
);
$names
=
local_user_get_groups
(
$user
,
true
);
foreach
(
$names
as
$name
)
{
foreach
(
$names
as
$name
)
{
$group
=
getGroupEntry
(
$name
);
$group
=
getGroupEntry
(
$name
);
$group_privs
=
$group
[
'priv'
];
$group_privs
=
$group
[
'priv'
];
if
(
!
is_array
(
$group_privs
))
if
(
!
is_array
(
$group_privs
))
{
continue
;
continue
;
}
foreach
(
$group_privs
as
$pname
)
{
foreach
(
$group_privs
as
$pname
)
{
if
(
in_array
(
$pname
,
$user_privs
))
if
(
in_array
(
$pname
,
$user_privs
))
{
continue
;
continue
;
if
(
!
$priv_list
[
$pname
])
}
if
(
!
$priv_list
[
$pname
])
{
continue
;
continue
;
}
$priv
=
$priv_list
[
$pname
];
$priv
=
$priv_list
[
$pname
];
$priv
[
'group'
]
=
$group
[
'name'
];
$priv
[
'group'
]
=
$group
[
'name'
];
$privs
[]
=
$priv
;
$privs
[]
=
$priv
;
}
}
}
}
foreach
(
$user_privs
as
$pname
)
foreach
(
$user_privs
as
$pname
)
{
if
(
$priv_list
[
$pname
])
if
(
$priv_list
[
$pname
])
{
$privs
[]
=
$priv_list
[
$pname
];
$privs
[]
=
$priv_list
[
$pname
];
}
}
return
$privs
;
return
$privs
;
}
}
...
@@ -70,6 +77,8 @@ function get_user_privdesc(& $user) {
...
@@ -70,6 +77,8 @@ function get_user_privdesc(& $user) {
// start admin user code
// start admin user code
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"User Manager"
));
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"User Manager"
));
$input_errors
=
array
();
if
(
isset
(
$_POST
[
'userid'
])
&&
is_numericint
(
$_POST
[
'userid'
]))
{
if
(
isset
(
$_POST
[
'userid'
])
&&
is_numericint
(
$_POST
[
'userid'
]))
{
$id
=
$_POST
[
'userid'
];
$id
=
$_POST
[
'userid'
];
}
}
...
@@ -181,8 +190,7 @@ if ($_POST['act'] == "deluser") {
...
@@ -181,8 +190,7 @@ if ($_POST['act'] == "deluser") {
$pconfig
[
'lifetime'
]
=
365
;
$pconfig
[
'lifetime'
]
=
365
;
}
}
if
(
$_POST
[
'save'
])
{
if
(
isset
(
$_POST
[
'save'
]))
{
unset
(
$input_errors
);
$pconfig
=
$_POST
;
$pconfig
=
$_POST
;
/* input validation */
/* input validation */
...
@@ -227,7 +235,7 @@ if ($_POST['save']) {
...
@@ -227,7 +235,7 @@ if ($_POST['save']) {
$oldusername
=
""
;
$oldusername
=
""
;
}
}
/* make sure this user name is unique */
/* make sure this user name is unique */
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
foreach
(
$a_user
as
$userent
)
{
foreach
(
$a_user
as
$userent
)
{
if
(
$userent
[
'name'
]
==
$_POST
[
'usernamefld'
]
&&
$oldusername
!=
$_POST
[
'usernamefld'
])
{
if
(
$userent
[
'name'
]
==
$_POST
[
'usernamefld'
]
&&
$oldusername
!=
$_POST
[
'usernamefld'
])
{
$input_errors
[]
=
gettext
(
"Another entry with the same username already exists."
);
$input_errors
[]
=
gettext
(
"Another entry with the same username already exists."
);
...
@@ -236,7 +244,7 @@ if ($_POST['save']) {
...
@@ -236,7 +244,7 @@ if ($_POST['save']) {
}
}
}
}
/* also make sure it is not reserved */
/* also make sure it is not reserved */
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$system_users
=
explode
(
"
\n
"
,
file_get_contents
(
"/etc/passwd"
));
$system_users
=
explode
(
"
\n
"
,
file_get_contents
(
"/etc/passwd"
));
foreach
(
$system_users
as
$s_user
)
{
foreach
(
$system_users
as
$s_user
)
{
$ent
=
explode
(
":"
,
$s_user
);
$ent
=
explode
(
":"
,
$s_user
);
...
@@ -278,7 +286,7 @@ if ($_POST['save']) {
...
@@ -278,7 +286,7 @@ if ($_POST['save']) {
exit
;
exit
;
}
}
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$userent
=
array
();
$userent
=
array
();
if
(
isset
(
$id
)
&&
$a_user
[
$id
])
{
if
(
isset
(
$id
)
&&
$a_user
[
$id
])
{
...
@@ -482,7 +490,7 @@ function sshkeyClicked(obj) {
...
@@ -482,7 +490,7 @@ function sshkeyClicked(obj) {
<div
class=
"tab-content content-box col-xs-12 table-responsive"
>
<div
class=
"tab-content content-box col-xs-12 table-responsive"
>
<?php
<?php
if
(
$_POST
[
'act'
]
==
"new"
||
$_POST
[
'act'
]
==
"edit"
||
$input_errors
)
:
if
(
$_POST
[
'act'
]
==
"new"
||
$_POST
[
'act'
]
==
"edit"
||
count
(
$input_errors
)
>
0
)
:
?>
?>
<form
action=
"system_usermanager.php"
method=
"post"
name=
"iform"
id=
"iform"
onsubmit=
"presubmit()"
>
<form
action=
"system_usermanager.php"
method=
"post"
name=
"iform"
id=
"iform"
onsubmit=
"presubmit()"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment