CodeIgniter Forums

Full Version: Permission Handling Library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all! Hopefully you've seen my other libraries thread, so you know the routine. This one is a little different, in that the original library was a dual authentication/authorization library but both of these realms have changed so drastically since CI3 neither would work well as a direct "port". There are also other libraries in the works to be robust and comprehensive solutions (see for example @kilishan's Myth:Auth) so I haven't been sure if I will rework the original library at all.
That said, one of my favorite aspects of the original library was object permissions - think Unix "chmod" permissions for your models & instances. This library couples traditional named permissions with a CI4 take on object permissions. So, I give you:

Tatter/Permits - out-of-the-box permission handling for CodeIgniter 4

Basic usage:

1. Install with Composer: `> composer require tatter/permits`
2. Update the database: `> php spark migrate:latest -all`
3. Extend your models: `class JobModel extends Tatter\Permits\Models\PModel;`
4. Ready to use! `if ($jobs->mayCreate()) ...`
5. (Optional) Add overrides: `> php spark permits:add` or `> php spark permits:add deleteJobs groups 7`


This library is much more involved than the previous libraries, and has more room to grow. I am eager for feedback, suggestions, and contributions - feel free to respond here or on GitHub (https://github.com/tattersoftware/codeigniter4-permits).
Thanks for reading!