Giter Site home page Giter Site logo

guardian's Introduction

guardian

CREY Framework Access Control List Component

description

Guardian is the Resource based Access Control List implementation of CREY, a PHP 7 component-based Framework.

Metrics of master branch

Package Metrics

Usage

This brief introduction demonstrates how to use Guardian:

Role definition
$blog = new \Crey\Guardian\Resource('blog', 'read', 'subscribe');
$article = new \Crey\Guardian\Resource('article', 'read', 'comment', 'delete', 'add', 'edit');
$comment = new \Crey\Guardian\Resource('comment', 'read', 'delete', 'edit');

$guest = new \Crey\Guardian\Role('guest');

$blog->grant($guest, 'read');
$article->grant($guest, 'read', 'comment');
$comment->grant($guest, 'read');

$admin = new \Crey\Guardian\Role('admin');
$admin->inherit($guest);

$article->grant($admin, 'delete', 'add', 'edit');
$comment->grant($admin, 'delete', 'edit');
Check for roles on roles
if ( $admin->hasAccessTo($article) ) {
    // on general access
}

if ( $admin->hasAccessTo($article, 'read', 'add', 'delete') ) {
    // on access for specific actions
}
Check for roles on a resource
if ( $article->allows($admin) ) {
    // on general access
}

if ( $article->allows($admin, 'read', 'add', 'delete') ) {
    // on access for specific actions
}

Maintainer and state of this package

The inventor and maintainer of this package is Matthias Kaschubowski. This package is currently in alpha mode.

Meaning of staging modes

  • Alpha - No out-sourced documentation, no or incomplete tests
  • Beta - out-sourced documentation, near to complete tests, CI
  • Universe - production and development ready state with CI

Composer integration

This package will be available at packagist in beta mode. Until then you have to manually link this package repository as a data resource to your dependencies.

guardian's People

Contributors

nhlm avatar

Stargazers

Samuel Adeshina avatar

Watchers

James Cloos avatar Samuel Adeshina avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.