websvn |
Subversion Repositories: |
Rev 1 | Rev 3 | |
---|---|---|
Line 51... | Line 51... | |
function setUsername() { |
function setUsername() { | |
if (isset($_SERVER["REMOTE_USER"])) { |
if (isset($_SERVER["REMOTE_USER"])) { | |
$this->user = $_SERVER["REMOTE_USER"]; |
$this->user = $_SERVER["REMOTE_USER"]; | |
} else if (isset($_SERVER["REDIRECT_REMOTE_USER"])) { |
} else if (isset($_SERVER["REDIRECT_REMOTE_USER"])) { | |
$this->user = $_SERVER["REDIRECT_REMOTE_USER"]; |
$this->user = $_SERVER["REDIRECT_REMOTE_USER"]; | |
} else if (isset($_SERVER["PHP_AUTH_USER"])) { | ||
$this->user = $_SERVER["PHP_AUTH_USER"]; | ||
} |
} | |
} |
} | |
|
| |
// }}} |
// }}} | |
|
| |
// {{{ identifyGroups() |
// {{{ identifyGroups() | |
// |
// | |
// Checks to see which groups the user belongs to |
// Checks to see which groups and aliases the user belongs to | |
|
| |
function identifyGroups() { |
function identifyGroups() { | |
$this->usersGroups[] = "*"; |
$this->usersGroups[] = '*'; | |
|
| |
if (is_array($this->rights->getValues("groups"))) { |
$aliases = $this->rights->getValues('aliases'); | |
foreach ($this->rights->getValues("groups")as $group => $names) { |
if (is_array($aliases)) { | |
foreach ($aliases as $alias => $user) { | ||
if ($user == strtolower($this->user)) { | ||
$this->usersGroups[] = '&'.$alias; | ||
} | ||
} | ||
} | ||
| ||
$groups = $this->rights->getValues('groups'); | ||
if (is_array($groups)) { | ||
foreach ($groups as $group => $names) { | ||
if (in_array(strtolower($this->user), preg_split('/\s*,\s*/', $names))) { |
if (in_array(strtolower($this->user), preg_split('/\s*,\s*/', $names))) { | |
$this->usersGroups[] = "@".$group; |
$this->usersGroups[] = '@'.$group; | |
} |
} | |
|
| |
foreach ($this->usersGroups as $users_group) { |
foreach ($this->usersGroups as $users_group) { | |
if (in_array($users_group, preg_split('/\s*,\s*/', $names))) { |
if (in_array($users_group, preg_split('/\s*,\s*/', $names))) { | |
$this->usersGroups[] = "@".$group; |
$this->usersGroups[] = '@'.$group; | |
} |
} | |
} |
} | |
} |
} | |
} |
} | |
} |
} | |
Line 88... | Line 100... | |
// if they are (UNDEFINED, ALLOW or DENY) |
// if they are (UNDEFINED, ALLOW or DENY) | |
|
| |
function inList($accessors, $user) { |
function inList($accessors, $user) { | |
$output = UNDEFINED; |
$output = UNDEFINED; | |
foreach ($accessors As $key => $rights) { |
foreach ($accessors As $key => $rights) { | |
$keymatch = false; |
||
|
||
if (in_array($key, $this->usersGroups) || !strcmp($key, strtolower($user))) { |
if (in_array($key, $this->usersGroups) || !strcmp($key, strtolower($user))) { | |
$keymatch = true; |
||
} |
||
|
||
if ($keymatch) { |
||
if (strpos($rights, "r") !== false) { |
if (strpos($rights, "r") !== false) { | |
return ALLOW; |
return ALLOW; | |
} else { |
} else { | |
$output = DENY; |
$output = DENY; | |
} |
} |