I have an idea for how to implement access control lists in projects
that use the Public HTML plug-in. It is inspired by ACLs in the Zend
Framework, but I think should be simpler and less confusing.
We need to have lists of resources and roles defined for each project.
Roles should be able to 'inheritit' the resources of other roles. The
data might be defined in an XML configuration file for each project.
For example, let's consider a CMS. Our roles might be 'guest',
'author', 'moderator', 'editor' and 'admin'. Our resources might be
'public_pages', 'write_article', 'review_comments',
'edit_own_articles', 'edit_all_articles' and 'modify_users'. Our XML
file might look like this.
<?xml version="1.0" encoding='UTF-8'?>
<roles>
<role>
<role name="guest"><resources><resource>public_pages</resource></role>
<role name="author"
inherits="guest"><resources><resource>write_article</resource></role>
<role name="moderator"
inherits="author"><resources><resource>review_comments</resource></
role>
<role name="editor"
inherits="moderator"><resources><resource>edit_own_articles</
resource></role>
<role name="admin"
inherits="editor"><resources><resource>modify_users</resource></role>
</roles>
In PublicHTML_HaddockHTTPResponse, we could defined a method call
'is_accessible()' which simply returns 'true'. index.php in the Public
HTML plug-in should call this function in an 'if' statement before
running the HTTP response object that has been requested.
OurProject_HTMLPage (the class that all HTML page classes extend)
should implement an interface called
AccessControlLists_ACLHTTPResponse which will require a method called
'get_acl_resource_name()'. OurProject_HTMLPage::is_accessible() might
be overridden as follows:
public function is_accessible()
{
return
AccessControlLists_AccessControlHelper::http_response_is_accessible($this-
>get_acl_resource_name());
}
Any comments or suggestions would be gratefully apreciated.
--
You received this message because you are subscribed to the Google Groups "Haddock CMS" group.
To post to this group, send email to
haddo...@googlegroups.com.
To unsubscribe from this group, send email to
haddock-cms...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/haddock-cms?hl=en.