Changeset 16512
- Timestamp:
- Jul 8, 2012, 9:14:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/AMenuManager/amm_root.class.inc.php
r16006 r16512 527 527 $registeredBlocks = $menu->get_registered_blocks(); 528 528 529 $nbExistingGroups=0; 530 $sql="SELECT COUNT(id) AS nbGroup 531 FROM ".GROUPS_TABLE.";"; 532 $result=pwg_query($sql); 533 if($result) 534 { 535 while($row=pwg_db_fetch_assoc($result)) 536 { 537 $nbExistingGroups=$row['nbGroup']; 538 } 539 } 540 541 529 542 $userGroups=array(); 530 543 $sql="SELECT group_id … … 556 569 if($userFiltered) 557 570 { 571 // filter access enabled 572 558 573 $users->setAlloweds($row['users'], false); 559 574 if($users->isAllowed($user['status'])) 560 575 { 576 // user is authorized, check group 561 577 if(count($userGroups)) 562 578 { 579 // users is attached to one group or more, check access for each group 580 // at least, one group must have right access 581 $nbOk=count($userGroups); 582 563 583 $groups->setAlloweds($row['groups'], false); 564 584 foreach($row['groups'] as $val) 565 585 { 566 if(isset($userGroups[$val]) and !$groups->isAllowed($val)) $ ok=false;586 if(isset($userGroups[$val]) and !$groups->isAllowed($val)) $nbOk--; 567 587 } 588 589 // no group is authorized to access the menu 590 if($nbOk==0) $ok=false; 568 591 } 569 else 592 elseif($nbExistingGroups>0 and count($row['groups'])>0) 570 593 { 571 if(count($row['groups'])==0) $ok=false; 594 // if user is not attached to any group and if at least there 1 595 // existing group, no authorization to access to the menu 596 $ok=false; 572 597 } 573 598 } 574 599 else 575 600 { 601 // user not authorized 576 602 $ok=false; 577 603 }
Note: See TracChangeset
for help on using the changeset viewer.