GithubHelp home page GithubHelp logo

php-rbac's Introduction

php-rbac

Installation:

{
    "require": {
        "createloop/php-rbac": "1.1.*@dev"
    }
}

Defautl Usage:

  1. 把DB資料夾裡的sql 部屬在database (預設載體為Mysql,以PDO實現,要用不同儲存方式請看 Custom Usage
  2. 調整Storage/config.php 裡面的連線參數設定 或是 new MysqlStorage 帶入連線必要參數

Custom Usage:

  1. 可選擇自行實現儲存載體,只要繼承RBAC\Interfaces\IStroage ,實作裡面的方法即可。

Usage:

驗證:

$rbac = new Rbac("user_id",new ProxyFactory(IStorage storage), IStorage storage);
$rbac->auth("controller/action/resource","get"); //return true or false

建構新 resource:

$admin = new admin(new ProxyFactory(IStorage $storage), IStorage $storage);
$resource = $admin->createResource($name, $resource);

建構新 Role:

$admin = new admin(new ProxyFactory(IStorage $storage), IStorage $storage);
$role = $resource = $admin->createRole($name);

賦予Role Resource:

$role->addResource($resource);

License

Composer is licensed under the MIT License - see the LICENSE file for details

php-rbac's People

Contributors

syhlion avatar

Watchers

James Cloos avatar  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.