mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
- new acl method -> acl_getf_global()
usage example: acl_getf_global('m_approve'); returns true if user has m_approve permission in one or more forums, else false git-svn-id: file:///svn/phpbb/trunk@5545 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
89feef3ddc
commit
17fdaa0678
1 changed files with 43 additions and 0 deletions
|
@ -221,6 +221,49 @@ class auth
|
||||||
return $acl_f;
|
return $acl_f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get local permission state for any forum.
|
||||||
|
*
|
||||||
|
* Returns true if user has the permission in one or more forums, false if in no forum.
|
||||||
|
* If global option is checked it returns the global state (same as acl_get($opt))
|
||||||
|
* Local option has precedence...
|
||||||
|
*/
|
||||||
|
function acl_getf_global($opt)
|
||||||
|
{
|
||||||
|
static $cache;
|
||||||
|
|
||||||
|
if (!isset($cache))
|
||||||
|
{
|
||||||
|
$cache = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowed = false;
|
||||||
|
if (isset($this->acl_options['local'][$opt]))
|
||||||
|
{
|
||||||
|
foreach ($this->acl as $f => $bitstring)
|
||||||
|
{
|
||||||
|
// Skip global settings
|
||||||
|
if (!$f)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$allowed = (!isset($cache[$f][$opt])) ? $this->acl_get($opt, $f) : $cache[$f][$opt];
|
||||||
|
|
||||||
|
if ($allowed)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isset($this->acl_options['global'][$opt]))
|
||||||
|
{
|
||||||
|
$allowed = $this->acl_get($opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $allowed;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get permission settings (more than one)
|
* Get permission settings (more than one)
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue