Skip to content
This repository
Browse code

example

  • Loading branch information...
commit 51d6c7dc82cd698ba719f35c15289bacc84f7bcb 1 parent 45ffff1
Bas Kamer authored

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. 12  README.md
12  README.md
Source Rendered
@@ -164,6 +164,18 @@ In either a controller or a view script, you can call
164 164
 ```$this->isAllowed($resource[, $privilege])```, which will query the ACL
165 165
 using the currently authenticated (or default) user's roles.
166 166
 
  167
+Whenever you need to stop processing your action you can throw an UnAuthorizedException and users will see you message on a 403 page.
  168
+
  169
+```
  170
+function cafeAction() {
  171
+    if (!$this->isAllowed('alcohol', 'consume')) {
  172
+        throw new UnAuthorizedException("Grow a beard first!");
  173
+    }
  174
+
  175
+    // party on ...
  176
+}
  177
+```
  178
+
167 179
 License
168 180
 -------
169 181
 Released under the MIT License.  See file LICENSE included with the source

0 notes on commit 51d6c7d

Please sign in to comment.
Something went wrong with that request. Please try again.