openrat-cms

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

commit 55ae6410e625a178c2da1f218917ca5bfecc5086
parent 59bb463967760462192454c7347fd51ebcdc9c1f
Author: dankert <openrat@jandankert.de>
Date:   Sun,  5 Dec 2021 22:36:40 +0100

Fixed deleting and inheriting of permissions.

Diffstat:
Mmodules/cms/action/object/ObjectDelaclAction.class.php | 1+
Mmodules/cms/action/object/ObjectInheritAction.class.php | 21++++++++++++---------
2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/modules/cms/action/object/ObjectDelaclAction.class.php b/modules/cms/action/object/ObjectDelaclAction.class.php @@ -24,6 +24,7 @@ class ObjectDelaclAction extends ObjectAction implements Method { // Nachschauen, ob der Benutzer ueberhaupt berechtigt ist, an // diesem Objekt die ACLs zu aendern. $o = new BaseObject( $permission->objectid ); + $o->load(); if ( !$o->hasRight( Permission::ACL_GRANT ) ) Http::notAuthorized('no grant rights'); // Da wollte uns wohl einer vereimern. diff --git a/modules/cms/action/object/ObjectInheritAction.class.php b/modules/cms/action/object/ObjectInheritAction.class.php @@ -25,20 +25,22 @@ class ObjectInheritAction extends ObjectAction implements Method { $acllist = array(); $this->setTemplateVar('acls',$acllist ); } + + public function post() { + Session::close(); - $folder = new Folder( $this->request->getId() ); - $folder->load(); + $baseObject = new Folder( $this->request->getId() ); + $baseObject->load(); if ( ! $this->request->has('inherit') ) { - $this->addWarningFor( $folder,Messages::NOTHING_DONE); + $this->addWarningFor( $baseObject,Messages::NOTHING_DONE); return; } - - - $aclids = $folder->getAllAclIds(); + + $aclids = $baseObject->getAllAclIds(); $newAclList = array(); foreach( $aclids as $aclid ) @@ -50,9 +52,9 @@ class ObjectInheritAction extends ObjectAction implements Method { } Logger::debug('inheriting '.count($newAclList).' acls'); - $oids = $folder->getObjectIds(); + $oids = $baseObject->getObjectIds(); - foreach( $folder->getAllSubfolderIds() as $sfid ) + foreach( $baseObject->getAllSubfolderIds() as $sfid ) { $subfolder = new Folder( $sfid ); @@ -75,12 +77,13 @@ class ObjectInheritAction extends ObjectAction implements Method { // Vererbbare ACLs des aktuellen Ordners anwenden. foreach( $newAclList as $newAcl ) { + $newAcl->aclid = null; $newAcl->objectid = $oid; $newAcl->persist(); Logger::debug('adding new acl '.$newAcl->aclid.' for object '.$oid); } } - $this->addNoticeFor($folder,Messages::SAVED); + $this->addNoticeFor($baseObject,Messages::SAVED); } }