From 53a01b7a5cf9d0c5be0e7394a299850ad2333b54 Mon Sep 17 00:00:00 2001 From: gwoo Date: Sat, 25 Aug 2007 18:26:21 +0000 Subject: [PATCH] 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 --- cake/libs/controller/components/auth.php | 21 +++++++++++---------- cake/libs/controller/scaffold.php | 9 +++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index 2782038e6..02bd99d31 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -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) { diff --git a/cake/libs/controller/scaffold.php b/cake/libs/controller/scaffold.php index f8a6f76d6..5d22a3004 100644 --- a/cake/libs/controller/scaffold.php +++ b/cake/libs/controller/scaffold.php @@ -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':