Download the PHP package lanlin/god without Composer
On this page you can find all versions of the php package lanlin/god. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package god
Short Description An authority proving system that supports ACL, RBAC, ABAC
License MIT
Homepage https://github.com/lanlin/god
Informations about the package god
God Permission System
"God said, Let there be light, and there was light."
"God will decide if you have permission."
"God bless you!"
Install
The Origin
God is written after referring to the Casbin(golang) project, thanks for their hard work.
For more detail, please refer to the documentation of Casbin.
Supported models
- ACL (Access Control List)
- ACL with superuser
- ACL without users: especially useful for systems that don't have authentication or user log-ins.
- ACL without resources: some scenarios may target for a type of resources instead of an individual resource by using permissions like
write-article
,read-log
. It doesn't control the access to a specific article or log. - RBAC (Role-Based Access Control)
- RBAC with resource roles: both users and resources can have roles (or groups) at the same time.
- RBAC with domains/tenants: users can have different role sets for different domains/tenants.
- ABAC (Attribute-Based Access Control): syntax sugar like
resource.Owner
can be used to get the attribute for a resource. - RESTful: supports paths like
/res/*
,/res/:id
and HTTP methods likeGET
,POST
,PUT
,DELETE
. - Deny-override: both allow and deny authorizations are supported, deny overrides the allow.
- Priority: the policy rules can be prioritized like firewall rules.
Supported Adapters
- file adapter
- MongoDB adapter
- PHP PDO adapters (now support: MySQL, PostgreSQL, SQLite, SqlServer.)
How it works?
does "Who" as "Role" or "Group" from "Where" do "Operator" to "What" will got "How"?
Identifier | Description |
---|---|
r | Request (r = sub, obj, act) |
p | Policy (p = sub, obj, act, eft) |
g | Group or Role (g = , ) |
e | Policy Efftect (e = some(where (p.eft == allow))) |
m | Matchers (m = r.obj == p.obj) |
sub | Subject (Who) |
dom | Domain (Where) |
obj | Object (What) |
act | Action (Operator) |
eft | Efftect (How) (allow, deny, indeterminate) |
An access control model is abstracted into a CONF file based on the PERM metamodel (Policy, Effect, Request, Matchers).
So switching or upgrading the authorization mechanism for a project is just as simple as modifying a configuration.
You can customize your own access control model by combining the available models.
For example, you can get RBAC roles and ABAC attributes together inside one model and share one set of policy rules.
The most basic and simplest model in God is ACL. ACL's model CONF is:
An example policy for ACL model is like:
It means:
- alice can read data1
- bob can write data2
Demo
For more usage demos, please view the unit tests or
License
This project is licensed under the MIT license.