File modules/cms/action/TagAction.class.php
Last commit: Thu Feb 16 22:57:35 2023 +0100 Jan Dankert New: More functions (adding, deleting) for tags.
1 <?php 2 3 namespace cms\action; 4 5 use cms\model\Permission; 6 use cms\model\Folder; 7 use cms\model\Project; 8 use cms\model\Tag; 9 use util\exception\SecurityException; 10 11 /** 12 * Tag. 13 * 14 * @author Jan Dankert 15 */ 16 class TagAction extends BaseAction 17 { 18 /** 19 * @var Tag 20 */ 21 protected $tag; 22 23 24 function __construct() 25 { 26 parent::__construct(); 27 } 28 29 30 public function init() 31 { 32 $this->tag = new Tag( $this->request->getId() ); 33 $this->tag->load(); 34 35 if ( ! $this->userMayReadProject() ) { 36 throw new SecurityException(); 37 } 38 } 39 40 41 42 /** 43 * Stellt fest, ob der angemeldete Benutzer Projekt-Admin ist. 44 * Dies ist der Fall, wenn der Benutzer PROP-Rechte im Root-Folder hat. 45 * @return bool|int 46 */ 47 protected function userMayReadProject() { 48 49 $project = Project::create( $this->tag->projectid ); 50 $rootFolder = new Folder( $project->getRootObjectId() ); 51 52 return $rootFolder->hasRight(Permission::ACL_READ); 53 } 54 55 56 57 58 59 /** 60 * User must be an administrator. 61 */ 62 public function checkAccess() { 63 if ( ! $this->userMayReadProject() ) 64 throw new SecurityException(); 65 } 66 67 }
Downloadmodules/cms/action/TagAction.class.php
History Thu, 16 Feb 2023 22:57:35 +0100 Jan Dankert New: More functions (adding, deleting) for tags. Thu, 16 Feb 2023 01:04:38 +0100 Jan Dankert New: Tags for base objects.