|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (1)
View Page History{code}
h3. Setting up roles and permissions
{code:php|title=Roles|borderStyle=solid}
<?php
// Creating roles manually
$foo = new \Zend\Permission\Rbac\Role('foo');
$bar = new \Zend\Permission\Rbac\Role('bar');
// Adding a child
$foo->addChild($bar);
$foo->addChild('baz'); // If a string is given creates default Role with name 'baz'
// Using Rbac container
$rbac = new \Zend\Permission\Rbac\Rbac;
$rbac->addRole($foo);
$rbac->addRole('baz');
$rbac->addRole($bar, array($foo)); // Add role bar with parents $foo, can also just give it a single object instead of array
// Adding permissions
$foo->addPermission('test');
var_dump($foo->hasPermission('test')); // true
$rbac->getRole('foo')->addPermission('barperm');
// Using Rbac
{code}
{code:php|title=Roles|borderStyle=solid}
<?php
// Creating roles manually
$foo = new \Zend\Permission\Rbac\Role('foo');
$bar = new \Zend\Permission\Rbac\Role('bar');
// Adding a child
$foo->addChild($bar);
$foo->addChild('baz'); // If a string is given creates default Role with name 'baz'
// Using Rbac container
$rbac = new \Zend\Permission\Rbac\Rbac;
$rbac->addRole($foo);
$rbac->addRole('baz');
$rbac->addRole($bar, array($foo)); // Add role bar with parents $foo, can also just give it a single object instead of array
// Adding permissions
$foo->addPermission('test');
var_dump($foo->hasPermission('test')); // true
$rbac->getRole('foo')->addPermission('barperm');
// Using Rbac
{code}
h3. Dynamic assertions