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
Hide 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,38 +31,45 @@
require_once
(
"guiconfig.inc"
);
function
get_user_privdesc
(
&
$user
)
{
global
$priv_list
;
$privs
=
array
();
$user_privs
=
$user
[
'priv'
];
if
(
!
is_array
(
$user_privs
))
$user_privs
=
array
();
$names
=
local_user_get_groups
(
$user
,
true
);
foreach
(
$names
as
$name
)
{
$group
=
getGroupEntry
(
$name
);
$group_privs
=
$group
[
'priv'
];
if
(
!
is_array
(
$group_privs
))
continue
;
foreach
(
$group_privs
as
$pname
)
{
if
(
in_array
(
$pname
,
$user_privs
))
continue
;
if
(
!
$priv_list
[
$pname
])
continue
;
$priv
=
$priv_list
[
$pname
];
$priv
[
'group'
]
=
$group
[
'name'
];
$privs
[]
=
$priv
;
}
}
function
get_user_privdesc
(
&
$user
)
{
global
$priv_list
;
$privs
=
array
();
$user_privs
=
$user
[
'priv'
];
if
(
!
is_array
(
$user_privs
))
{
$user_privs
=
array
();
}
foreach
(
$user_privs
as
$pname
)
if
(
$priv_list
[
$pname
])
$privs
[]
=
$priv_list
[
$pname
];
$names
=
local_user_get_groups
(
$user
,
true
);
return
$privs
;
foreach
(
$names
as
$name
)
{
$group
=
getGroupEntry
(
$name
);
$group_privs
=
$group
[
'priv'
];
if
(
!
is_array
(
$group_privs
))
{
continue
;
}
foreach
(
$group_privs
as
$pname
)
{
if
(
in_array
(
$pname
,
$user_privs
))
{
continue
;
}
if
(
!
$priv_list
[
$pname
])
{
continue
;
}
$priv
=
$priv_list
[
$pname
];
$priv
[
'group'
]
=
$group
[
'name'
];
$privs
[]
=
$priv
;
}
}
foreach
(
$user_privs
as
$pname
)
{
if
(
$priv_list
[
$pname
])
{
$privs
[]
=
$priv_list
[
$pname
];
}
}
return
$privs
;
}
...
...
@@ -70,6 +77,8 @@ function get_user_privdesc(& $user) {
// start admin user code
$pgtitle
=
array
(
gettext
(
"System"
),
gettext
(
"User Manager"
));
$input_errors
=
array
();
if
(
isset
(
$_POST
[
'userid'
])
&&
is_numericint
(
$_POST
[
'userid'
]))
{
$id
=
$_POST
[
'userid'
];
}
...
...
@@ -181,8 +190,7 @@ if ($_POST['act'] == "deluser") {
$pconfig
[
'lifetime'
]
=
365
;
}
if
(
$_POST
[
'save'
])
{
unset
(
$input_errors
);
if
(
isset
(
$_POST
[
'save'
]))
{
$pconfig
=
$_POST
;
/* input validation */
...
...
@@ -227,7 +235,7 @@ if ($_POST['save']) {
$oldusername
=
""
;
}
/* make sure this user name is unique */
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
foreach
(
$a_user
as
$userent
)
{
if
(
$userent
[
'name'
]
==
$_POST
[
'usernamefld'
]
&&
$oldusername
!=
$_POST
[
'usernamefld'
])
{
$input_errors
[]
=
gettext
(
"Another entry with the same username already exists."
);
...
...
@@ -236,7 +244,7 @@ if ($_POST['save']) {
}
}
/* also make sure it is not reserved */
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$system_users
=
explode
(
"
\n
"
,
file_get_contents
(
"/etc/passwd"
));
foreach
(
$system_users
as
$s_user
)
{
$ent
=
explode
(
":"
,
$s_user
);
...
...
@@ -278,7 +286,7 @@ if ($_POST['save']) {
exit
;
}
if
(
!
$input_errors
)
{
if
(
count
(
$input_errors
)
==
0
)
{
$userent
=
array
();
if
(
isset
(
$id
)
&&
$a_user
[
$id
])
{
...
...
@@ -482,7 +490,7 @@ function sshkeyClicked(obj) {
<div
class=
"tab-content content-box col-xs-12 table-responsive"
>
<?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()"
>
...
...
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