All Projects → m19c → Acl

m19c / Acl

Licence: mit
a lightweight acl manager for go.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Acl

objection-authorize
isomorphic, "magical" authorization integration with Objection.js 🎉
Stars: ✭ 71 (-15.48%)
Mutual labels:  acl, role, access-control
sequelize-adapter
Sequelize adapter for Casbin
Stars: ✭ 51 (-39.29%)
Mutual labels:  acl, access-control
Casbin4D
An authorization library that supports access control models like ACL, RBAC, ABAC in Delphi
Stars: ✭ 25 (-70.24%)
Mutual labels:  acl, access-control
Casbin Rs
An authorization library that supports access control models like ACL, RBAC, ABAC in Rust.
Stars: ✭ 375 (+346.43%)
Mutual labels:  acl, access-control
casbin-ex
An authorization library that supports access control models like ACL, RBAC, ABAC in Elixir
Stars: ✭ 37 (-55.95%)
Mutual labels:  acl, access-control
speedle-plus
Speedle+ is an open source project for access management. It is based on Speedle open source project and maintained by previous Speedle maintainers.
Stars: ✭ 45 (-46.43%)
Mutual labels:  acl, access-control
Gorm Adapter
Gorm adapter for Casbin
Stars: ✭ 373 (+344.05%)
Mutual labels:  acl, access-control
dart-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Dart/Flutter
Stars: ✭ 30 (-64.29%)
Mutual labels:  acl, access-control
Casbin.net
An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
Stars: ✭ 535 (+536.9%)
Mutual labels:  acl, access-control
Pycasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Python
Stars: ✭ 625 (+644.05%)
Mutual labels:  acl, access-control
Ngx Permissions
Permission and roles based access control for your angular(angular 2,4,5,6,7,9+) applications(AOT, lazy modules compatible
Stars: ✭ 749 (+791.67%)
Mutual labels:  acl, access-control
sqlx-adapter
Asynchronous casbin adapter for mysql, postgres, sqlite based on sqlx-rs
Stars: ✭ 27 (-67.86%)
Mutual labels:  acl, access-control
sqlalchemy-adapter
SQLAlchemy Adapter for PyCasbin
Stars: ✭ 53 (-36.9%)
Mutual labels:  acl, access-control
access-control
Simple, flexible and reliable access control for NodeJS and Typescript. Supports both RBAC and ABAC.
Stars: ✭ 29 (-65.48%)
Mutual labels:  acl, role
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (-66.67%)
Mutual labels:  acl, access-control
Role core
🔐A Rails engine providing essential industry of Role-based access control.
Stars: ✭ 262 (+211.9%)
Mutual labels:  access-control, role
ng2-acl
Role based permissions for Angular v2++
Stars: ✭ 15 (-82.14%)
Mutual labels:  acl, role
lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (-48.81%)
Mutual labels:  acl, access-control
Laravel Acl
This package helps you to associate users with permissions and permission groups with laravel framework
Stars: ✭ 404 (+380.95%)
Mutual labels:  acl, access-control
Php Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in PHP .
Stars: ✭ 865 (+929.76%)
Mutual labels:  acl, access-control

ACL

Codacy Badge Build Status Codacy Badge Documentation

TL;DR;

acl is a lightweight acl manager for go.

Features

  • Design simple & reusable roles to empower your application.
  • Acquire the rights of other roles to build a powerful set of permissions.
  • Resolve possible roles by examine them in an unified way.

Example

type User struct {
    isAdmin bool
}

func main() {
    // first of all: create a new manager instance to register all your roles in one place
    manager := acl.NewManager()

    // now you can use `Ensure` to guarantee that the role with the passed identifier is present
    user := manager.Ensure("user").Grant("profile.edit")
    // use `Grant`, `Revoke` and `AcquireFrom` to extend the right stack
    editor := manager.Ensure("editor").Grant("news.list", "news.create", "news.edit").AcquireFrom(user)

    // you can also use NewRole to create a Role manually
    admin := acl.NewRole("admin").Grant("news.delete").AcquireFrom(editor)
    // note, that you have to register the role by yourself
    manager.Register(admin)

    // to check if a right was granted to a role you can use:
    var hasAccess bool
    hasAccess = admin.Has("some.right")

    // to check if at least one of the expected rights is present:
    hasAccess = admin.HasOneOf("news.list", "news.create")

    // ... and finally, to check that all the expected rights are present, use:
    hasAccess = admin.HasAllOf("news.delete", "news.list")

    // a role can be extended with an examiner to determine whether a role can be added
    // to a `ResultSet`
    admin.SetExaminer(func (payload interface{}) bool {
        user := payload.(User)
        return user.isAdmin
    })

    // to get a result set you can use the managers `Examine` function
    rs := manager.Examine(User{isAdmin: true})

    // a result set contains "Has", "HasOneOf" and "HasAllOf" as described above and...
    // `GetRole` to grab specific roles from the result set
    expectedRole := rs.GetRole("admin")

    // you can also check if a role was added to a result set using:
    if rs.HasRole("admin") {
        // ...
    }
}

Possible enhancements

  • Conditional IsAllowed (combine AND/OR queries into a ConditionGroup).
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].