Permalink
Browse files

Ripped out defunct admin console.

  • Loading branch information...
1 parent 16e6ff3 commit b3b0e6628443a738ccf3cdbd5913bf7ff8e24262 @cjsaylor committed Feb 26, 2012
@@ -57,7 +57,7 @@ private function setupAuth() {
$this->Auth->userModel = 'User';
$this->Auth->loginAction = '/login';
- $this->Auth->loginRedirect = !$this->isAdmin() ? '/dashboard' : '/';
+ $this->Auth->loginRedirect = '/dashboard';
$this->Auth->logoutRedirect = '/';
$this->Auth->loginError = 'No username and password was found with that combination';
$this->Auth->userScope = array('User.is_active' => 1);
@@ -72,30 +72,13 @@ private function setupAuth() {
if($this->isMobile())
$this->Auth->loginRedirect = '/containers';
- // Setup a scope for admin users accessing admin section
- if($this->isAdmin()) {
- // If a user is logged in, but is not an admin...
- if($this->Auth->user() && !$this->Auth->user('is_admin')) {
- $this->Session->setFlash(__('Not authorized to view this resource.', true), 'notification/error');
- $this->redirect('/');
- }
-
- $this->Auth->userScope = array_merge($this->Auth->userScope, array('User.is_admin' => 1));
- $this->Auth->loginAction = '/admin/login';
- $this->layout = 'admin';
- }
-
- if($this->_secure || $this->isAdmin())
+ if($this->_secure)
$this->Auth->deny();
else
$this->Auth->allow();
}
- protected function isAdmin() {
- return isset($this->params['admin']) && $this->params['admin'];
- }
-
protected function setupMobile() {
if($this->isMobile()) {
$this->view = 'Theme';
@@ -23,10 +23,6 @@
Router::connect('/signup', array('controller' => 'users', 'action' => 'signup'));
Router::connect('/account', array('controller' => 'users', 'action' => 'account'));
- // Admin
- Router::connect('/admin', array('controller' => 'manager', 'action' => 'index', 'admin' => true));
- Router::connect('/admin/login', array('controller' => 'users', 'action' => 'login', 'admin' => true));
-
// Application
Router::connect('/dashboard', array('controller' => 'containers', 'action' => 'dashboard'));
Router::connect('/forgot_login/*', array('controller' => 'users', 'action' => 'qr_login'));
@@ -1,10 +0,0 @@
-<?php
-class ManagerController extends AppController {
-
- public $name = 'Manager';
-
- public $uses = array();
-
- public function admin_index() {}
-
-}
@@ -158,68 +158,4 @@ public function dismiss_message() {
$this->Cookie->write('message_dismissed' . Configure::read('Message.cookie_suffix'), 'hide', false, date('Y-m-d H:i:s', strtotime('+2 weeks')));
$this->autoRender = false;
}
-
-// ADMIN FUNCTION
-
- public function admin_login() {
- $this->render('login');
- }
-
- function admin_index() {
- $this->User->recursive = 0;
- $this->set('users', $this->paginate());
- }
-
- function admin_view($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid user', true));
- $this->redirect(array('action' => 'index'));
- }
- $this->set('user', $this->User->read(null, $id));
- }
-
- function admin_add() {
- if (!empty($this->data)) {
- $this->User->create();
- if ($this->User->save($this->data)) {
- $this->Session->setFlash(__('The user has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
- }
- }
- }
-
- function admin_edit($id = null) {
- if (!$id && empty($this->data)) {
- $this->Session->setFlash(__('Invalid user', true));
- $this->redirect(array('action' => 'index'));
- }
- if (!empty($this->data)) {
- if(!empty($this->data['User']['new_password']))
- $this->data['User']['password'] = Security::hash($this->data['User']['new_password'], Configure::read('Security.hash'), true);
- if ($this->User->save($this->data)) {
- $this->Session->setFlash(__('The user has been saved', true));
- $this->redirect(array('action' => 'index'));
- } else {
- $this->Session->setFlash(__('The user could not be saved. Please, try again.', true));
- }
- } else {
- $this->data = $this->User->read(null, $id);
- }
- }
-
- function admin_delete($id = null) {
- if (!$id) {
- $this->Session->setFlash(__('Invalid id for user', true));
- $this->redirect(array('action'=>'index'));
- }
- if ($this->User->delete($id)) {
- $this->Session->setFlash(__('User deleted', true));
- $this->redirect(array('action'=>'index'));
- }
- $this->Session->setFlash(__('User was not deleted', true));
- $this->redirect(array('action' => 'index'));
- }
-}
-?>
+}
@@ -1,28 +0,0 @@
-<?php
- if(!isset($active))
- $active = '';
- $menu = array(
- 'users.index' => array(
- 'label' => 'Users',
- 'link' => '/admin/users',
- ),
- 'containers.index' => array(
- 'label' => 'Containers',
- 'link' => array('controller' => 'containers', 'action' => 'index', 'admin' => true)
- ),
- 'container_items.index' => array(
- 'label' => 'Items',
- 'link' => array('controller' => 'container_items', 'action' => 'index', 'admin' => true)
- )
- );
-?>
-<div id="navigation">
- <ul>
- <?php
- foreach($menu as $path => $link) {
- echo $this->Html->tag('li', $this->Html->link($link['label'], $link['link']), array('class' => $path == $active ? 'active' : ''));
- }
- ?>
- </ul>
- <div style="clear: both"></div>
-</div>
@@ -3,8 +3,6 @@
<?php
if(!empty($User)) {
echo $html->tag('li', $html->link('My Account', '/account', array('class' => 'large blue button')));
- if($User['is_admin'] == '1')
- echo $html->tag('li', $html->link('Admin', '/admin', array('class' => 'large red button')));
echo $html->tag('li', $html->link('Sign Out', '/logout', array('class' => 'large orange button')));
} else {
echo $html->tag('li', $html->link('Sign Up', '/signup', array('class' => 'large green button ui-modal')));
@@ -1,5 +0,0 @@
-<h2>Admin Manager</h2>
-<ul>
- <li><?php echo $html->link('Configurations', array('controller' => 'configurations', 'action' => 'index', 'admin' => true)); ?></li>
- <li><?php echo $html->link('Users', array('controller' => 'users', 'action' => 'index', 'admin' => true)); ?></li>
-</ul>
@@ -1,21 +0,0 @@
-<div class="users form">
-<?php echo $this->Form->create('User');?>
- <fieldset>
- <legend><?php __('Admin Add User'); ?></legend>
- <?php
- echo $this->Form->input('email');
- echo $this->Form->input('password');
- //echo $this->Form->input('uuid');
- echo $this->Form->input('is_active');
- echo $this->Form->input('is_admin');
- ?>
- </fieldset>
-<?php echo $this->Form->end(__('Submit', true));?>
-</div>
-<div class="actions">
- <h3><?php __('Actions'); ?></h3>
- <ul>
-
- <li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index'));?></li>
- </ul>
-</div>
@@ -1,23 +0,0 @@
-<div class="users form">
-<?php echo $this->Form->create('User');?>
- <fieldset>
- <legend><?php __('Admin Edit User'); ?></legend>
- <?php
- echo $this->Form->input('id');
- echo $this->Form->input('email');
- echo $this->Form->input('new_password', array('type' => 'password'));
- //echo $this->Form->input('uuid');
- echo $this->Form->input('is_active');
- echo $this->Form->input('is_admin');
- ?>
- </fieldset>
-<?php echo $this->Form->end(__('Submit', true));?>
-</div>
-<div class="actions">
- <h3><?php __('Actions'); ?></h3>
- <ul>
-
- <li><?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $this->Form->value('User.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $this->Form->value('User.id'))); ?></li>
- <li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index'));?></li>
- </ul>
-</div>
@@ -1,57 +0,0 @@
-<div class="users index">
- <h2><?php __('Users');?></h2>
- <table cellpadding="0" cellspacing="0">
- <tr>
- <th><?php echo $this->Paginator->sort('id');?></th>
- <th><?php echo $this->Paginator->sort('email');?></th>
- <th><?php echo $this->Paginator->sort('uuid');?></th>
- <th><?php echo $this->Paginator->sort('is_active');?></th>
- <th><?php echo $this->Paginator->sort('is_admin');?></th>
- <th><?php echo $this->Paginator->sort('created');?></th>
- <th><?php echo $this->Paginator->sort('modified');?></th>
- <th class="actions"><?php __('Actions');?></th>
- </tr>
- <?php
- $i = 0;
- foreach ($users as $user):
- $class = null;
- if ($i++ % 2 == 0) {
- $class = ' class="altrow"';
- }
- ?>
- <tr<?php echo $class;?>>
- <td><?php echo $user['User']['id']; ?>&nbsp;</td>
- <td><?php echo $user['User']['email']; ?>&nbsp;</td>
- <td><?php echo $user['User']['uuid']; ?>&nbsp;</td>
- <td><?php echo $user['User']['is_active']; ?>&nbsp;</td>
- <td><?php echo $user['User']['is_admin']; ?>&nbsp;</td>
- <td><?php echo $user['User']['created']; ?>&nbsp;</td>
- <td><?php echo $user['User']['modified']; ?>&nbsp;</td>
- <td class="actions">
- <?php echo $this->Html->link(__('View', true), array('action' => 'view', $user['User']['id'])); ?>
- <?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $user['User']['id'])); ?>
- <?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?>
- </td>
- </tr>
-<?php endforeach; ?>
- </table>
- <p>
- <?php
- echo $this->Paginator->counter(array(
- 'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
- ));
- ?> </p>
-
- <div class="paging">
- <?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
- | <?php echo $this->Paginator->numbers();?>
- |
- <?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
- </div>
-</div>
-<div class="actions">
- <h3><?php __('Actions'); ?></h3>
- <ul>
- <li><?php echo $this->Html->link(__('New User', true), array('action' => 'add')); ?></li>
- </ul>
-</div>
@@ -1,54 +0,0 @@
-<div class="users view">
-<h2><?php __('User');?></h2>
- <dl><?php $i = 0; $class = ' class="altrow"';?>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Id'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['id']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Email'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['email']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Password'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['password']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Uuid'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['uuid']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Is Active'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['is_active']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Is Admin'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['is_admin']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Created'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['created']; ?>
- &nbsp;
- </dd>
- <dt<?php if ($i % 2 == 0) echo $class;?>><?php __('Modified'); ?></dt>
- <dd<?php if ($i++ % 2 == 0) echo $class;?>>
- <?php echo $user['User']['modified']; ?>
- &nbsp;
- </dd>
- </dl>
-</div>
-<div class="actions">
- <h3><?php __('Actions'); ?></h3>
- <ul>
- <li><?php echo $this->Html->link(__('Edit User', true), array('action' => 'edit', $user['User']['id'])); ?> </li>
- <li><?php echo $this->Html->link(__('Delete User', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </li>
- <li><?php echo $this->Html->link(__('List Users', true), array('action' => 'index')); ?> </li>
- <li><?php echo $this->Html->link(__('New User', true), array('action' => 'add')); ?> </li>
- </ul>
-</div>

0 comments on commit b3b0e66

Please sign in to comment.