Skip to content

Commit

Permalink
feat: improved authorizer
Browse files Browse the repository at this point in the history
  • Loading branch information
mnavarrocarter committed Sep 22, 2023
1 parent 903085a commit 012c2ac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
* file that was distributed with this source code.
*/

namespace Castor\Security\Policy;
namespace Castor\Security;

#[\Attribute(\Attribute::TARGET_FUNCTION | \Attribute::TARGET_METHOD)]
class Can
class Policy
{
/**
* @param Can[]|string[] $andX
* @param Can[]|string[] $orX
* @param Policy[]|array $andCan
* @param Policy[]|array $orCan
*/
public function __construct(
public array $andX = [],
public array $orX = []
public array $andCan = [],
public array $orCan = []
) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@

namespace Castor\Security\Policy;

use Castor\Security\Policy;

/**
* The policy checker can be implemented by identities that support policy checking.
* The Authorized MUST be implemented by Identities that support policy checking.
*/
interface Checker
interface Authorizer
{
public function checkIt(Can $can): bool;
/**
* @param Policy $policy
* @return bool
*/
public function isAuthorized(Policy $policy): bool;
}

0 comments on commit 012c2ac

Please sign in to comment.