Index: branches/unlabeled/unlabeled-1.18.2/kernel/units/general/helpers/permissions_helper.php =================================================================== diff -u -r6107 -r6235 --- branches/unlabeled/unlabeled-1.18.2/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6107) +++ branches/unlabeled/unlabeled-1.18.2/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 6235) @@ -335,7 +335,13 @@ */ function CheckPermission($name, $type = 1, $cat_id = null) { - if ($this->Application->GetVar('u_id') == -1) { + $user_id = $this->Application->GetVar('u_id'); + return $this->CheckUserPermission($user_id, $name, $type, $cat_id); + } + + function CheckUserPermission($user_id, $name, $type = 1, $cat_id = null) + { + if ($user_id == -1) { // "root" is allowed anywhere return $name == 'SYSTEM_ACCESS.READONLY' ? 0 : 1; } @@ -371,7 +377,16 @@ WHERE (PermId = '.$perm_id.') AND (CategoryId = '.$cat_id.')'; $view_filters = Array(); - $groups = explode(',', $this->Application->RecallVar('UserGroups')); + if ($user_id == $this->Application->GetVar('u_id')) { + $groups = explode(',', $this->Application->RecallVar('UserGroups')); + } + else { // checking not current user + $sql = 'SELECT GroupId FROM '.TABLE_PREFIX.'UserGroup + WHERE (PortalUserId = '.$user_id.') AND + ( (MembershipExpires IS NULL) OR ( MembershipExpires >= UNIX_TIMESTAMP() ) )'; + $groups = $this->Conn->GetCol($sql); + array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') ); + } foreach ($groups as $group) { $view_filters[] = 'FIND_IN_SET('.$group.', ACL)'; }