mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Extracting acl model classes to their own files
This commit is contained in:
parent
57929c2be7
commit
eed6d26ab6
6 changed files with 231 additions and 140 deletions
48
lib/Cake/Model/Aco.php
Normal file
48
lib/Cake/Model/Aco.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load Model and AppModel
|
||||
*/
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
/**
|
||||
* Access Control Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Aco extends AclNode {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Aco';
|
||||
|
||||
/**
|
||||
* Binds to ARO nodes through permissions settings
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $hasAndBelongsToMany = array('Aro' => array('with' => 'Permission'));
|
||||
}
|
48
lib/Cake/Model/AcoAction.php
Normal file
48
lib/Cake/Model/AcoAction.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load Model and AppModel
|
||||
*/
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
/**
|
||||
* Action for Access Control Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class AcoAction extends AppModel {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'AcoAction';
|
||||
|
||||
/**
|
||||
* ACO Actions belong to ACOs
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $belongsTo = array('Aco');
|
||||
}
|
|
@ -21,6 +21,8 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
App::uses('Model', 'Model');
|
||||
|
||||
/**
|
||||
* Application model for Cake.
|
||||
*
|
||||
|
|
48
lib/Cake/Model/Aro.php
Normal file
48
lib/Cake/Model/Aro.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load Model and AppModel
|
||||
*/
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
/**
|
||||
* Access Request Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Aro extends AclNode {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Aro';
|
||||
|
||||
/**
|
||||
* AROs are linked to ACOs by means of Permission
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $hasAndBelongsToMany = array('Aco' => array('with' => 'Permission'));
|
||||
}
|
|
@ -1,8 +1,5 @@
|
|||
<?php
|
||||
/**
|
||||
* This is core configuration file.
|
||||
*
|
||||
* Use it to configure core behaviour ofCake.
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
|
@ -189,139 +186,3 @@ class AclNode extends AppModel {
|
|||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Access Control Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Aco extends AclNode {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Aco';
|
||||
|
||||
/**
|
||||
* Binds to ARO nodes through permissions settings
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $hasAndBelongsToMany = array('Aro' => array('with' => 'Permission'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Action for Access Control Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class AcoAction extends AppModel {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'AcoAction';
|
||||
|
||||
/**
|
||||
* ACO Actions belong to ACOs
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $belongsTo = array('Aco');
|
||||
}
|
||||
|
||||
/**
|
||||
* Access Request Object
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Aro extends AclNode {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Aro';
|
||||
|
||||
/**
|
||||
* AROs are linked to ACOs by means of Permission
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $hasAndBelongsToMany = array('Aco' => array('with' => 'Permission'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Permissions linking AROs with ACOs
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Permission extends AppModel {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Permission';
|
||||
|
||||
/**
|
||||
* Explicitly disable in-memory query caching
|
||||
*
|
||||
* @var boolean
|
||||
* @access public
|
||||
*/
|
||||
public $cacheQueries = false;
|
||||
|
||||
/**
|
||||
* Override default table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $useTable = 'aros_acos';
|
||||
|
||||
/**
|
||||
* Permissions link AROs with ACOs
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $belongsTo = array('Aro', 'Aco');
|
||||
|
||||
/**
|
||||
* No behaviors for this model
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $actsAs = null;
|
||||
|
||||
/**
|
||||
* Constructor, used to tell this model to use the
|
||||
* database configured for ACL
|
||||
*/
|
||||
function __construct() {
|
||||
$config = Configure::read('Acl.database');
|
||||
if (!empty($config)) {
|
||||
$this->useDbConfig = $config;
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
||||
|
|
84
lib/Cake/Model/Permission.php
Normal file
84
lib/Cake/Model/Permission.php
Normal file
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
* @since CakePHP(tm) v 0.2.9
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
/**
|
||||
* Load Model and AppModel
|
||||
*/
|
||||
App::uses('AppModel', 'Model');
|
||||
|
||||
/**
|
||||
* Permissions linking AROs with ACOs
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.model
|
||||
*/
|
||||
class Permission extends AppModel {
|
||||
|
||||
/**
|
||||
* Model name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $name = 'Permission';
|
||||
|
||||
/**
|
||||
* Explicitly disable in-memory query caching
|
||||
*
|
||||
* @var boolean
|
||||
* @access public
|
||||
*/
|
||||
public $cacheQueries = false;
|
||||
|
||||
/**
|
||||
* Override default table name
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
public $useTable = 'aros_acos';
|
||||
|
||||
/**
|
||||
* Permissions link AROs with ACOs
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $belongsTo = array('Aro', 'Aco');
|
||||
|
||||
/**
|
||||
* No behaviors for this model
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
public $actsAs = null;
|
||||
|
||||
/**
|
||||
* Constructor, used to tell this model to use the
|
||||
* database configured for ACL
|
||||
*/
|
||||
function __construct() {
|
||||
$config = Configure::read('Acl.database');
|
||||
if (!empty($config)) {
|
||||
$this->useDbConfig = $config;
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue