openrat-cms

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

ProjectEditAction.class.php (971B)


      1 <?php
      2 namespace cms\action\project;
      3 use cms\action\Action;
      4 use cms\action\Method;
      5 use cms\action\ProjectAction;
      6 use cms\model\Folder;
      7 use cms\model\Permission;
      8 use util\exception\SecurityException;
      9 
     10 class ProjectEditAction extends ProjectAction implements Method {
     11 
     12     public function view() {
     13 
     14 		$this->setTemplateVar('name'            ,$this->project->name);
     15         $this->setTemplateVar('projectid'       ,$this->project->projectid);
     16         $this->setTemplateVar('rootobjectid'    ,$this->project->getRootObjectId());
     17         $this->setTemplateVar('is_project_admin',$this->userIsProjectAdmin());
     18     }
     19     public function post() {
     20     }
     21 
     22 
     23 
     24 	/**
     25 	 * the root object must be readable by the current user.
     26 	 */
     27 	public function checkAccess() {
     28 		$rootFolderId = $this->project->getRootObjectId();
     29 
     30 		$rootFolder = new Folder( $rootFolderId );
     31 		$rootFolder->load();
     32 
     33 		if   ( ! $rootFolder->hasRight( Permission::ACL_READ )  )
     34 			throw new SecurityException();
     35 	}
     36 
     37 }