root/plugins/access/models/action.php
| 236 | 237 | ||
|---|---|---|---|
35 | if ($rebuild) { | 35 | if ($rebuild) { |
36 | $this->deleteAll('1 = 1'); | 36 | $this->deleteAll('1 = 1'); |
37 | } | 37 | } |
38 | |||
39 | // Clears cache for action_list if present | ||
40 | Cache::delete('action_list_cached'); | ||
41 | |||
38 | // Get all controllers, even in plugins | 42 | // Get all controllers, even in plugins |
39 | $Controllers = Configure::listObjects('controller'); | 43 | $Controllers = Configure::listObjects('controller'); |
40 | $Plugins = Configure::listObjects('plugin'); | 44 | $Plugins = Configure::listObjects('plugin'); |
... | ... | ||
110 | // Get all actions | 114 | // Get all actions |
111 | // Exclude basic, private and protected | 115 | // Exclude basic, private and protected |
112 | } | 116 | } |
113 | | 117 | |
118 | /** | ||
119 | * Tries to determine the scope of an action based on its name | ||
120 | * | ||
121 | * @param string $action | ||
122 | * @return void | ||
123 | * @author Frankie | ||
124 | */ | ||
114 | protected function guessScope($action) { | 125 | protected function guessScope($action) { |
115 | $mapping = array( | 126 | $mapping = array( |
116 | '/.*(add|create)/' => 'create', | 127 | '/.*(add|create)/' => 'create', |
... | ... | ||
128 | return 'edit'; | 139 | return 'edit'; |
129 | } | 140 | } |
130 | 141 | ||
142 | /** | ||
143 | * Saves the data of an action | ||
144 | * | ||
145 | * @param string $action | ||
146 | * @return void | ||
147 | * @author Frankie | ||
148 | */ | ||
131 | protected function updateAction($action) { | 149 | protected function updateAction($action) { |
132 | $conditions = array( | 150 | $conditions = array( |
133 | 'action' => $action['action'], | 151 | 'action' => $action['action'], |
... | ... | ||
182 | } | 200 | } |
183 | 201 | ||
184 | // This allows to detect prefixed actions to create wildcard rules | 202 | // This allows to detect prefixed actions to create wildcard rules |
185 | | ||
186 | $a = substr($action, strrpos($action, '/')+1, strlen($action)); | 203 | $a = substr($action, strrpos($action, '/')+1, strlen($action)); |
187 | 204 | ||
188 | if (strpos($a, '_') !== false) { | 205 | if (strpos($a, '_') !== false) { |
... | ... | ||
193 | } | 210 | } |
194 | 211 | ||
195 | $list[$group][$action] = $action; | 212 | $list[$group][$action] = $action; |
196 | | ||
197 | $lastController = $controller; | 213 | $lastController = $controller; |
198 | // $lastPrefix = $prefix; | ||
199 | } | 214 | } |
200 | Cache::write('action_list_cached', $list); | 215 | Cache::write('action_list_cached', $list); |
201 | return $list; | 216 | return $list; |
Download diff