kelunik/access-control

Role based access control.

dev-master 2016-04-24 16:55 UTC

This package is auto-updated.

Last update: 2024-05-15 06:27:49 UTC


README

Build Status CoverageStatus License

kelunik/access-control is a role based access control system.

Requirements

  • PHP 7.0+

Installation

composer require kelunik/access-control

Usage

$guest = new SimpleRole("guest", ["read"]);
$member = new CombinedRole("member", [$guest], ["read.internal"]);
$student = new CombinedRole("student", [$guest, $member], ["write.internal"]);
$staff = new CombinedRole("staff", [$guest, $member], ["write"]);

$accessControl = new AccessControl([
    $guest, $member, $student, $staff
]);

$isAllowed = $accessControl->isGranted(["member", "staff"], "write");