updating auth and scaffold for Routing.admin

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5583 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-08-25 18:26:21 +00:00
parent 85dca42d93
commit 53a01b7a5c
2 changed files with 16 additions and 14 deletions

View file

@ -230,17 +230,18 @@ class AuthComponent extends Object {
$crud = array('create', 'read', 'update', 'delete');
$this->actionMap = am($this->actionMap, array_combine($crud, $crud));
if (defined('CAKE_ADMIN')) {
$admin = Configure::read('Routing.admin');
if (!empty($admin)) {
$this->actionMap = am($this->actionMap, array(
CAKE_ADMIN . '_index' => 'read',
CAKE_ADMIN . '_add' => 'create',
CAKE_ADMIN . '_edit' => 'update',
CAKE_ADMIN . '_view' => 'read',
CAKE_ADMIN . '_remove' => 'delete',
CAKE_ADMIN . '_create' => 'create',
CAKE_ADMIN . '_read' => 'read',
CAKE_ADMIN . '_update' => 'update',
CAKE_ADMIN . '_delete' => 'delete'
$admin . '_index' => 'read',
$admin . '_add' => 'create',
$admin . '_edit' => 'update',
$admin . '_view' => 'read',
$admin . '_remove' => 'delete',
$admin . '_create' => 'create',
$admin . '_read' => 'read',
$admin . '_update' => 'update',
$admin . '_delete' => 'delete'
));
}
if (Configure::read() > 0) {

View file

@ -391,16 +391,17 @@ class Scaffold extends Object {
function __scaffold($params) {
$db = &ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);
$admin = Configure::read('Routing.admin');
if (isset($db)) {
if (empty($this->scaffoldActions)) {
$this->scaffoldActions = array('index', 'list', 'view', 'add', 'create', 'edit', 'update', 'delete');
} elseif (defined('CAKE_ADMIN') && $this->scaffoldActions == CAKE_ADMIN) {
$this->scaffoldActions = array(CAKE_ADMIN .'_index', CAKE_ADMIN .'_list', CAKE_ADMIN .'_view', CAKE_ADMIN .'_add', CAKE_ADMIN .'_create', CAKE_ADMIN .'_edit', CAKE_ADMIN .'_update', CAKE_ADMIN .'_delete');
} elseif (!empty($admin) && $this->scaffoldActions === $admin) {
$this->scaffoldActions = array($admin .'_index', $admin .'_list', $admin .'_view', $admin .'_add', $admin .'_create', $admin .'_edit', $admin .'_update', $admin .'_delete');
}
if (in_array($params['action'], $this->scaffoldActions)) {
if (defined('CAKE_ADMIN')) {
$params['action'] = str_replace(CAKE_ADMIN . '_', '', $params['action']);
if (!empty($admin)) {
$params['action'] = str_replace($admin . '_', '', $params['action']);
}
switch($params['action']) {
case 'index':