Skip to content

Commit

Permalink
Merge pull request ZF-Commons#256 from ZF-Commons/move-permission-int…
Browse files Browse the repository at this point in the history
…erface

[3.0] Move permission interface
  • Loading branch information
bakura10 committed Jul 11, 2014
2 parents ec3c8e7 + 0b3bf9a commit 651176f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/ZfcRbac/Guard/ControllerPermissionsGuard.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function setRules(array $rules)

foreach ($rules as $rule) {
$controller = strtolower($rule['controller']);
$actions = isset($rule['actions']) ? (array)$rule['actions'] : [];
$permissions = (array)$rule['permissions'];
$actions = isset($rule['actions']) ? (array) $rule['actions'] : [];
$permissions = (array) $rule['permissions'];

if (empty($actions)) {
$this->rules[$controller][0] = $permissions;
Expand Down
16 changes: 10 additions & 6 deletions src/ZfcRbac/Permission/PermissionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@

namespace ZfcRbac\Permission;

use Rbac\Permission\PermissionInterface as BasePermissionInterface;

/**
* Interface that permissions must implement to be used with the AuthorizationService
*
* Please note that currently the interface extends the one from RBAC, but starting in ZF3, the
* permission will be removed from RBAC component and moved here completely
*
* @author Michaël Gallego <[email protected]>
* @licence MIT
*/
interface PermissionInterface extends BasePermissionInterface
interface PermissionInterface
{
/**
* Get the permission name
*
* You really must return the name of the permission as internally, the casting to string is used
* as an optimization to avoid type checkings
*
* @return string
*/
public function __toString();
}
2 changes: 1 addition & 1 deletion src/ZfcRbac/Service/AuthorizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
namespace ZfcRbac\Service;

use Rbac\Rbac;
use Rbac\Permission\PermissionInterface;
use ZfcRbac\Assertion\AssertionPluginManager;
use ZfcRbac\Assertion\AssertionInterface;
use ZfcRbac\Exception;
use ZfcRbac\Identity\IdentityInterface;
use ZfcRbac\Permission\PermissionInterface;

/**
* Authorization service is a simple service that internally uses Rbac to check if identity is
Expand Down
2 changes: 1 addition & 1 deletion src/ZfcRbac/Service/AuthorizationServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace ZfcRbac\Service;

use Rbac\Permission\PermissionInterface;
use ZfcRbac\Permission\PermissionInterface;

/**
* Minimal interface for an authorization service
Expand Down
2 changes: 1 addition & 1 deletion tests/ZfcRbacTest/Asset/FlatRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Rbac\Permission\PermissionInterface;
use Rbac\Role\Role;
use ZfcRbac\Permission\PermissionInterface;

/**
* @ORM\Entity
Expand Down
2 changes: 1 addition & 1 deletion tests/ZfcRbacTest/Asset/HierarchicalRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Rbac\Permission\PermissionInterface;
use Rbac\Role\HierarchicalRole as BaseHierarchicalRole;
use ZfcRbac\Permission\PermissionInterface;

/**
* @ORM\Entity
Expand Down
2 changes: 1 addition & 1 deletion tests/ZfcRbacTest/Asset/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Rbac\Permission\PermissionInterface;
use ZfcRbac\Permission\PermissionInterface;

/**
* @ORM\Entity
Expand Down

0 comments on commit 651176f

Please sign in to comment.