diff options
author | Ermal Luci <eri@pfsense.org> | 2009-06-18 12:40:11 +0000 |
---|---|---|
committer | Ermal Luci <eri@pfsense.org> | 2009-06-18 12:40:11 +0000 |
commit | 6dc88d5352ea963d85708379405e238e0518e990 (patch) | |
tree | e51eb1a505ff148a495c642c9b6ed225476a58ce /etc/inc/auth.inc | |
parent | 4b9980ecfff36202b6ea8dbf7d41e44f78ba52f3 (diff) | |
download | pfsense-6dc88d5352ea963d85708379405e238e0518e990.zip pfsense-6dc88d5352ea963d85708379405e238e0518e990.tar.gz |
* Move functions that output html to guiconfig.inc
* Remove some recursive dependency on some includes
* Remove ^M or \r from files
* Remove some entries from functions.inc to avoid including them twice
* Remove some unneccessary includes from some files
NOTE: There is some more work to be done for pkg-utils.inc to be removed from backend as a dependency.
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r-- | etc/inc/auth.inc | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 09e0273..dd69a28 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -42,7 +42,7 @@ * file courtesy of Michael Retterklieber. */ -require_once("functions.inc"); +require_once("config.inc"); $groupindex = index_groups(); $userindex = index_users(); @@ -107,6 +107,39 @@ function & getGroupEntryByGID($gid) { return false; } +function get_user_privileges(& $user) { + + $privs = $user['priv']; + if (!is_array($privs)) + $privs = array(); + + $names = local_user_get_groups($user, true); + + foreach ($names as $name) { + $group = getGroupEntry($name); + if (is_array($group['priv'])) + $privs = array_merge( $privs, $group['priv']); + } + + return $privs; +} + +function userHasPrivilege($userent, $privid = false) { + + if (!$privid || !is_array($userent)) + return false; + + $privs = get_user_privileges($userent); + + if (!is_array($privs)) + return false; + + if (!in_array($privid, $privs)) + return false; + + return true; +} + function local_backed($username, $passwd) { $user = getUserEntry($username); @@ -872,7 +905,7 @@ function session_auth($backing) { return false; /* redirect to page the user is on, it'll prompt them to login again */ - pfSenseHeader($scriptName); + Header("Location: {$scriptName}"); return false; } |