Skip to content
Permalink
Browse files

Removed arbitrary restriction on crud operations. Added some comments…

… to explain parameters to mapActions() better.
  • Loading branch information...
sam-at-github committed Mar 28, 2014
1 parent 6bf21c4 commit 5ceb4abe1a42c15df08bea74d9d2f8756ef8fcdb
Showing with 11 additions and 5 deletions.
  1. +11 −5 lib/Cake/Controller/Component/Auth/BaseAuthorize.php
@@ -130,16 +130,23 @@ public function action(CakeRequest $request, $path = '/:plugin/:controller/:acti
* $this->Auth->mapActions(array('create' => array('add', 'register'));
* }}}
*
* Or equivalently:
*
* {{{
* $this->Auth->mapActions(array('register' => 'create', 'add' => 'create'));
* }}}
*
* Create mappings for custom CRUD operations:
*
* {{{
* $this->Auth->mapActions(array('my_action' => 'admin'));
* $this->Auth->mapActions(array('range' => 'search'));
* }}}
*
* You can use the custom CRUD operations to create additional generic permissions
* that behave like CRUD operations. Doing this will require additional columns on the
* permissions lookup. When using with DbAcl, you'll have to add additional _admin type columns
* to the `aros_acos` table.
* permissions lookup. For example if one wanted an additional search CRUD operation
* one would create and additional column '_search' in the aros_acos table. One could
* create a custom admin CRUD operation for administration functions similarly if needed.
*
* @param array $map Either an array of mappings, or undefined to get current values.
* @return mixed Either the current mappings or null when setting.
@@ -149,9 +156,8 @@ public function mapActions($map = array()) {
if (empty($map)) {
return $this->settings['actionMap'];
}
$crud = array('create', 'read', 'update', 'delete');
foreach ($map as $action => $type) {
if (in_array($action, $crud) && is_array($type)) {
if (is_array($type)) {
foreach ($type as $typedAction) {
$this->settings['actionMap'][$typedAction] = $action;
}

0 comments on commit 5ceb4ab

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.