Permalink
Browse files

More permission examples. Closes #15

  • Loading branch information...
1 parent 63bc509 commit ab420764f11b4f3e291f4c58822a476d17aa7ee6 @josegonzalez committed Apr 9, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 README.markdown
View
@@ -264,6 +264,26 @@ In order to specify the rules such that an admin user can edit posts, the rules
array('redirect' => array('controller' => 'users', 'action' => 'account')
);
+#### Example Rules
+
+Allowing anonymous access:
+
+ Permit::access(
+ array('controller' => array('posts'), 'action' => array('index')),
+ array(),
+ array()
+ );
+
+Allowing access to multiple roles:
+
+ Permit::access(
+ array('controller' => array('posts'), 'action' => array('add', 'delete')),
+ array('auth' => array('User.role' => array('user', 'admin'))),
+ array('redirect' => array('controller' => 'posts', 'action' => 'index'),
+ 'message' => 'You are not authorized to perform the requested action.'
+ )
+ );
+
## Todo
* More Unit Tests

0 comments on commit ab42076

Please sign in to comment.