File modules/cms/action/projectlist/ProjectlistEditAction.class.php

Last commit: Fri Dec 3 22:30:29 2021 +0100	dankert	Fix: Check rights for listing projects.
1 <?php 2 namespace cms\action\projectlist; 3 use cms\action\Action; 4 use cms\action\Method; 5 use cms\action\ProjectlistAction; 6 use cms\model\Permission; 7 use cms\model\Folder; 8 use cms\model\Project; 9 10 class ProjectlistEditAction extends ProjectlistAction implements Method { 11 12 /** 13 * Get a listing of all readable projects. 14 * 15 * @return void 16 */ 17 public function view() { 18 19 $list = array(); 20 21 foreach (Project::getAllProjects() as $id => $name) { 22 23 $project = new Project($id); 24 $rootFolder = new Folder($project->getRootObjectId()); 25 26 // Check permission, the user must have the READ permission. 27 if ($rootFolder->hasRight(Permission::ACL_READ)) { 28 $list[ $id ] = [ 29 'id' => $id, 30 'name' => $name, 31 ]; 32 } 33 } 34 35 $this->setTemplateVar('projects',$list); 36 $this->setTemplateVar('add',$this->userIsAdmin()); 37 } 38 39 40 public function post() { 41 } 42 43 44 /** 45 * Check permission. 46 * This action is allowed to all users. 47 * 48 * @return true 49 */ 50 function checkAccess() 51 { 52 return true; 53 } 54 }
Download modules/cms/action/projectlist/ProjectlistEditAction.class.php
History Fri, 3 Dec 2021 22:30:29 +0100 dankert Fix: Check rights for listing projects. Sun, 14 Mar 2021 22:29:56 +0100 Jan Dankert Refactoring: Clearer access check. Sat, 6 Mar 2021 03:42:38 +0100 Jan Dankert New: Better permission checks. 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. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class.