diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2006-02-12 14:11:30 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-02-12 14:11:30 +0000 |
| commit | 17fdaa06782b9074ed74daf9dc68c6213f157489 (patch) | |
| tree | 433e3a65b870d86af4d92b7b0549333233b4d8c7 | |
| parent | 89feef3ddcfe3fcdcdf66677cfa0f4339328e1fc (diff) | |
| download | forums-17fdaa06782b9074ed74daf9dc68c6213f157489.tar forums-17fdaa06782b9074ed74daf9dc68c6213f157489.tar.gz forums-17fdaa06782b9074ed74daf9dc68c6213f157489.tar.bz2 forums-17fdaa06782b9074ed74daf9dc68c6213f157489.tar.xz forums-17fdaa06782b9074ed74daf9dc68c6213f157489.zip | |
- 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
| -rw-r--r-- | phpBB/includes/auth.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index 63a7c44563..9608909088 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -222,6 +222,49 @@ class auth } /** + * 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) */ function acl_gets() |
