ModelAction.class.php (1769B)
1 <?php 2 3 namespace cms\action; 4 5 use cms\model\Folder; 6 use cms\model\Model; 7 use cms\model\Permission; 8 use cms\model\Project; 9 use language\Messages; 10 use util\exception\SecurityException; 11 12 13 // OpenRat Content Management System 14 // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de 15 // 16 // This program is free software; you can redistribute it and/or 17 // modify it under the terms of the GNU General Public License 18 // as published by the Free Software Foundation; either version 2 19 // of the License, or (at your option) any later version. 20 // 21 // This program is distributed in the hope that it will be useful, 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 24 // GNU General Public License for more details. 25 // 26 // You should have received a copy of the GNU General Public License 27 // along with this program; if not, write to the Free Software 28 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 29 30 31 /** 32 * Action-Klasse zum Bearbeiten eines Projetmodells 33 * @author $Author$ 34 * @version $Revision$ 35 * @package openrat.actions 36 */ 37 class ModelAction extends BaseAction 38 { 39 /** 40 * @var Model 41 */ 42 protected $model; 43 44 45 function __construct() 46 { 47 parent::__construct(); 48 49 } 50 51 52 public function init() 53 { 54 $this->model = new Model( $this->request->getId() ); 55 $this->model->load(); 56 } 57 58 59 /** 60 * User must be an project administrator. 61 */ 62 public function checkAccess() { 63 $project = new Project( $this->model->projectid ); 64 $rootFolderId = $project->getRootObjectId(); 65 66 $rootFolder = new Folder( $rootFolderId ); 67 $rootFolder->load(); 68 69 if ( ! $rootFolder->hasRight( Permission::ACL_PROP ) ) 70 throw new SecurityException(); 71 } 72 73 }