|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * This is Acl Schema file |
| 4 | + * |
| 5 | + * Use it to configure database for ACL |
| 6 | + * |
| 7 | + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) |
| 8 | + * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
| 9 | + * |
| 10 | + * Licensed under The MIT License |
| 11 | + * For full copyright and license information, please see the LICENSE.txt |
| 12 | + * Redistributions of files must retain the above copyright notice. |
| 13 | + * |
| 14 | + * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) |
| 15 | + * @link http://cakephp.org CakePHP(tm) Project |
| 16 | + * @package app.Config.Schema |
| 17 | + * @since CakePHP(tm) v 0.2.9 |
| 18 | + * @license http://www.opensource.org/licenses/mit-license.php MIT License |
| 19 | + */ |
| 20 | + |
| 21 | +/** |
| 22 | + * Using the Schema command line utility |
| 23 | + * cake schema run create DbAcl |
| 24 | + * |
| 25 | + */ |
| 26 | +class DbAclSchema extends CakeSchema { |
| 27 | + |
| 28 | +/** |
| 29 | + * Before event. |
| 30 | + * |
| 31 | + * @param array $event The event data. |
| 32 | + * @return bool Success |
| 33 | + */ |
| 34 | + public function before($event = array()) { |
| 35 | + return true; |
| 36 | + } |
| 37 | + |
| 38 | +/** |
| 39 | + * After event. |
| 40 | + * |
| 41 | + * @param array $event The event data. |
| 42 | + * @return void |
| 43 | + */ |
| 44 | + public function after($event = array()) { |
| 45 | + } |
| 46 | + |
| 47 | +/** |
| 48 | + * ACO - Access Control Object - Something that is wanted |
| 49 | + */ |
| 50 | + public $acos = array( |
| 51 | + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), |
| 52 | + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 53 | + 'model' => array('type' => 'string', 'null' => true), |
| 54 | + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 55 | + 'alias' => array('type' => 'string', 'null' => true), |
| 56 | + 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 57 | + 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 58 | + 'indexes' => array( |
| 59 | + 'PRIMARY' => array('column' => 'id', 'unique' => 1), |
| 60 | + 'idx_acos_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0), |
| 61 | + 'idx_acos_alias' => array('column' => 'alias', 'unique' => 0) |
| 62 | + ) |
| 63 | + ); |
| 64 | + |
| 65 | +/** |
| 66 | + * ARO - Access Request Object - Something that wants something |
| 67 | + */ |
| 68 | + public $aros = array( |
| 69 | + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), |
| 70 | + 'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 71 | + 'model' => array('type' => 'string', 'null' => true), |
| 72 | + 'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 73 | + 'alias' => array('type' => 'string', 'null' => true), |
| 74 | + 'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 75 | + 'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10), |
| 76 | + 'indexes' => array( |
| 77 | + 'PRIMARY' => array('column' => 'id', 'unique' => 1), |
| 78 | + 'idx_aros_lft_rght' => array('column' => array('lft', 'rght'), 'unique' => 0), |
| 79 | + 'idx_aros_alias' => array('column' => 'alias', 'unique' => 0) |
| 80 | + ) |
| 81 | + ); |
| 82 | + |
| 83 | +/** |
| 84 | + * Used by the Cake::Model:Permission class. |
| 85 | + * Checks if the given $aro has access to action $action in $aco. |
| 86 | + */ |
| 87 | + public $aros_acos = array( |
| 88 | + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'), |
| 89 | + 'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'), |
| 90 | + 'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10), |
| 91 | + '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), |
| 92 | + '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), |
| 93 | + '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), |
| 94 | + '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2), |
| 95 | + 'indexes' => array( |
| 96 | + 'PRIMARY' => array('column' => 'id', 'unique' => 1), |
| 97 | + 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1), |
| 98 | + 'idx_aco_id' => array('column' => 'aco_id', 'unique' => 0) |
| 99 | + ) |
| 100 | + ); |
| 101 | + |
| 102 | +} |
0 commit comments