-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Organizations] Fixes: Missing acl checks for editing organizations.
- Loading branch information
Showing
9 changed files
with
378 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
module/Organizations/src/Organizations/Acl/Assertion/WriteAssertion.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* YAWIK | ||
* | ||
* @filesource | ||
* @license MIT | ||
* @copyright 2013 - 2016 Cross Solution <http://cross-solution.de> | ||
*/ | ||
|
||
/** */ | ||
namespace Organizations\Acl\Assertion; | ||
|
||
use Auth\Entity\UserInterface; | ||
use Core\Entity\PermissionsInterface; | ||
use Organizations\Entity\OrganizationInterface; | ||
use Zend\Permissions\Acl\Acl; | ||
use Zend\Permissions\Acl\Assertion\AssertionInterface; | ||
use Zend\Permissions\Acl\Resource\ResourceInterface; | ||
use Zend\Permissions\Acl\Role\RoleInterface; | ||
|
||
/** | ||
* ${CARET} | ||
* | ||
* @author Mathias Gelhausen <[email protected]> | ||
* @todo write test | ||
*/ | ||
class WriteAssertion implements AssertionInterface | ||
{ | ||
public function assert(Acl $acl, RoleInterface $role = null, ResourceInterface $resource = null, $privilege = null) | ||
{ | ||
return 'edit' == $privilege | ||
&& $role instanceOf UserInterface | ||
&& $resource instanceOf OrganizationInterface | ||
&& $resource->getPermissions()->isGranted($role, PermissionsInterface::PERMISSION_CHANGE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.