Project

General

Profile

« Previous | Next » 

Revision 729

Added by doc over 16 years ago

added bugfix from the forum member tavitar to fix an issue with multiple groups (module permission do not add up properly)

View differences:

class.login.php
228 228
			$_SESSION['TEMPLATE_PERMISSIONS'] = array();
229 229
			$_SESSION['GROUP_NAME'] = array();
230 230

  
231

  
231
			$first_group = true;
232 232
			foreach (split(",", $this->get_session('GROUPS_ID')) as $cur_group_id) {
233 233
				$query = "SELECT * FROM ".$this->GROUPS_TABLE." WHERE group_id = '".$cur_group_id."'";
234 234
				$results = $database->query($query);
......
240 240
				}
241 241
				// Set module permissions
242 242
				if($results_array['module_permissions'] != '') {
243
					$_SESSION['MODULE_PERMISSIONS'] = array_merge($_SESSION['MODULE_PERMISSIONS'], explode(',', $results_array['module_permissions']));
243
					if ($first_group) {
244
          	$_SESSION['MODULE_PERMISSIONS'] = explode(',', $results_array['module_permissions']);
245
          } else {
246
          	$_SESSION['MODULE_PERMISSIONS'] = array_intersect($_SESSION['MODULE_PERMISSIONS'], explode(',', $results_array['module_permissions']));
247
					}
244 248
				}
245 249
				// Set template permissions
246 250
				if($results_array['template_permissions'] != '') {
247
					$_SESSION['TEMPLATE_PERMISSIONS'] = array_merge($_SESSION['TEMPLATE_PERMISSIONS'], explode(',', $results_array['template_permissions']));
251
					if ($first_group) {
252
          	$_SESSION['TEMPLATE_PERMISSIONS'] = explode(',', $results_array['template_permissions']);
253
          } else {
254
          	$_SESSION['TEMPLATE_PERMISSIONS'] = array_intersect($_SESSION['TEMPLATE_PERMISSIONS'], explode(',', $results_array['template_permissions']));
255
					}
248 256
				}
257
				$first_group = false;
249 258
			}	
250 259

  
251 260
			// Update the users table with current ip and timestamp

Also available in: Unified diff