openrat-cms

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

ObjectDelaclAction.class.php (950B)


      1 <?php
      2 namespace cms\action\object;
      3 use cms\action\Action;
      4 use cms\action\Method;
      5 use cms\action\ObjectAction;
      6 use cms\model\Permission;
      7 use cms\model\BaseObject;
      8 use language\Messages;
      9 use util\exception\SecurityException;
     10 use util\Http;
     11 
     12 class ObjectDelaclAction extends ObjectAction implements Method {
     13 
     14 	public function getRequiredPermission()
     15 	{
     16 		return Permission::ACL_GRANT;
     17 	}
     18 
     19     public function view() {
     20     }
     21     public function post() {
     22 		$permission = new Permission($this->request->getText('aclid'));
     23 		$permission->load();
     24 
     25 		// Nachschauen, ob der Benutzer ueberhaupt berechtigt ist, an
     26 		// diesem Objekt die ACLs zu aendern.
     27 		$o = new BaseObject( $permission->objectid );
     28 		$o->load();
     29 
     30 		if	( !$o->hasRight( Permission::ACL_GRANT ) )
     31 			throw new SecurityException( 'no grant rights' ); // Da wollte uns wohl einer vereimern.
     32 
     33 		$permission->delete(); // Weg mit der ACL
     34 		
     35 		$this->addNoticeFor( $o,Messages::DELETED );
     36     }
     37 }