Permalink
Please sign in to comment.
Browse files
Adding the example AppPermissionsTask that I forgot before.
- Loading branch information...
Showing
with
40 additions
and 0 deletions.
@@ -0,0 +1,40 @@ | ||
+<?php | ||
+ | ||
+class AppPermissionsTask extends Shell { | ||
+ | ||
+ /** | ||
+ * Will hold a reference to the Aro model | ||
+ */ | ||
+ | ||
+ var $Aro; | ||
+ | ||
+ /** | ||
+ * Will hold a reference to the Acl component | ||
+ */ | ||
+ | ||
+ var $Acl; | ||
+ | ||
+ /** | ||
+ * This method should be filled with stuff like this: | ||
+ * $this->Acl->deny(array('model'=>'Group','foreign_key'=>3),'controllers/Accounts'); | ||
+ * $this->Acl->allow(array('model'=>'Group','foreign_key'=>3),'controllers/Accounts/edit'); | ||
+ * | ||
+ * You can also give some feedback to the screen with: | ||
+ * $this->out(__('Working hard...', true)); | ||
+ * | ||
+ */ | ||
+ | ||
+ function execute() { | ||
+ | ||
+ | ||
+ } | ||
+ | ||
+ function allow($item, $path) { | ||
+ if($this->Acl->allow($item, $path)) { | ||
+ $this->out('Allowed '.$item['model'].' '.$item['foreign_key'].' to '.$path."\n"); | ||
+ } else { | ||
+ $this->out('ERROR: Allowing '.$item['model'].' '.$item['foreign_key'].' to '.$path."\n"); | ||
+ } | ||
+ } | ||
+} | ||
+?> |
0 comments on commit
0f2b9fb