Archived
1
0
Fork 0

Started with some acl

This commit is contained in:
Fredric N 2010-10-02 00:06:44 +02:00
parent 770a4055a0
commit 5d3a29e681

53
library/Fiktiv/Acl.php Normal file
View file

@ -0,0 +1,53 @@
<?php
class Fiktiv_Acl extends Zend_Acl
{
public function __construct()
{
// Add roles
$this->loadRoles();
// Add resources
$this->loadResources();
// Set accessrights
$this->loadAccess();
}
protected function loadRoles()
{
// "Public" roles
$this->addRole(new Zend_Acl_Role('visitor'));
$this->addRole(new Zend_Acl_Role('member'), 'visitor');
// Blog roles
$this->addRole(new Zend_Acl_Role('blogWriter'), 'member');
$this->addRole(new Zend_Acl_Role('blogManager'), 'blogWriter');
// "Projects" roles (for future use)
$this->addRole(new Zend_Acl_Role('projectUser'), 'member');
$this->addRole(new Zend_Acl_Role('projectManager'), 'projectUser');
// ...
$this->addRole(new Zend_Acl_Role('team'), array('blogManager', 'projectManager'));
}
protected function loadResources()
{
$this->add(new Zend_Acl_Resource('blog'));
}
protected function loadAccess()
{
// Blog
$this->allow('visitor', 'blog', 'readBlog');
$this->allow('visitor', 'blog', 'readComment');
$this->allow('blogWriter', 'blog', 'writeBlog');
$this->allow('member', 'blog', 'writeComment');
}
}