PHP Classes

add role and resource

Recommend this page to a friend!

      MyACL  >  All threads  >  add role and resource  >  (Un) Subscribe thread alerts  
Subject:add role and resource
Summary:add role and resource in to databse
Messages:4
Author:Ivo Trompert
Date:2007-09-20 06:49:38
Update:2009-04-07 11:43:33
 

  1. add role and resource   Reply   Report abuse  
Picture of Ivo Trompert Ivo Trompert - 2007-09-20 06:49:39
I have a question about your MyACL class. How can I add a new role and resource and then a sub resource? For example if I have a user testuser and the role is users and the user have access to the module news action view. But don't have access to news edit or add. How can I ad this to the database?

  2. Re: add role and resource   Reply   Report abuse  
Picture of Michael Ziegler Michael Ziegler - 2007-09-20 20:04:08 - In reply to message 1 from Ivo Trompert
Hi,

that's what you use the privileges for. Are you familiar with the way Zend Framework works? It is described in detail here: http://framework.zend.com/manual/en/zend.acl.html

The bottom line is:
Your news module/script/whatever needs to check the privileges View, Add and Edit, depending on what the user is trying to do. If you want someone to only be able to view, you'd need to insert the following data into the access table:
Role: $username
Resource: News
Privilege: View
Allow: True

For some other user to be able to do everything:
Role: $someOtherUser
Resource: News
Privilege: NULL
Allow: True

That should work fine :)

Hth,
Michael

  3. Re: add role and resource   Reply   Report abuse  
Picture of Piloponth Piloponth - 2008-12-12 22:33:16 - In reply to message 2 from Michael Ziegler
Even more detiled informations about Zend_Acl a also role inheritance, can be found in this great screencast

roetgers.org/screencast-index/zend_ ...

Must see video.

  4. Re: add role and resource   Reply   Report abuse  
Picture of Zephyr11 Zephyr11 - 2009-04-07 11:43:33 - In reply to message 3 from Piloponth
Thanks for this link !!!