mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-18 23:49:55 +00:00
Merge pull request #3146 from sam-at-github/baseauthorize-crud
Removed arbitrary restriction on crud operations in BaseAuthorize.
This commit is contained in:
commit
77db212b38
1 changed files with 11 additions and 5 deletions
|
@ -130,16 +130,23 @@ abstract class BaseAuthorize {
|
||||||
* $this->Auth->mapActions(array('create' => array('add', 'register'));
|
* $this->Auth->mapActions(array('create' => array('add', 'register'));
|
||||||
* }}}
|
* }}}
|
||||||
*
|
*
|
||||||
|
* Or equivalently:
|
||||||
|
*
|
||||||
|
* {{{
|
||||||
|
* $this->Auth->mapActions(array('register' => 'create', 'add' => 'create'));
|
||||||
|
* }}}
|
||||||
|
*
|
||||||
* Create mappings for custom CRUD operations:
|
* 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
|
* 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
|
* 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
|
* permissions lookup. For example if one wanted an additional search CRUD operation
|
||||||
* to the `aros_acos` table.
|
* 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.
|
* @param array $map Either an array of mappings, or undefined to get current values.
|
||||||
* @return mixed Either the current mappings or null when setting.
|
* @return mixed Either the current mappings or null when setting.
|
||||||
|
@ -149,9 +156,8 @@ abstract class BaseAuthorize {
|
||||||
if (empty($map)) {
|
if (empty($map)) {
|
||||||
return $this->settings['actionMap'];
|
return $this->settings['actionMap'];
|
||||||
}
|
}
|
||||||
$crud = array('create', 'read', 'update', 'delete');
|
|
||||||
foreach ($map as $action => $type) {
|
foreach ($map as $action => $type) {
|
||||||
if (in_array($action, $crud) && is_array($type)) {
|
if (is_array($type)) {
|
||||||
foreach ($type as $typedAction) {
|
foreach ($type as $typedAction) {
|
||||||
$this->settings['actionMap'][$typedAction] = $action;
|
$this->settings['actionMap'][$typedAction] = $action;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue