Download the PHP package spareparts/overseer without Composer
On this page you can find all versions of the php package spareparts/overseer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download spareparts/overseer
More information about spareparts/overseer
Files in spareparts/overseer
Package overseer
Short Description Attribute-based authorization manager.
License MIT
Informations about the package overseer
Overseer
Action-based authorization manager
Quick disclaimer: This is pretty much a work in progress. At this point this is more of a "proof-of-concept" than working code. Though the logic is sound and I fully intend to finish this into an awesome 1.0 release.
What is this and why should I care?
Overseer is an "action-based" auth manager, meaning it is based on authorizing possible "actions" (such as read, edit, delete, etc.) with given "subject" (such as Article, Product, Category etc.).
Overseer focuses on decoupling auth logic from the rest of the application. When solving problems as "user that is the owner of this product can edit it" other auth managers tend to wire the logic directly into the said product class or pile all possible actions (read, write, delete, ...) into one big method. Either way it breaks S of the SOLID principles (single responsibility principle) and that's where Overseer jumps in.
Basic building stones of Overseer are "voting assemblies", consisting of "voters". Each combination of action and subject can have (doesn't have to, though) its own voting assembly, thus separating concerns and responsibilities involved.
Installation
Composer
This is how we do it, boys.
Basic usage
Let's imagine we have an article site, and we want to make sure the admin can read the article always, while its author only unless it's not banned.
This is how we create the voting assembly for this specific subject and action. It contains four voters, `
Now let's use it