aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/auth.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2006-06-04 16:30:58 +0000
committerNils Adermann <naderman@naderman.de>2006-06-04 16:30:58 +0000
commit5c181bc5289c54322d61dcc008e539f7c32e882b (patch)
tree440352ec19a1035388d00945da85a38731e04897 /phpBB/includes/acp/auth.php
parentf3499d12518c38082c2ecf60958e7336195a941b (diff)
downloadforums-5c181bc5289c54322d61dcc008e539f7c32e882b.tar
forums-5c181bc5289c54322d61dcc008e539f7c32e882b.tar.gz
forums-5c181bc5289c54322d61dcc008e539f7c32e882b.tar.bz2
forums-5c181bc5289c54322d61dcc008e539f7c32e882b.tar.xz
forums-5c181bc5289c54322d61dcc008e539f7c32e882b.zip
- permission trace correctly uses language variables now
- updated documentation for the auth class - use cache for "SELECT forum_name FROM phpbb_forums WHERE forum_id = X" queries everywhere and not only in functions_display - updated the permission trace to include information about global settings overwriting local ones - take global permissions into account for local permission results on the view permission pages for users - only allow to change the post author with m_chgposter git-svn-id: file:///svn/phpbb/trunk@6009 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/auth.php')
-rw-r--r--phpBB/includes/acp/auth.php62
1 files changed, 51 insertions, 11 deletions
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 1bfde0887c..7007c05104 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -85,9 +85,10 @@ class auth_admin extends auth
*/
function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NO)
{
- global $db;
+ global $db, $user;
$hold_ary = array();
+ $view_user_mask = ($mode == 'view' && $group_id === false) ? true : false;
if ($auth_option === false || $scope === false)
{
@@ -96,19 +97,61 @@ class auth_admin extends auth
$acl_user_function = ($mode == 'set') ? 'acl_user_raw_data' : 'acl_raw_data';
- if ($forum_id !== false)
- {
- $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->$acl_user_function($user_id, $auth_option . '%', $forum_id);
- }
- else
+ if (!$view_user_mask)
{
- $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', ($scope == 'global') ? 0 : false) : $this->$acl_user_function($user_id, $auth_option . '%', ($scope == 'global') ? 0 : false);
+ if ($forum_id !== false)
+ {
+ $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->$acl_user_function($user_id, $auth_option . '%', $forum_id);
+ }
+ else
+ {
+ $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', ($scope == 'global') ? 0 : false) : $this->$acl_user_function($user_id, $auth_option . '%', ($scope == 'global') ? 0 : false);
+ }
}
// Make sure hold_ary is filled with every setting (prevents missing forums/users/groups)
$ug_id = ($group_id !== false) ? ((!is_array($group_id)) ? array($group_id) : $group_id) : ((!is_array($user_id)) ? array($user_id) : $user_id);
$forum_ids = ($forum_id !== false) ? ((!is_array($forum_id)) ? array($forum_id) : $forum_id) : (($scope == 'global') ? array(0) : array());
+ // Only those options we need
+ $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array(''));
+
+ if ($view_user_mask)
+ {
+ $auth2 = null;
+
+ $sql = 'SELECT user_id, user_permissions, user_type
+ FROM ' . USERS_TABLE . '
+ WHERE user_id IN (' . implode(',', $ug_id) . ')';
+ $result = $db->sql_query($sql);
+ while ($userdata = $db->sql_fetchrow($result))
+ {
+ if ($user->data['user_id'] != $user_id)
+ {
+ $auth2 = new auth();
+ $auth2->acl($userdata);
+ }
+ else
+ {
+ global $auth;
+ $auth2 = &$auth;
+ }
+
+ $hold_ary[$userdata['user_id']] = array();
+ foreach ($forum_ids as $f_id)
+ {
+ $hold_ary[$userdata['user_id']][$f_id] = array();
+ foreach ($compare_options as $option)
+ {
+ $hold_ary[$userdata['user_id']][$f_id][$option] = $auth2->acl_get($option, $f_id);
+ }
+ }
+ }
+ $db->sql_freeresult($result);
+ unset($userdata);
+ unset($auth2);
+ }
+
// If forum_ids is false and the scope is local we actually want to have all forums within the array
if ($scope == 'local' && !sizeof($forum_ids))
{
@@ -141,9 +184,6 @@ class auth_admin extends auth
// Now, we need to fill the gaps with $acl_fill. ;)
- // Only those options we need
- $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array(''));
-
// Now switch back to keys
if (sizeof($compare_options))
{
@@ -422,7 +462,7 @@ class auth_admin extends auth
$title = ($role_description) ? ' title="' . $role_description . '"' : '';
$s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>';
}
-
+
if ($s_role_options)
{
$s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options;