From de8ce875f4295e0b3bef20fcca051401f96816ef Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 15 May 2016 21:54:50 -0400 Subject: Rename UserStatus controller --- app/Controller/UserStatus.php | 111 ------------------------- app/Controller/UserStatusController.php | 111 +++++++++++++++++++++++++ app/ServiceProvider/AuthenticationProvider.php | 2 +- app/Template/user/dropdown.php | 14 ++-- app/Template/user_status/disable.php | 2 +- app/Template/user_status/enable.php | 2 +- app/Template/user_status/remove.php | 2 +- 7 files changed, 122 insertions(+), 122 deletions(-) delete mode 100644 app/Controller/UserStatus.php create mode 100644 app/Controller/UserStatusController.php (limited to 'app') diff --git a/app/Controller/UserStatus.php b/app/Controller/UserStatus.php deleted file mode 100644 index 6f93e953..00000000 --- a/app/Controller/UserStatus.php +++ /dev/null @@ -1,111 +0,0 @@ -getUser(); - - $this->response->html($this->helper->layout->user('user_status/remove', array( - 'user' => $user, - ))); - } - - /** - * Remove a user - * - * @access public - */ - public function remove() - { - $user = $this->getUser(); - $this->checkCSRFParam(); - - if ($this->user->remove($user['id'])) { - $this->flash->success(t('User removed successfully.')); - } else { - $this->flash->failure(t('Unable to remove this user.')); - } - - $this->response->redirect($this->helper->url->to('user', 'index')); - } - - /** - * Confirm enable a user - * - * @access public - */ - public function confirmEnable() - { - $user = $this->getUser(); - - $this->response->html($this->helper->layout->user('user_status/enable', array( - 'user' => $user, - ))); - } - - /** - * Enable a user - * - * @access public - */ - public function enable() - { - $user = $this->getUser(); - $this->checkCSRFParam(); - - if ($this->user->enable($user['id'])) { - $this->flash->success(t('User activated successfully.')); - } else { - $this->flash->failure(t('Unable to enable this user.')); - } - - $this->response->redirect($this->helper->url->to('user', 'index')); - } - - /** - * Confirm disable a user - * - * @access public - */ - public function confirmDisable() - { - $user = $this->getUser(); - - $this->response->html($this->helper->layout->user('user_status/disable', array( - 'user' => $user, - ))); - } - - /** - * Disable a user - * - * @access public - */ - public function disable() - { - $user = $this->getUser(); - $this->checkCSRFParam(); - - if ($this->user->disable($user['id'])) { - $this->flash->success(t('User disabled successfully.')); - } else { - $this->flash->failure(t('Unable to disable this user.')); - } - - $this->response->redirect($this->helper->url->to('user', 'index')); - } -} diff --git a/app/Controller/UserStatusController.php b/app/Controller/UserStatusController.php new file mode 100644 index 00000000..2b23505c --- /dev/null +++ b/app/Controller/UserStatusController.php @@ -0,0 +1,111 @@ +getUser(); + + $this->response->html($this->helper->layout->user('user_status/remove', array( + 'user' => $user, + ))); + } + + /** + * Remove a user + * + * @access public + */ + public function remove() + { + $user = $this->getUser(); + $this->checkCSRFParam(); + + if ($this->user->remove($user['id'])) { + $this->flash->success(t('User removed successfully.')); + } else { + $this->flash->failure(t('Unable to remove this user.')); + } + + $this->response->redirect($this->helper->url->to('user', 'index')); + } + + /** + * Confirm enable a user + * + * @access public + */ + public function confirmEnable() + { + $user = $this->getUser(); + + $this->response->html($this->helper->layout->user('user_status/enable', array( + 'user' => $user, + ))); + } + + /** + * Enable a user + * + * @access public + */ + public function enable() + { + $user = $this->getUser(); + $this->checkCSRFParam(); + + if ($this->user->enable($user['id'])) { + $this->flash->success(t('User activated successfully.')); + } else { + $this->flash->failure(t('Unable to enable this user.')); + } + + $this->response->redirect($this->helper->url->to('user', 'index')); + } + + /** + * Confirm disable a user + * + * @access public + */ + public function confirmDisable() + { + $user = $this->getUser(); + + $this->response->html($this->helper->layout->user('user_status/disable', array( + 'user' => $user, + ))); + } + + /** + * Disable a user + * + * @access public + */ + public function disable() + { + $user = $this->getUser(); + $this->checkCSRFParam(); + + if ($this->user->disable($user['id'])) { + $this->flash->success(t('User disabled successfully.')); + } else { + $this->flash->failure(t('Unable to disable this user.')); + } + + $this->response->redirect($this->helper->url->to('user', 'index')); + } +} diff --git a/app/ServiceProvider/AuthenticationProvider.php b/app/ServiceProvider/AuthenticationProvider.php index 9c845905..82f61e11 100644 --- a/app/ServiceProvider/AuthenticationProvider.php +++ b/app/ServiceProvider/AuthenticationProvider.php @@ -140,7 +140,7 @@ class AuthenticationProvider implements ServiceProviderInterface $acl->add('UserImportController', '*', Role::APP_ADMIN); $acl->add('UserCreationController', '*', Role::APP_ADMIN); $acl->add('User', array('index', 'authentication'), Role::APP_ADMIN); - $acl->add('UserStatus', '*', Role::APP_ADMIN); + $acl->add('UserStatusController', '*', Role::APP_ADMIN); return $acl; } diff --git a/app/Template/user/dropdown.php b/app/Template/user/dropdown.php index b74ed6e0..086bf01b 100644 --- a/app/Template/user/dropdown.php +++ b/app/Template/user/dropdown.php @@ -5,23 +5,23 @@ url->link(t('View profile'), 'user', 'show', array('user_id' => $user['id'])) ?> - user->hasAccess('UserStatus', 'disable') && ! $this->user->isCurrentUser($user['id'])): ?> + user->hasAccess('UserStatusController', 'disable') && ! $this->user->isCurrentUser($user['id'])): ?>
  • - url->link(t('Disable'), 'UserStatus', 'confirmDisable', array('user_id' => $user['id']), false, 'popover') ?> + url->link(t('Disable'), 'UserStatusController', 'confirmDisable', array('user_id' => $user['id']), false, 'popover') ?>
  • - user->hasAccess('UserStatus', 'enable') && ! $this->user->isCurrentUser($user['id'])): ?> + user->hasAccess('UserStatusController', 'enable') && ! $this->user->isCurrentUser($user['id'])): ?>
  • - url->link(t('Enable'), 'UserStatus', 'confirmEnable', array('user_id' => $user['id']), false, 'popover') ?> + url->link(t('Enable'), 'UserStatusController', 'confirmEnable', array('user_id' => $user['id']), false, 'popover') ?>
  • - user->hasAccess('UserStatus', 'remove') && ! $this->user->isCurrentUser($user['id'])): ?> + user->hasAccess('UserStatusController', 'remove') && ! $this->user->isCurrentUser($user['id'])): ?>
  • - url->link(t('Remove'), 'UserStatus', 'confirmRemove', array('user_id' => $user['id']), false, 'popover') ?> + url->link(t('Remove'), 'UserStatusController', 'confirmRemove', array('user_id' => $user['id']), false, 'popover') ?>
  • - \ No newline at end of file + diff --git a/app/Template/user_status/disable.php b/app/Template/user_status/disable.php index 90d8c757..b551b3b8 100644 --- a/app/Template/user_status/disable.php +++ b/app/Template/user_status/disable.php @@ -6,7 +6,7 @@

    - url->link(t('Yes'), 'UserStatus', 'disable', array('user_id' => $user['id']), true, 'btn btn-red') ?> + url->link(t('Yes'), 'UserStatusController', 'disable', array('user_id' => $user['id']), true, 'btn btn-red') ?> url->link(t('cancel'), 'user', 'index', array(), false, 'close-popover') ?>
    diff --git a/app/Template/user_status/enable.php b/app/Template/user_status/enable.php index cd3d4947..fe527047 100644 --- a/app/Template/user_status/enable.php +++ b/app/Template/user_status/enable.php @@ -6,7 +6,7 @@

    - url->link(t('Yes'), 'UserStatus', 'enable', array('user_id' => $user['id']), true, 'btn btn-red') ?> + url->link(t('Yes'), 'UserStatusController', 'enable', array('user_id' => $user['id']), true, 'btn btn-red') ?> url->link(t('cancel'), 'user', 'index', array(), false, 'close-popover') ?>
    diff --git a/app/Template/user_status/remove.php b/app/Template/user_status/remove.php index cd5c09a6..c8458092 100644 --- a/app/Template/user_status/remove.php +++ b/app/Template/user_status/remove.php @@ -6,7 +6,7 @@

    - url->link(t('Yes'), 'UserStatus', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> + url->link(t('Yes'), 'UserStatusController', 'remove', array('user_id' => $user['id']), true, 'btn btn-red') ?> url->link(t('cancel'), 'user', 'index', array(), false, 'close-popover') ?>
    -- cgit v1.2.3