Permalink
Browse files

Adding the example AppPermissionsTask that I forgot before.

  • Loading branch information...
jamiemill committed Mar 28, 2010
1 parent 062030e commit 0f2b9fbab04891d1bf24a1c0fbd90f426a6656b9
Showing with 40 additions and 0 deletions.
  1. +40 −0 vendors/shells/tasks/app_permissions.php
@@ -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

Please sign in to comment.