Introduction To Bare_Acl <ul>Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. http://projects.binaryv...
What Is Bare? <ul><li>Bare bones framework written by Bangaloreans
Written to fill the gap created by libraries and frameworks
Keeping simplicity in mind
Currently has one component - Bare_Acl </li></ul>
What Is Acl? <ul><li>Access Control List
Who gets what?
RBAC – Role Based Access Control </li></ul>
Downloading Bare_Acl <ul>http://binaryvibes.co.in/downloads/ <li>Tar and Zip archives available </li></ul>
Using Bare_Acl <ul><li>Manually using require_once
Autoloading – plays well with Zend Framework and other popular PHP auto loaders
Roll your own autoloader </li></ul>
Acl Example - Privileges <ul><li>Create articles
Publish articles
Edit articles
Delete articles </li></ul>
Upcoming SlideShare
Loading in …5
×

Bare acl

3,346 views
3,262 views

Published on

Introduction to Bare_Acl

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,346
On SlideShare
0
From Embeds
0
Number of Embeds
9
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Bare acl

  1. 1. Introduction To Bare_Acl <ul>Sudheer Satyanarayana Binary Vibes Information Technologies Pvt. Ltd. http://projects.binaryvibes.co.in/projects/show/bare http://binaryvibes.co.in http://techchorus.net </ul>
  2. 2. What Is Bare? <ul><li>Bare bones framework written by Bangaloreans
  3. 3. Written to fill the gap created by libraries and frameworks
  4. 4. Keeping simplicity in mind
  5. 5. Currently has one component - Bare_Acl </li></ul>
  6. 6. What Is Acl? <ul><li>Access Control List
  7. 7. Who gets what?
  8. 8. RBAC – Role Based Access Control </li></ul>
  9. 9. Downloading Bare_Acl <ul>http://binaryvibes.co.in/downloads/ <li>Tar and Zip archives available </li></ul>
  10. 10. Using Bare_Acl <ul><li>Manually using require_once
  11. 11. Autoloading – plays well with Zend Framework and other popular PHP auto loaders
  12. 12. Roll your own autoloader </li></ul>
  13. 13. Acl Example - Privileges <ul><li>Create articles
  14. 14. Publish articles
  15. 15. Edit articles
  16. 16. Delete articles </li></ul>
  17. 17. Acl Example - Roles <ul><li>editor
  18. 18. reporter </li></ul>
  19. 19. Acl Example - Rules <ul><li>Reporter can create and publish articles
  20. 20. Editor can create, publish, edit and delete articles </li></ul>
  21. 21. Acl Example – Building Acl $acl = new Bare_Acl; $acl->addPrivilege('create articles'); $acl->addPrivilege('publish articles'); $acl->addPrivilege('edit articles'); $acl->addPrivilege('delete articles'); $acl->addRole('reporter'); $acl->addRole('editor');
  22. 22. Acl Example – Building Acl $acl->allow('reporter', 'create articles'); $acl->allow('reporter', 'publish articles'); $acl->allow('editor', 'create articles'); $acl->allow('editor', 'publish articles'); $acl->allow('editor', 'edit articles'); $acl->allow('editor', 'delete articles');
  23. 23. Acl Example – Querying Acl if ($acl->isAllowed(array('reporter'), 'create articles')) { echo PHP_EOL . &quot; Reporter is allowed to create articles&quot;; } if ($acl->isAllowed(array('reporter'), 'edit articles')) { echo PHP_EOL . &quot; Reporter is allowed to edit articles&quot;; } else { echo PHP_EOL . &quot; Reporter is NOT allowed to edit articles&quot;; } Reporter is allowed to create articles Reporter is NOT allowed to edit articles
  24. 24. Acl Assertions <ul><li>Assert = affirm, declare with assurance
  25. 25. New Rules
  26. 26. Edit own articles
  27. 27. Edit all articles </li></ul>
  28. 28. Acl Assertions – Creating The Assertion Object class ownArticleAssertion implements Bare_Acl_AssertInterface { public function assert(Bare_Acl $acl) { //Write code here to test if the user has access to edit this article return true; } }
  29. 29. Acl Assertions – Querying The Acl $assertion = new ownArticleAssertion; if ($acl->isAllowed('reporter', null, $assertion)) { echo PHP_EOL . &quot;Reporter has access to edit the article&quot;; } else { echo PHP_EOL . &quot;Reporter does NOT have access to edit the article&quot;; }
  30. 30. Contributions Are Welcome <ul><li>Liberal new BSD license
  31. 31. CLA required
  32. 32. Other components are welcome </li></ul>
  33. 33. Thank You This work is licensed under the Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/2.5/in/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

×