diff --git a/app/.htaccess b/app/.htaccess index b81d211..e0ab93e 100755 --- a/app/.htaccess +++ b/app/.htaccess @@ -1,3 +1,5 @@ +php_value newrelic.appname "Boxmeup" + RewriteEngine on RewriteBase /app/ diff --git a/app/Config/routes.php b/app/Config/routes.php index d4ae947..740af90 100755 --- a/app/Config/routes.php +++ b/app/Config/routes.php @@ -1,6 +1,6 @@ template name @@ -8,7 +8,8 @@ $static_pages = array( '' => 'home', 'terms' => 'terms', - 'privacy' => 'privacy' + 'privacy' => 'privacy', + 'developer' => 'developer' ); foreach($static_pages as $slug => $page) { Router::connect('/'.$slug, array('controller' => 'pages', 'action' => 'display', $page)); @@ -23,6 +24,19 @@ // Application Router::connect('/dashboard', array('controller' => 'containers', 'action' => 'dashboard')); +// API +Router::connect('/api/containers/search/*', array('plugin' => 'api', 'controller' => 'containers', 'action' => 'search')); +Router::connect('/api/users/login', array('plugin' => 'api', 'controller' => 'users', 'action' => 'login', '[method]' => 'POST')); +// API Mapped resources +Router::mapResources(array( + 'Api.containers', + 'Api.container_items' +), array( + 'id' => '[a-z0-9-]+' +)); +// API Catchall +Router::connect('/api/*', array('plugin' => 'api')); + // Fallback Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display')); diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php index e899117..6db20a4 100644 --- a/app/Controller/UsersController.php +++ b/app/Controller/UsersController.php @@ -101,7 +101,6 @@ public function logout() { } public function account() { - Configure::write('Feature.adsense', false); $this->layout = 'app'; if(!empty($this->request->data)) { $this->request->data['User']['id'] = $this->Auth->user('id'); @@ -121,6 +120,23 @@ public function account() { $secret_key = ClassRegistry::init('Api.ApiUser')->getSecretKey($api_key); $this->set(compact('api_key', 'secret_key')); } + + public function auth() { + $this->layout = 'app'; + $userApplication = ClassRegistry::init('Api.ApiUserApplication'); + $this->set('applications', $userApplication->getAllAuthenticatedApps($this->Auth->user('id'))); + } + + public function revoke($id) { + $this->layout = 'app'; + $userApplication = ClassRegistry::init('Api.ApiUserApplication'); + if ($userApplication->revokeTokenById($id, $this->Auth->user('id'))) { + $this->Session->setFlash(__('Successfully revoked token.'), 'notification/success'); + } else { + $this->Session->setFlash(__('Error revoking token.'), 'notification/error'); + } + $this->redirect(array('action' => 'auth')); + } public function forgot_password() { if(!empty($this->request->data)) { @@ -185,4 +201,4 @@ public function change_language($language = null) { } $this->redirect($this->referer()); } -} \ No newline at end of file +} diff --git a/app/Model/Behavior/SphinxBehavior.php b/app/Model/Behavior/SphinxBehavior.php index 3240a89..4004469 100755 --- a/app/Model/Behavior/SphinxBehavior.php +++ b/app/Model/Behavior/SphinxBehavior.php @@ -24,7 +24,7 @@ class SphinxBehavior extends ModelBehavior */ var $sphinx = null; - function setup(&$model, $config = array()) + function setup(Model $model, $config = array()) { $settings = array_merge($this->_defaults, (array) $config); @@ -43,7 +43,7 @@ function setup(&$model, $config = array()) * @return array Modified query * @access public */ - function beforeFind(&$model, $query) + function beforeFind(Model $model, $query) { if (empty($query['sphinx']) || empty($query['search'])) return true; @@ -135,4 +135,4 @@ function beforeFind(&$model, $query) return $query; } } -?> \ No newline at end of file +?> diff --git a/app/Model/ContainerItem.php b/app/Model/ContainerItem.php index 014bd8d..9417625 100755 --- a/app/Model/ContainerItem.php +++ b/app/Model/ContainerItem.php @@ -104,10 +104,14 @@ public function searchContainers(&$controller, $user_id, $query) { // API Methods public function getApiContainerItems($user_id, $conditions = array()) { $conditions = array_merge(array('user_id' => $user_id), $conditions); - return $this->find('all', array( + $data = $this->find('all', array( 'fields' => array('uuid', 'body', 'quantity', 'created', 'modified'), 'conditions' => $conditions, 'limit' => 150 )); + foreach ($data as &$datum) { + $datum['ContainerItem']['quantity'] = (int)$datum['ContainerItem']['quantity']; + } + return $data; } -} \ No newline at end of file +} diff --git a/app/Plugin/Api/Config/Schema/schema.php b/app/Plugin/Api/Config/Schema/schema.php deleted file mode 100755 index 7aeaef6..0000000 --- a/app/Plugin/Api/Config/Schema/schema.php +++ /dev/null @@ -1,24 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'), - 'api_key' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), - 'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '1'), - 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'user_id' => array('column' => 'user_id', 'unique' => 0), 'api_key' => array('column' => 'api_key', 'unique' => 0)), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') - ); -} -?> \ No newline at end of file diff --git a/app/Plugin/Api/Config/routes.php b/app/Plugin/Api/Config/routes.php deleted file mode 100644 index a4435bf..0000000 --- a/app/Plugin/Api/Config/routes.php +++ /dev/null @@ -1,8 +0,0 @@ - '[a-z0-9-]+' -)); diff --git a/app/Plugin/Api/Config/service_description.json b/app/Plugin/Api/Config/service_description.json new file mode 100644 index 0000000..a10b72e --- /dev/null +++ b/app/Plugin/Api/Config/service_description.json @@ -0,0 +1,230 @@ +{ + "name": "BoxmeupAPI", + "apiVersion": "2013-08-11", + "baseUrl": "https://boxmeupapp.com/api", + "description": "BoxmeupAPI allows for programatic manipulation of containers, items, and locations", + "operations": { + "Login": { + "httpMethod": "POST", + "uri": "/users/login", + "summary": "Authenticate a user and retrieve an OAuth access token.", + "responseClass": "LoginOutput", + "parameters": { + "email": { + "location": "postField", + "description": "Email of the account.", + "type": "string", + "required": true + }, + "password": { + "location": "postField", + "description": "Password of the account.", + "type": "string", + "required": true + }, + "application": { + "location": "postField", + "description": "Application name to register this OAuth request.", + "type": "string", + "required": true + } + } + }, + "GetContainers": { + "httpMethod": "GET", + "uri": "/containers", + "summary": "Get a list of containers.", + "responseClass": "ContainerListOutput", + "parameters": { + "slug": { + "location": "query", + "description": "Filter by container slug.", + "type": "string", + "required": false + } + } + }, + "AddContainer": { + "httpMethod": "POST", + "uri": "/containers", + "summary": "Adds a new container.", + "responseClass": "ContainerShortOutput", + "parameters": { + "name": { + "location": "postField", + "description": "Name of the container", + "type": "string", + "required": true + } + } + }, + "UpdateContainer": { + "httpMethod": "PUT", + "uri": "/containers/:slug", + "summary": "Updates an existing container.", + "responseClass": "ContainerLongOutput", + "parameters": { + "slug": { + "location": "uri", + "description": "Container slug.", + "type": "string", + "required": true + }, + "name": { + "location": "postField", + "description": "Name of the container", + "type": "string", + "required": true + } + } + }, + "RemoveContainer": { + "httpMethod": "DELETE", + "uri": "/containers/:slug", + "summary": "Adds a new container.", + "responseClass": "SuccessOutput", + "parameters": { + "slug": { + "location": "uri", + "description": "Container slug.", + "type": "string", + "required": true + } + } + } + }, + "models": { + "LoginOutput": { + "type": "object", + "properties": { + "token": { + "location": "json", + "type": "string" + } + } + }, + "ContainerListOutput": { + "type": "array", + "items": { + "type": "object", + "properties": { + "Container": { + "location": "json", + "type": "object", + "properties": { + "name": { + "location": "json", + "type": "string" + }, + "uuid": { + "location": "json", + "type": "string" + }, + "slug": { + "location": "json", + "type": "string" + }, + "container_item_count": { + "location": "json", + "type": "integer" + }, + "created": { + "location": "json", + "type": "string" + }, + "modified": { + "location": "json", + "type": "string" + } + } + }, + "Location": { + "location": "json", + "type": "object", + "properties": { + "name": { + "location": "json", + "type": "string" + }, + "uuid": { + "location": "json", + "type": "string" + } + } + } + } + } + }, + "ContainerShortOutput": { + "type": "object", + "properties": { + "uuid": { + "location": "json", + "type": "string" + }, + "slug": { + "location": "json", + "type": "string" + } + } + }, + "ContainerLongOutput": { + "type": "object", + "properties": { + "Container": { + "location": "json", + "type": "object", + "properties": { + "name": { + "location": "json", + "type": "string" + }, + "uuid": { + "location": "json", + "type": "string" + }, + "slug": { + "location": "json", + "type": "string" + }, + "container_item_count": { + "location": "json", + "type": "integer" + }, + "created": { + "location": "json", + "type": "string" + }, + "modified": { + "location": "json", + "type": "string" + } + } + }, + "Location": { + "location": "json", + "type": "object", + "properties": { + "name": { + "location": "json", + "type": "string" + }, + "uuid": { + "location": "json", + "type": "string" + } + } + } + } + }, + "SuccessOutput": { + "type": "object", + "properties": { + "success": { + "location": "json", + "type": "boolean" + } + } + } + } +} diff --git a/app/Plugin/Api/Controller/ApiAppController.php b/app/Plugin/Api/Controller/ApiAppController.php index 6ce4cf1..00164b4 100644 --- a/app/Plugin/Api/Controller/ApiAppController.php +++ b/app/Plugin/Api/Controller/ApiAppController.php @@ -2,7 +2,7 @@ class ApiAppController extends AppController { - public $uses = array('Api.ApiUser'); + public $uses = array('Api.ApiUser', 'Api.ApiUserApplication'); public $viewClass = 'Json'; @@ -24,10 +24,7 @@ public function jsonOutput($data) { } public function getUserId() { - if (empty($this->userId)) { - $this->userId = $this->ApiUser->getUserId($this->request->data['ApiUser']['api_key']); - } - return $this->userId; + return $this->request->data['User']['id']; } } diff --git a/app/Plugin/Api/Controller/Component/ApiAuthComponent.php b/app/Plugin/Api/Controller/Component/ApiAuthComponent.php index 027b0f3..3e236a4 100644 --- a/app/Plugin/Api/Controller/Component/ApiAuthComponent.php +++ b/app/Plugin/Api/Controller/Component/ApiAuthComponent.php @@ -2,7 +2,6 @@ class ApiAuthComponent extends Component { - const TIMESTAMP_THRESHOLD = 60; const AUTHENTICATION_HEADER = 'Authentication'; const AUTHENTICATION_TYPE = 'BoxmeupAPI'; @@ -62,7 +61,7 @@ protected function isAllowed() { * @return void */ protected function authenticate() { - $requiredHeaderParams = array('api_key', 'now', 'hash'); + $requiredHeaderParams = array('token'); // Parse authentication headers $authHeader = CakeRequest::header(static::AUTHENTICATION_HEADER); @@ -75,51 +74,18 @@ protected function authenticate() { } // Check API key - $userSecretKey = $this->controller->ApiUser->getSecretKey($parsedAuthHeader['api_key']); - if (empty($userSecretKey)) { - throw new NotAuthorizedException('Invalid api key.'); + try { + $user = $this->controller->ApiUserApplication->getUserByToken($parsedAuthHeader['token']); + } catch (NotFoundException $e) { + throw new NotAuthorizedException($e->getMessage()); } - // Validate time - if (!$this->isValidTime($parsedAuthHeader['now'])) { - throw new NotAuthorizedException('[now] parameter is not within threshold.'); - } - - $params = $this->controller->request->isGet() ? - $this->controller->request->query : - $this->controller->data; - ksort($params); - - // Validate hash code - $encodedParams = version_compare(PHP_VERSION, '5.4.0', '>=') ? - http_build_query($params, null, null, PHP_QUERY_RFC3986) : - str_replace('+', '%20', http_build_query($params)); // 5.3 hack - $code = sha1( - '/' . $this->controller->request->url . '?' . - $encodedParams . - $parsedAuthHeader['now'] . - $userSecretKey - ); - if ($code !== $parsedAuthHeader['hash']) { - throw new NotAuthorizedException('HMAC code signature does not match expected signature.'); - } - - // Store the parner into the request to be reused by the app - $this->controller->request->data('ApiUser.api_key', $parsedAuthHeader['api_key']); + // Store the user information in the request + $this->controller->request->data('User', $user); } /** - * Determines if passed timestamp is within threshold. - * - * @param integer $timestamp - * @return boolean - */ - protected function isValidTime($timestamp) { - return abs(time() - $timestamp) <= static::TIMESTAMP_THRESHOLD; - } - - /** - * Parse the ZumbaAPI authentication header. + * Parse the BoxmeupAPI authentication header. * * @param string $header * @return array @@ -152,4 +118,4 @@ public function __construct($message, $code = 401) { parent::__construct($message, $code); } -} \ No newline at end of file +} diff --git a/app/Plugin/Api/Controller/ContainerItemsController.php b/app/Plugin/Api/Controller/ContainerItemsController.php index 9fccf85..b3bd86f 100644 --- a/app/Plugin/Api/Controller/ContainerItemsController.php +++ b/app/Plugin/Api/Controller/ContainerItemsController.php @@ -1,18 +1,18 @@ params['url']['Container_slug']) ? array('Container.slug' => $this->params['url']['slug']) : array(); - $this->output = $this->ContainerItem->getApiContainerItems($this->user_id, $conditions); - if(empty($this->output)) { - $this->setError(404, 'No container items.'); + $conditions = !empty($this->request->query['slug']) ? array('Container.slug' => $this->request->query['slug']) : array(); + $output = $this->ContainerItem->getApiContainerItems($this->getUserId(), $conditions); + if(empty($output)) { + throw new NotFoundException('No container items.'); } + $this->jsonOutput($output); } public function add($slug = null) { @@ -85,4 +85,4 @@ public function delete($uuid = null) { } } -} \ No newline at end of file +} diff --git a/app/Plugin/Api/Controller/ContainersController.php b/app/Plugin/Api/Controller/ContainersController.php index 15f37af..82c711a 100644 --- a/app/Plugin/Api/Controller/ContainersController.php +++ b/app/Plugin/Api/Controller/ContainersController.php @@ -30,7 +30,7 @@ public function add() { $data['Container']['name'] = $this->request->data['name']; $result = $this->Container->save($data); if(!$result) { - throw new BadRequestException(json_encode($this->Containter->validationErrors)); + throw new BadRequestException(json_encode($this->Container->validationErrors)); } $this->jsonOutput(array( 'uuid' => $result['Container']['uuid'], @@ -51,9 +51,10 @@ public function edit($slug = null) { } $data['Container']['name'] = $this->request->data['name']; if(!$result = $this->Container->save($data)) { - throw new BadRequestException(); + throw new BadRequestException(json_encode($this->Container->validationErrors)); } - unset($result['Container']['id'], $result['Container']['user_id'], $result['Container']['location_id'], $result['Location']); + unset($result['Container']['id'], $result['Container']['user_id'], $result['Container']['location_id']); + $result['Location'] = array_intersect_key($result['Location'], array('uuid' => true, 'name' => true)); $result['Container']['container_item_count'] = (int)$result['Container']['container_item_count']; $this->jsonOutput($result); } @@ -97,10 +98,10 @@ public function search() { $results[$key]['Container']['location_id'] ); } - $this->output = array( + $this->jsonOutput(array( 'search' => $results, 'pages' => $this->request->params['paging']['ContainerItem']['pageCount'], 'total' => $this->request->params['paging']['ContainerItem']['count'] - ); + )); } -} \ No newline at end of file +} diff --git a/app/Plugin/Api/Controller/UsersController.php b/app/Plugin/Api/Controller/UsersController.php index 3cd4480..5e0f031 100644 --- a/app/Plugin/Api/Controller/UsersController.php +++ b/app/Plugin/Api/Controller/UsersController.php @@ -4,7 +4,7 @@ class UsersController extends ApiAppController { public $name = 'Users'; - public $uses = array('User'); + public $uses = array('User', 'Api.ApiUserApplication'); public function beforeFilter() { $this->ApiAuth->allow('login'); @@ -12,7 +12,7 @@ public function beforeFilter() { } public function login() { - $required = array('email' => true, 'password' => true); + $required = array('email' => true, 'password' => true, 'application' => true); if(!$this->RequestHandler->isPost()) { throw new MethodNotAllowedException(); } @@ -23,10 +23,13 @@ public function login() { throw new ForbiddenException(); } $user = $this->User->getUserByEmail($this->request->data['email']); - $user = array_intersect_key($user['User'], array('id' => true, 'email' => true, 'uuid' => true)); - $user['api_key'] = $this->ApiUser->getApiKey($user['id']); - $user['secret_key'] = $this->ApiUser->getSecretKey($user['api_key']); - $this->jsonOutput($user); + try { + $token = $this->ApiUserApplication->getTokenByUserId($user['User']['id'], $this->request->data['application']); + } catch (NotFoundException $e) { + // Token doesn't exist, create one + $token = $this->ApiUserApplication->createApplication($this->request->data['application'], $user['User']['id']); + } + $this->jsonOutput(compact('token')); } -} \ No newline at end of file +} diff --git a/app/Plugin/Api/Lib/Error/ApiExceptionRenderer.php b/app/Plugin/Api/Lib/Error/ApiExceptionRenderer.php index 86e16ae..796d97a 100644 --- a/app/Plugin/Api/Lib/Error/ApiExceptionRenderer.php +++ b/app/Plugin/Api/Lib/Error/ApiExceptionRenderer.php @@ -5,14 +5,14 @@ class ApiExceptionRenderer extends ExceptionRenderer { public function error400($error) { - if (Router::currentRoute()->options['plugin']) { + if (Router::currentRoute()->defaults['plugin'] == 'api') { $this->controller->viewClass = 'Json'; } parent::error400($error); } public function error500($error) { - if (Router::currentRoute()->options['plugin']) { + if (Router::currentRoute()->defaults['plugin'] == 'api') { $this->controller->viewClass = 'Json'; } parent::error500($error); diff --git a/app/Plugin/Api/Model/ApiUserApplication.php b/app/Plugin/Api/Model/ApiUserApplication.php new file mode 100644 index 0000000..0b8d54d --- /dev/null +++ b/app/Plugin/Api/Model/ApiUserApplication.php @@ -0,0 +1,154 @@ + array( + 'numeric' => array( + 'rule' => array('numeric') + ), + 'notempty' => array( + 'rule' => array('notempty') + ) + ), + 'token' => array( + 'notempty' => array( + 'rule' => array('notempty') + ) + ) + ); + + public $belongsTo = array( + 'User' => array( + 'className' => 'User', + 'foreignKey' => 'user_id', + 'conditions' => '', + 'fields' => '', + 'order' => '' + ) + ); + + /** + * Creates an access token entry for a user with a given application name. + * + * @param string $name + * @param integer $userId + * @return string + * @throws InternalErrorException + */ + public function createApplication($name, $userId) { + $token = sha1($userId . time()); + $result = $this->save(array( + 'ApiUserApplication' => array( + 'name' => $name, + 'user_id' => $userId, + 'token' => $token + ) + )); + if (!$result) { + throw new InternalErrorException('Unable to create oauth token'); + } + return $token; + } + + /** + * Retrieve the user's auth token by userId and application name. + * + * @param integer $userId + * @param string $name Application name + * @return string + * @throws NotFoundException + */ + public function getTokenByUserId($userId, $name) { + $key = $userId . $name . '_auth_token'; + if (!$token = Cache::read($key)) { + $result = $this->find('first', array( + 'conditions' => array( + 'ApiUserApplication.user_id' => $userId, + 'ApiUserApplication.name' => $name + ), + 'fields' => array('ApiUserApplication.token') + )); + if (!empty($result['ApiUserApplication']['token'])) { + $token = $result['ApiUserApplication']['token']; + Cache::write($key, $token); + } + } + if (empty($token)) { + throw new NotFoundException('Token does not exist for this user.'); + } + return $token; + } + + /** + * Get all authenticated applications + * + * @param integer $userId + * @return array + */ + public function getAllAuthenticatedApps($userId) { + $results = $this->find('all', array( + 'conditions' => array( + 'ApiUserApplication.user_id' => $userId + ), + 'contain' => false + )); + return $results; + } + + /** + * Removes an auth token by ID. + * + * @param integer $id + * @return boolean + */ + public function revokeTokenById($id, $userId = null) { + $application = $this->find('first', array( + 'conditions' => array( + 'ApiUserApplication.id' => $id, + 'ApiUserApplication.user_id' => $userId + ), + 'contain' => array() + )); + if (empty($application)) { + return false; + } + Cache::delete($application['ApiUserApplication']['token'] . '_auth_token'); + Cache::delete($application['ApiUserApplication']['user_id'] . $application['ApiUserApplication']['name'] . '_auth_token'); + return $this->delete($id); + } + + /** + * Get user information based on auth token. + * + * @param string $token + * @return array + */ + public function getUserByToken($token) { + $key = $token . '_auth_token'; + if (!$user = Cache::read($key)) { + $result = $this->find('first', array( + 'conditions' => array( + 'ApiUserApplication.token' => $token + ), + 'contain' => array( + 'User' => array( + 'id', 'email', 'uuid' + ) + ) + )); + if (empty($result['User'])) { + throw new NotFoundException('Invalid token.'); + } + $user = $result['User']; + Cache::write($key, $user); + } + + return $user; + } + +} diff --git a/app/Plugin/Api/Test/Case/Model/ApiUserApplicationTest.php b/app/Plugin/Api/Test/Case/Model/ApiUserApplicationTest.php new file mode 100644 index 0000000..42a2abc --- /dev/null +++ b/app/Plugin/Api/Test/Case/Model/ApiUserApplicationTest.php @@ -0,0 +1,100 @@ +ApiUserApplication = ClassRegistry::init('Api.ApiUserApplication'); + $this->testAppToken = $this->ApiUserApplication->createApplication('Test App', '3'); + } + + /** + * tearDown method + * + * @return void + */ + public function tearDown() { + unset($this->ApiUserApplication); + unset($this->testAppToken); + Cache::clear(); + parent::tearDown(); + } + + /** + * testCreateApplication method + * + * @return void + */ + public function testCreateApplication() { + $result = $this->ApiUserApplication->createApplication('Test New App 1', '3'); + $this->assertNotEmpty($result); + $this->assertEquals($result, $this->ApiUserApplication->createApplication('Test New App 1', '3')); + } + + /** + * testGetTokenByUserId method + * + * @return void + */ + public function testGetTokenByUserId() { + $this->assertEquals($this->testAppToken, $this->ApiUserApplication->getTokenByUserId('3', 'Test App')); + } + + public function testGetAllAuthenticatedApps() { + $result = $this->ApiUserApplication->getAllAuthenticatedApps('3'); + $this->assertCount(2, $result); + $expected = array( + 'ApiUserApplication' => array( + 'id' => '1', + 'user_id' => '3', + 'name' => 'Test Fixture App', + 'token' => 'testtoken', + 'created' => null + ) + ); + $this->assertEquals($expected, $result[0]); + } + + public function testGetUserByToken() { + $result = $this->ApiUserApplication->getUserByToken('testtoken'); + $expected = array( + 'id' => '3', + 'email' => 'test@test.com', + 'uuid' => '52068a2c-00c4-40ba-baad-085321210046' + ); + $this->assertEquals($expected, $result); + } + + /** + * @expectedException NotFoundException + * @return void + */ + public function testRevokeTokenById() { + $this->assertTrue($this->ApiUserApplication->revokeTokenById(1)); + $this->ApiUserApplication->getUserByToken('testtoken'); + } + +} diff --git a/app/Plugin/Api/Test/Case/models/api_user.test.php b/app/Plugin/Api/Test/Case/models/api_user.test.php deleted file mode 100755 index eafb884..0000000 --- a/app/Plugin/Api/Test/Case/models/api_user.test.php +++ /dev/null @@ -1,18 +0,0 @@ -ApiUser =& ClassRegistry::init('ApiUser'); - } - - function endTest() { - unset($this->ApiUser); - ClassRegistry::flush(); - } - -} -?> \ No newline at end of file diff --git a/app/Plugin/Api/Test/Fixture/ApiUserApplicationFixture.php b/app/Plugin/Api/Test/Fixture/ApiUserApplicationFixture.php new file mode 100644 index 0000000..90a4972 --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/ApiUserApplicationFixture.php @@ -0,0 +1,40 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'name' => array('type' => 'string', 'null' => false, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), + 'token' => array('type' => 'string', 'null' => false, 'length' => 40, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'user_id' => array('column' => 'user_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => 1, + 'user_id' => 3, + 'name' => 'Test Fixture App', + 'token' => 'testtoken' + ) + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/ApiUserFixture.php b/app/Plugin/Api/Test/Fixture/ApiUserFixture.php new file mode 100644 index 0000000..8132522 --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/ApiUserFixture.php @@ -0,0 +1,47 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'api_key' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), + 'secret_key' => array('type' => 'string', 'null' => true, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), + 'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '1'), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'user_id' => array('column' => 'user_id', 'unique' => 0), + 'api_key' => array('column' => 'api_key', 'unique' => 0), + 'secret_key' => array('column' => 'secret_key', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => '3', + 'user_id' => '3', + 'api_key' => 'd7504563a2e26a1970384974b44848576ca27b80', + 'secret_key' => 'c6d3085094354055d4a23f20c48a7bcfc2399c9b', + 'is_active' => 1, + 'created' => '2013-08-10 18:45:01', + 'modified' => '2013-08-10 18:45:01' + ), + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/ContainerFixture.php b/app/Plugin/Api/Test/Fixture/ContainerFixture.php new file mode 100644 index 0000000..8a24f28 --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/ContainerFixture.php @@ -0,0 +1,51 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), + 'location_id' => array('type' => 'integer', 'null' => true, 'default' => '0', 'key' => 'index'), + 'uuid' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 36, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 36, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'slug' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'container_item_count' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 10), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'user' => array('column' => 'user_id', 'unique' => 0), + 'fk_containers_users' => array('column' => 'user_id', 'unique' => 0), + 'location_id' => array('column' => 'location_id', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => '40', + 'user_id' => '3', + 'location_id' => '0', + 'uuid' => '52068a36-5f88-485a-b7f3-085521210046', + 'name' => 'Test 1', + 'slug' => 'test-1', + 'container_item_count' => '2', + 'created' => '2013-08-10 18:45:10', + 'modified' => '2013-08-10 18:45:10' + ), + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/ContainerItemFixture.php b/app/Plugin/Api/Test/Fixture/ContainerItemFixture.php new file mode 100644 index 0000000..d2382ea --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/ContainerItemFixture.php @@ -0,0 +1,56 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'container_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), + 'uuid' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 36, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'body' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 100, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'quantity' => array('type' => 'integer', 'null' => false, 'default' => '1'), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'container' => array('column' => 'container_id', 'unique' => 0), + 'fk_container_items_containers1' => array('column' => 'container_id', 'unique' => 0), + 'uuid' => array('column' => 'uuid', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => '119', + 'container_id' => '40', + 'uuid' => '52068a3c-0d50-40c4-8dca-085621210046', + 'body' => 'Test 1a', + 'quantity' => '1', + 'created' => '2013-08-10 18:45:16', + 'modified' => '2013-08-10 18:45:16' + ), + array( + 'id' => '120', + 'container_id' => '40', + 'uuid' => '52068a40-6dd4-47ae-bbf9-085821210046', + 'body' => 'Test 1b', + 'quantity' => '1', + 'created' => '2013-08-10 18:45:20', + 'modified' => '2013-08-10 18:45:20' + ), + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/LocationFixture.php b/app/Plugin/Api/Test/Fixture/LocationFixture.php new file mode 100644 index 0000000..5fffece --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/LocationFixture.php @@ -0,0 +1,61 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'user_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'), + 'uuid' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 36, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'name' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 40, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'is_mappable' => array('type' => 'boolean', 'null' => false, 'default' => '0'), + 'address' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 250, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'container_count' => array('type' => 'integer', 'null' => false, 'default' => '0'), + 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => true, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'user_id' => array('column' => 'user_id', 'unique' => 0), + 'uuid' => array('column' => 'uuid', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => '4', + 'user_id' => '3', + 'uuid' => '52068a48-5cbc-4750-959c-085d21210046', + 'name' => 'Test Loc 1', + 'is_mappable' => 0, + 'address' => '', + 'container_count' => '0', + 'created' => '2013-08-10 18:45:28', + 'modified' => '2013-08-10 18:45:28' + ), + array( + 'id' => '5', + 'user_id' => '3', + 'uuid' => '52068a56-7968-40af-a06c-085e21210046', + 'name' => 'Test Loc 2', + 'is_mappable' => 1, + 'address' => '123 Easy St', + 'container_count' => '0', + 'created' => '2013-08-10 18:45:42', + 'modified' => '2013-08-10 18:45:42' + ), + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/UserFixture.php b/app/Plugin/Api/Test/Fixture/UserFixture.php new file mode 100644 index 0000000..f196ad1 --- /dev/null +++ b/app/Plugin/Api/Test/Fixture/UserFixture.php @@ -0,0 +1,51 @@ + array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'), + 'email' => array('type' => 'string', 'null' => false, 'length' => 60, 'key' => 'unique', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'password' => array('type' => 'string', 'null' => false, 'length' => 60, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'uuid' => array('type' => 'string', 'null' => false, 'length' => 36, 'key' => 'index', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'is_active' => array('type' => 'boolean', 'null' => false, 'default' => '1', 'key' => 'index'), + 'is_admin' => array('type' => 'boolean', 'null' => false, 'default' => '0'), + 'reset_password' => array('type' => 'boolean', 'null' => false, 'default' => '0'), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'modified' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + 'email' => array('column' => 'email', 'unique' => 1), + 'uuid' => array('column' => 'uuid', 'unique' => 0), + 'is_active' => array('column' => 'is_active', 'unique' => 0) + ), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') + ); + +/** + * Records + * + * @var array + */ + public $records = array( + array( + 'id' => '3', + 'email' => 'test@test.com', + 'password' => 'c65470601d71b53402c41d709d0803477dd7c3cb', + 'uuid' => '52068a2c-00c4-40ba-baad-085321210046', + 'is_active' => 1, + 'is_admin' => 0, + 'reset_password' => 0, + 'created' => '2013-08-10 18:45:00', + 'modified' => '2013-08-10 18:45:00' + ), + ); + +} diff --git a/app/Plugin/Api/Test/Fixture/api_user_fixture.php b/app/Plugin/Api/Test/Fixture/api_user_fixture.php deleted file mode 100755 index a45af11..0000000 --- a/app/Plugin/Api/Test/Fixture/api_user_fixture.php +++ /dev/null @@ -1,26 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'user_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'index'), - 'api_key' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'), - 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'user_id' => array('column' => 'user_id', 'unique' => 0), 'api_key' => array('column' => 'api_key', 'unique' => 0)), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_unicode_ci', 'engine' => 'InnoDB') - ); - - var $records = array( - array( - 'id' => 1, - 'user_id' => 1, - 'api_key' => 'Lorem ipsum dolor sit amet', - 'created' => '2011-05-17 22:52:07', - 'modified' => '2011-05-17 22:52:07' - ), - ); -} -?> \ No newline at end of file diff --git a/app/Plugin/Feedback/Model/Feedback.php b/app/Plugin/Feedback/Model/Feedback.php index 506d0b9..e18452c 100755 --- a/app/Plugin/Feedback/Model/Feedback.php +++ b/app/Plugin/Feedback/Model/Feedback.php @@ -8,7 +8,7 @@ class Feedback extends FeedbackAppModel { public $name = 'Feedback'; - public $useTable = 'feedback'; + public $useTable = false; public $validate = array( 'message' => array( @@ -56,4 +56,4 @@ public function githubIssue($type, $title, $body) { $body = json_decode($result->body, true); return $body['html_url']; } -} \ No newline at end of file +} diff --git a/app/Plugin/Utility/Model/Behavior/UuidableBehavior.php b/app/Plugin/Utility/Model/Behavior/UuidableBehavior.php index 74d4f43..0ebcab9 100755 --- a/app/Plugin/Utility/Model/Behavior/UuidableBehavior.php +++ b/app/Plugin/Utility/Model/Behavior/UuidableBehavior.php @@ -1,11 +1,11 @@ id) && $model->hasField('uuid')) { $model->data[$model->alias]['uuid'] = String::uuid(); } return true; } -} \ No newline at end of file +} diff --git a/app/Test/Case/controllers/ConfigurationsControllerTest.php b/app/Test/Case/controllers/ConfigurationsControllerTest.php deleted file mode 100755 index a78eb23..0000000 --- a/app/Test/Case/controllers/ConfigurationsControllerTest.php +++ /dev/null @@ -1,47 +0,0 @@ -redirectUrl = $url; - } -} - -class ConfigurationsControllerTest extends CakeTestCase { - var $fixtures = array('app.configuration'); - - function startTest() { - $this->Configurations =& new TestConfigurationsController(); - $this->Configurations->constructClasses(); - } - - function endTest() { - unset($this->Configurations); - ClassRegistry::flush(); - } - - function testAdminIndex() { - - } - - function testAdminView() { - - } - - function testAdminAdd() { - - } - - function testAdminEdit() { - - } - - function testAdminDelete() { - - } - -} -?> \ No newline at end of file diff --git a/app/Test/Case/controllers/ContainerItemsControllerTest.php b/app/Test/Case/controllers/ContainerItemsControllerTest.php deleted file mode 100755 index b5c34e4..0000000 --- a/app/Test/Case/controllers/ContainerItemsControllerTest.php +++ /dev/null @@ -1,27 +0,0 @@ -redirectUrl = $url; - } -} - -class ContainerItemsControllerTest extends CakeTestCase { - var $fixtures = array('app.container_item', 'app.container', 'app.tag', 'app.user'); - - function startTest() { - $this->ContainerItems =& new TestContainerItemsController(); - $this->ContainerItems->constructClasses(); - } - - function endTest() { - unset($this->ContainerItems); - ClassRegistry::flush(); - } - -} -?> \ No newline at end of file diff --git a/app/Test/Case/controllers/ContainersControllerTest.php b/app/Test/Case/controllers/ContainersControllerTest.php deleted file mode 100755 index 57b252b..0000000 --- a/app/Test/Case/controllers/ContainersControllerTest.php +++ /dev/null @@ -1,27 +0,0 @@ -redirectUrl = $url; - } -} - -class ContainersControllerTest extends CakeTestCase { - var $fixtures = array('app.container', 'app.category', 'app.container_item', 'app.user'); - - function startTest() { - $this->Containers =& new TestContainersController(); - $this->Containers->constructClasses(); - } - - function endTest() { - unset($this->Containers); - ClassRegistry::flush(); - } - -} -?> \ No newline at end of file diff --git a/app/Test/Case/controllers/UsersControllerTest.php b/app/Test/Case/controllers/UsersControllerTest.php deleted file mode 100755 index 28defcb..0000000 --- a/app/Test/Case/controllers/UsersControllerTest.php +++ /dev/null @@ -1,67 +0,0 @@ -redirectUrl = $url; - } -} - -class UsersControllerTest extends CakeTestCase { - var $fixtures = array('app.user'); - - function startTest() { - $this->Users =& new TestUsersController(); - $this->Users->constructClasses(); - } - - function endTest() { - unset($this->Users); - ClassRegistry::flush(); - } - - function testIndex() { - - } - - function testView() { - - } - - function testAdd() { - - } - - function testEdit() { - - } - - function testDelete() { - - } - - function testAdminIndex() { - - } - - function testAdminView() { - - } - - function testAdminAdd() { - - } - - function testAdminEdit() { - - } - - function testAdminDelete() { - - } - -} -?> \ No newline at end of file diff --git a/app/Test/Case/models/ContainerItemTest.php b/app/Test/Case/models/ContainerItemTest.php deleted file mode 100755 index ba43fb1..0000000 --- a/app/Test/Case/models/ContainerItemTest.php +++ /dev/null @@ -1,18 +0,0 @@ -ContainerItem =& ClassRegistry::init('ContainerItem'); - } - - function endTest() { - unset($this->ContainerItem); - ClassRegistry::flush(); - } - -} -?> \ No newline at end of file diff --git a/app/Test/Case/models/UserTest.php b/app/Test/Case/models/UserTest.php deleted file mode 100755 index b1f24e4..0000000 --- a/app/Test/Case/models/UserTest.php +++ /dev/null @@ -1,18 +0,0 @@ -User =& ClassRegistry::init('User'); - } - - function endTest() { - unset($this->User); - ClassRegistry::flush(); - } - -} -?> \ No newline at end of file diff --git a/app/Test/Fixture/container_fixture.php b/app/Test/Fixture/container_fixture.php deleted file mode 100755 index 2995eac..0000000 --- a/app/Test/Fixture/container_fixture.php +++ /dev/null @@ -1,32 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), - 'user_Id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), - 'name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 36, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'slug' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 40, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'container_item_count' => array('type' => 'integer', 'null' => true, 'default' => '0', 'length' => 10), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'category' => array('column' => 'category_id', 'unique' => 0), 'user' => array('column' => 'user_Id', 'unique' => 0)), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB') - ); - - var $records = array( - array( - 'id' => 1, - 'category_id' => 1, - 'user_Id' => 1, - 'name' => 'Lorem ipsum dolor sit amet', - 'slug' => 'Lorem ipsum dolor sit amet', - 'container_item_count' => 1, - 'created' => '2011-03-02 23:11:31', - 'modified' => '2011-03-02 23:11:31' - ), - ); -} -?> \ No newline at end of file diff --git a/app/Test/Fixture/container_item_fixture.php b/app/Test/Fixture/container_item_fixture.php deleted file mode 100755 index a99b4bd..0000000 --- a/app/Test/Fixture/container_item_fixture.php +++ /dev/null @@ -1,30 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'container_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), - 'category_id' => array('type' => 'integer', 'null' => false, 'default' => '0', 'key' => 'index'), - 'title' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'body' => array('type' => 'text', 'null' => true, 'default' => NULL, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'container' => array('column' => 'container_id', 'unique' => 0), 'category' => array('column' => 'category_id', 'unique' => 0)), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB') - ); - - var $records = array( - array( - 'id' => 1, - 'container_id' => 1, - 'category_id' => 1, - 'title' => 'Lorem ipsum dolor sit amet', - 'body' => 'Lorem ipsum dolor sit amet, aliquet feugiat. Convallis morbi fringilla gravida, phasellus feugiat dapibus velit nunc, pulvinar eget sollicitudin venenatis cum nullam, vivamus ut a sed, mollitia lectus. Nulla vestibulum massa neque ut et, id hendrerit sit, feugiat in taciti enim proin nibh, tempor dignissim, rhoncus duis vestibulum nunc mattis convallis.', - 'created' => '2011-03-02 23:15:01', - 'modified' => '2011-03-02 23:15:01' - ), - ); -} -?> \ No newline at end of file diff --git a/app/Test/Fixture/tag_fixture.php b/app/Test/Fixture/tag_fixture.php deleted file mode 100755 index d3eea09..0000000 --- a/app/Test/Fixture/tag_fixture.php +++ /dev/null @@ -1,26 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'name' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'slug' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'key' => 'index', 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'slug' => array('column' => 'slug', 'unique' => 0)), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB') - ); - - var $records = array( - array( - 'id' => 1, - 'name' => 'Lorem ipsum dolor sit amet', - 'slug' => 'Lorem ipsum dolor sit amet', - 'created' => '2011-03-14 21:08:57', - 'modified' => '2011-03-14 21:08:57' - ), - ); -} -?> \ No newline at end of file diff --git a/app/Test/Fixture/user_fixture.php b/app/Test/Fixture/user_fixture.php deleted file mode 100755 index 4148988..0000000 --- a/app/Test/Fixture/user_fixture.php +++ /dev/null @@ -1,28 +0,0 @@ - array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), - 'email' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 60, 'key' => 'unique', 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'password' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 60, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'uuid' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 36, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), - 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'email' => array('column' => 'email', 'unique' => 1)), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB') - ); - - var $records = array( - array( - 'id' => 1, - 'email' => 'Lorem ipsum dolor sit amet', - 'password' => 'Lorem ipsum dolor sit amet', - 'uuid' => 'Lorem ipsum dolor sit amet', - 'created' => '2011-02-19 18:01:45', - 'modified' => '2011-02-19 18:01:45' - ), - ); -} -?> \ No newline at end of file diff --git a/app/View/Elements/app/account.ctp b/app/View/Elements/app/account.ctp index fc80582..c86328a 100755 --- a/app/View/Elements/app/account.ctp +++ b/app/View/Elements/app/account.ctp @@ -6,6 +6,7 @@ diff --git a/app/View/Elements/app/footer.ctp b/app/View/Elements/app/footer.ctp index c5893ac..6710d7f 100755 --- a/app/View/Elements/app/footer.ctp +++ b/app/View/Elements/app/footer.ctp @@ -4,6 +4,9 @@ __('Privacy Policy') => '/privacy', __('Status') => 'http://status.boxmeupapp.com' ); + if (Configure::read('Feature.api')) { + $footer_links[__('API')] = '/developer'; + } ?>