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
ee7be889
Commit
ee7be889
authored
Apr 14, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getAllowedPages / privileges
parent
b7959258
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
14 deletions
+20
-14
auth.inc
src/etc/inc/auth.inc
+1
-1
priv.defs.inc
src/etc/inc/priv.defs.inc
+6
-0
priv.inc
src/etc/inc/priv.inc
+13
-13
No files found.
src/etc/inc/auth.inc
View file @
ee7be889
...
@@ -536,7 +536,7 @@ function local_user_get_groups($user, $all = false)
...
@@ -536,7 +536,7 @@ function local_user_get_groups($user, $all = false)
}
}
foreach
(
$config
[
'system'
][
'group'
]
as
$group
)
{
foreach
(
$config
[
'system'
][
'group'
]
as
$group
)
{
if
(
is
_array
(
$group
[
'member'
]))
{
if
(
is
set
(
$group
[
'member'
]))
{
if
(
in_array
(
$user
[
'uid'
],
$group
[
'member'
])
||
(
$group
[
'name'
]
==
"all"
&&
$all
))
{
if
(
in_array
(
$user
[
'uid'
],
$group
[
'member'
])
||
(
$group
[
'name'
]
==
"all"
&&
$all
))
{
$groups
[]
=
$group
[
'name'
];
$groups
[]
=
$group
[
'name'
];
}
}
...
...
src/etc/inc/priv.defs.inc
View file @
ee7be889
...
@@ -1462,3 +1462,9 @@ $priv_list['user-pptp-dialin']['descr'] = "Indicates whether the user is allowed
...
@@ -1462,3 +1462,9 @@ $priv_list['user-pptp-dialin']['descr'] = "Indicates whether the user is allowed
$priv_list
[
'user-pppoe-dialin'
]
=
array
();
$priv_list
[
'user-pppoe-dialin'
]
=
array
();
$priv_list
[
'user-pppoe-dialin'
][
'name'
]
=
"User - VPN - PPPOE Dialin"
;
$priv_list
[
'user-pppoe-dialin'
][
'name'
]
=
"User - VPN - PPPOE Dialin"
;
$priv_list
[
'user-pppoe-dialin'
][
'descr'
]
=
"Indicates whether the user is allowed to dial in via PPPOE"
;
$priv_list
[
'user-pppoe-dialin'
][
'descr'
]
=
"Indicates whether the user is allowed to dial in via PPPOE"
;
// sort by name ( case insensitive )
uasort
(
$priv_list
,
function
(
$a
,
$b
)
{
return
strcasecmp
(
$a
[
"name"
],
$b
[
"name"
])
;
});
src/etc/inc/priv.inc
View file @
ee7be889
...
@@ -32,12 +32,6 @@
...
@@ -32,12 +32,6 @@
require_once
'priv.defs.inc'
;
require_once
'priv.defs.inc'
;
if
(
is_array
(
$priv_list
))
{
usort
(
$priv_list
,
function
(
$a
,
$b
)
{
return
strcasecmp
(
$a
[
'name'
],
$b
[
'name'
]);
});
}
function
cmp_page_matches
(
$page
,
&
$matches
,
$fullwc
=
true
)
{
function
cmp_page_matches
(
$page
,
&
$matches
,
$fullwc
=
true
)
{
// $dbg_matches = implode(",", $matches);
// $dbg_matches = implode(",", $matches);
...
@@ -172,7 +166,7 @@ function isAllowedPage($page)
...
@@ -172,7 +166,7 @@ function isAllowedPage($page)
function
getPrivPages
(
&
$entry
,
&
$allowed_pages
)
{
function
getPrivPages
(
&
$entry
,
&
$allowed_pages
)
{
global
$priv_list
;
global
$priv_list
;
if
(
!
is_array
(
$entry
[
'priv'
]))
if
(
!
is
set
(
$entry
[
'priv'
])
||
!
is
_array
(
$entry
[
'priv'
]))
return
;
return
;
foreach
(
$entry
[
'priv'
]
as
$pname
)
{
foreach
(
$entry
[
'priv'
]
as
$pname
)
{
...
@@ -198,7 +192,11 @@ function getAllowedPages($username) {
...
@@ -198,7 +192,11 @@ function getAllowedPages($username) {
$allowed_pages
=
array
();
$allowed_pages
=
array
();
$allowed_groups
=
array
();
$allowed_groups
=
array
();
$authcfg
=
auth_get_authserver
(
$config
[
'system'
][
'webgui'
][
'authmode'
]);
if
(
isset
(
$config
[
'system'
][
'webgui'
][
'authmode'
]))
{
$authcfg
=
auth_get_authserver
(
$config
[
'system'
][
'webgui'
][
'authmode'
]);
}
else
{
$authcfg
[
'type'
]
=
'local'
;
}
// obtain ldap groups if we are in ldap mode
// obtain ldap groups if we are in ldap mode
if
(
$authcfg
[
'type'
]
==
"ldap"
)
if
(
$authcfg
[
'type'
]
==
"ldap"
)
$allowed_groups
=
@
ldap_get_groups
(
$username
,
$authcfg
);
$allowed_groups
=
@
ldap_get_groups
(
$username
,
$authcfg
);
...
@@ -208,15 +206,17 @@ function getAllowedPages($username) {
...
@@ -208,15 +206,17 @@ function getAllowedPages($username) {
getPrivPages
(
$local_user
,
$allowed_pages
);
getPrivPages
(
$local_user
,
$allowed_pages
);
// obtain local groups if we have a local user
// obtain local groups if we have a local user
if
(
$local_user
)
$allowed_groups
=
local_user_get_groups
(
$local_user
);
$allowed_groups
=
local_user_get_groups
(
$local_user
);
}
}
// build a list of allowed pages
// build a list of allowed pages
if
(
is_array
(
$config
[
'system'
][
'group'
])
&&
is_array
(
$allowed_groups
))
if
(
is_array
(
$config
[
'system'
][
'group'
])
&&
is_array
(
$allowed_groups
))
{
foreach
(
$config
[
'system'
][
'group'
]
as
$group
)
foreach
(
$config
[
'system'
][
'group'
]
as
$group
)
{
if
(
in_array
(
$group
[
'name'
],
$allowed_groups
))
if
(
in_array
(
$group
[
'name'
],
$allowed_groups
))
{
getPrivPages
(
$group
,
$allowed_pages
);
getPrivPages
(
$group
,
$allowed_pages
);
}
}
}
// $dbg_pages = implode(",", $allowed_pages);
// $dbg_pages = implode(",", $allowed_pages);
// $dbg_groups = implode(",", $allowed_groups);
// $dbg_groups = implode(",", $allowed_groups);
...
...
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