- Timestamp:
- Oct 7, 2012, 9:30:38 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user.php
r415 r416 35 35 var $OnlineStateTimeout = 600; // in seconds 36 36 var $PermissionCache = array(); 37 var $PermissionGroupCache = array(); 37 38 38 39 function Check() … … 194 195 function CheckGroupPermission($GroupId, $OperationId) 195 196 { 196 // Check group-group relation 197 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `AssignedGroup` IS NOT NULL'); 198 while($DbRow = $DbResult->fetch_array()) 199 { 200 if($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return(true); 201 } 197 $PermissionExists = false; 198 // First try to check cache group-group relation 199 if(array_key_exists($GroupId, $this->PermissionGroupCache)) 200 { 201 $PermissionExists = true; 202 } else 203 { 204 // If no permission combination exists in cache, do new check of database items 205 $DbResult = $this->Database->select('PermissionGroupAssignment', '*', '`Group`="'.$GroupId.'" AND `AssignedGroup` IS NOT NULL'); 206 $DbRow = array(); 207 while($DbRow[] = $DbResult->fetch_array()); 208 $this->PermissionGroupCache[$GroupId] = $DbRow; 209 $PermissionExists = true; 210 } 211 if($PermissionExists) 212 { 213 foreach($this->PermissionGroupCache[$GroupId] as $DbRow) 214 { 215 if($DbRow['AssignedGroup'] != '') 216 if($this->CheckGroupPermission($DbRow['AssignedGroup'], $OperationId) == true) return(true); 217 } 218 } 219 202 220 203 221 // Check group-operation relation
Note:
See TracChangeset
for help on using the changeset viewer.