openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

GroupRightsAction.class.php (1598B)


      1 <?php
      2 namespace cms\action\group;
      3 use cms\action\GroupAction;
      4 use cms\action\Method;
      5 use cms\model\Permission;
      6 use cms\model\BaseObject;
      7 use cms\model\Group;
      8 use cms\model\Language;
      9 use cms\model\Project;
     10 
     11 class GroupRightsAction extends GroupAction implements Method {
     12 
     13 
     14     public function view() {
     15 		$rights = $this->group->getAllAcls();
     16 
     17 		$projects = array();
     18 		
     19 		foreach( $rights as $acl )
     20 		{
     21 			if	( !isset($projects[$acl->projectid]))
     22 			{
     23 				$projects[$acl->projectid] = array();
     24 				$p = new Project($acl->projectid);
     25 				$p->load();
     26 				$projects[$acl->projectid]['projectname'] = $p->name;
     27 				$projects[$acl->projectid]['rights'     ] = array();
     28 			}
     29 
     30 			$right = array();
     31 			
     32 			if	( $acl->languageid > 0 )
     33 			{
     34 				$language = new Language($acl->languageid);
     35 				$language->load();
     36 				$right['languagename'] = $language->name;
     37 			}
     38 			else
     39 			{
     40 				$right['languagename'] = \cms\base\Language::lang('ALL_LANGUAGES');
     41 			}
     42 			
     43 			
     44 			$o = new BaseObject($acl->objectid);
     45 			$o->objectLoad();
     46 			$right['objectname'] = $o->filename;
     47 			$right['objectid'  ] = $o->objectid;
     48 			$right['objecttype'] = $o->getType();
     49 			
     50 			if	( $acl->groupid > 0 )
     51 			{
     52 				$group = new Group($acl->groupid);
     53 				$group->load();
     54 				$right['groupname'] = $group->name;
     55 			}
     56 			else
     57 			{
     58 				// Berechtigung f�r "alle".
     59 			}
     60 
     61 			$right['bits'] = $acl->getProperties();
     62 			
     63 			$projects[$acl->projectid]['rights'][] = $right;
     64 		}
     65 		
     66 		$this->setTemplateVar('projects'    ,$projects );
     67 		
     68 		$this->setTemplateVar('show',Permission::getAvailableRights() );
     69     }
     70 
     71 
     72     public function post() {
     73     }
     74 }