File modules/cms/action/user/UserRightsAction.class.php
Last commit: Sun Dec 5 20:33:24 2021 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'.
1 <?php 2 namespace cms\action\user; 3 use cms\action\Action; 4 use cms\action\Method; 5 use cms\action\UserAction; 6 use cms\model\Permission; 7 use cms\model\BaseObject; 8 use cms\model\Group; 9 use cms\model\Language; 10 use cms\model\Project; 11 use cms\model\User; 12 use language\Messages; 13 14 15 class UserRightsAction extends UserAction implements Method { 16 public function view() { 17 $rights = $this->user->getAllAcls(); 18 19 $projects = array(); 20 21 foreach( $rights as $acl ) 22 { 23 /* @var $acl Permission */ 24 if ( !isset($projects[$acl->projectid])) 25 { 26 $p = Project::create( $acl->projectid ); 27 28 $projects[$acl->projectid] = array(); 29 $projects[$acl->projectid]['projectname'] = $p->load()->name; 30 $projects[$acl->projectid]['rights' ] = array(); 31 } 32 33 $right = array(); 34 35 if ( $acl->languageid > 0 ) 36 { 37 $language = new Language($acl->languageid); 38 $language->load(); 39 $right['languagename'] = $language->name; 40 } 41 else 42 { 43 $right['languagename'] = \cms\base\Language::lang('ALL_LANGUAGES'); 44 } 45 46 47 $o = new BaseObject($acl->objectid); 48 $o->objectLoad(); 49 $right['objectname'] = $o->filename; 50 $right['objectid' ] = $o->objectid; 51 $right['objecttype'] = $o->getType(); 52 53 if ( $acl->userid > 0 ) 54 { 55 $user = new User($acl->userid); 56 $user->load(); 57 $right['username'] = $user->name; 58 } 59 elseif ( $acl->groupid > 0 ) 60 { 61 $group = new Group($acl->groupid); 62 $group->load(); 63 $right['groupname'] = $group->name; 64 } 65 else 66 { 67 ; 68 // Berechtigung fuer "alle". 69 } 70 71 // $show = array(); 72 // foreach( $acl->getProperties() as $p=>$set) 73 // $show[$p] = $set; 74 // 75 // $right['show'] = $show; 76 $right['bits'] = $acl->getProperties(); 77 78 $projects[$acl->projectid]['rights'][] = $right; 79 } 80 81 $this->setTemplateVar('projects' ,$projects ); 82 83 $this->setTemplateVar('show',Permission::getAvailableRights() ); 84 85 if ( $this->user->isAdmin ) 86 $this->addWarningFor($this->user,Messages::ADMIN_NEEDS_NO_RIGHTS); 87 } 88 public function post() { 89 } 90 }
Downloadmodules/cms/action/user/UserRightsAction.class.php
History Sun, 5 Dec 2021 20:33:24 +0100 dankert Cleanup: Removed unusable properties from class 'Value' and 'BaseObject'. Mon, 4 Jan 2021 19:03:18 +0100 Jan Dankert Refactoring: ACL class is renamed to Permission, because most RBAC/DMAC concepts are calling it a permission. Thu, 19 Nov 2020 14:49:58 +0100 Jan Dankert Fix: Action::addNotice() is replaced by Action::addNoticeFor() Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.