All Projects → php-casbin → database-adapter

php-casbin / database-adapter

Licence: Apache-2.0 license
Database adapter for PHP-Casbin, Casbin is a powerful and efficient open-source access control library.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to database-adapter

Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (+19.05%)
Mutual labels:  permissions, casbin
Laravel Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.
Stars: ✭ 136 (+547.62%)
Mutual labels:  permissions, casbin
Think Authz
An authorization library that supports access control models like ACL, RBAC, ABAC in ThinkPHP 6.0 .
Stars: ✭ 155 (+638.1%)
Mutual labels:  permissions, casbin
flask-authz
Use Casbin in Flask, Casbin is a powerful and efficient open-source access control library.
Stars: ✭ 100 (+376.19%)
Mutual labels:  casbin
permissions-ui
Background location permissions request helper
Stars: ✭ 53 (+152.38%)
Mutual labels:  permissions
permissionUtil
Simple permission helper
Stars: ✭ 64 (+204.76%)
Mutual labels:  permissions
ngx-security
Security directives for your Angular application to show/hide elements based on a user roles / permissions.
Stars: ✭ 18 (-14.29%)
Mutual labels:  permissions
django-cancan
🔓Authorization library for Django
Stars: ✭ 36 (+71.43%)
Mutual labels:  permissions
sqlx-adapter
Asynchronous casbin adapter for mysql, postgres, sqlite based on sqlx-rs
Stars: ✭ 27 (+28.57%)
Mutual labels:  casbin
django-tabular-permissions
Display Django permissions in a HTML table that is translatable and easily customized.
Stars: ✭ 60 (+185.71%)
Mutual labels:  permissions
PyGreSQL
The official PyGreSQL repository
Stars: ✭ 29 (+38.1%)
Mutual labels:  database-adapter
leveldb-jna
Java JNA (not JNI) adapter for LevelDB
Stars: ✭ 21 (+0%)
Mutual labels:  database-adapter
react-redux-permissions
A permissions library for react and redux applications.
Stars: ✭ 44 (+109.52%)
Mutual labels:  permissions
spree admin roles and access
Admin Roles And Access for Spree
Stars: ✭ 45 (+114.29%)
Mutual labels:  permissions
sqlike
Golang Sequel ORM that supports Enum, JSON, Spatial, and many more
Stars: ✭ 18 (-14.29%)
Mutual labels:  casbin
sentry
A lightweight (23KB) wrapper for inline Android permission checks/requests.
Stars: ✭ 22 (+4.76%)
Mutual labels:  permissions
laminas-permissions-acl
Provides a lightweight and flexible access control list (ACL) implementation for privileges management
Stars: ✭ 29 (+38.1%)
Mutual labels:  permissions
casbin-pg-adapter
A go-pg adapter for casbin
Stars: ✭ 23 (+9.52%)
Mutual labels:  casbin
NoPermission
Android library for permissions request (updated 27.11.2017)
Stars: ✭ 106 (+404.76%)
Mutual labels:  permissions
permission control system
This is an SDK which helps you to specify which user group (role) members have access to which actions in controllers.
Stars: ✭ 34 (+61.9%)
Mutual labels:  permissions

Database adapter for php-casbin

Build Status Coverage Status Latest Stable Version Total Downloads License

Database adapter for PHP-Casbin.

The current supported databases are:

type database
mysql MySQL
pgsql PostgreSQL
sqlite SQLite
sqlsrv SqlServer

Installation

Use Composer

composer require casbin/database-adapter

Usage

require_once './vendor/autoload.php';

use Casbin\Enforcer;
use Casbin\Util\Log;
use CasbinAdapter\Database\Adapter as DatabaseAdapter;

$config = [
    'type'     => 'mysql', // mysql,pgsql,sqlite,sqlsrv
    'hostname' => '127.0.0.1',
    'database' => 'test',
    'username' => 'root',
    'password' => 'abc-123',
    'hostport' => '3306',
];

$adapter = DatabaseAdapter::newAdapter($config);

$e = new Enforcer('path/to/model.conf', $adapter);

$sub = "alice"; // the user that wants to access a resource.
$obj = "data1"; // the resource that is going to be accessed.
$act = "read"; // the operation that the user performs on the resource.

if ($e->enforce($sub, $obj, $act) === true) {
    // permit alice to read data1
} else {
    // deny the request, show an error
}

Getting Help

License

This project is licensed under the Apache 2.0 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].