[ Index ]

PHP Cross Reference of ACL Module

title

Body

[close]

/models/ -> Permission.php (source)

   1  <?php
   2  
   3  /**

   4   * This is the model class for table "{{permission}}".

   5   * 

   6   * Permissions are the link between Access Control Objects, Access Request Objects

   7   * and Actions. Permission define who can perform what on whom. 

   8   * Permissions (currently) work only positively, so if you deny rights you take

   9   * back already granted rights, but you don't explicitely deny rights. 

  10   * 

  11   * Especially if a user has a permission perform something on a specific object

  12   * because he is the child of a class which has the permission, denying the

  13   * permission to the user will _not_ affect the permissions of the group. 

  14   * 

  15   * @author dispy <dispyfree@googlemail.com>

  16   * @package acl.base

  17   * @license LGPLv2

  18   *

  19   * The followings are the available columns in table '{{permission}}':

  20   * @property integer $id

  21   * @property integer $aco_id

  22   * @property integer $aro_id

  23   * @property integer $aco_path

  24   * @property integer $aro_path

  25   * @property integer $action_id

  26   */
  27  class Permission extends CActiveRecord
  28  {
  29      
  30      /**

  31       * Returns the static model of the specified AR class.

  32       * @param string $className active record class name.

  33       * @return Permission the static model class

  34       */
  35      public static function model($className=__CLASS__)
  36      {
  37          return parent::model($className);
  38      }
  39  
  40      /**

  41       * @return string the associated database table name

  42       */
  43      public function tableName()
  44      {
  45          return '{{permission}}';
  46      }
  47  
  48      /**

  49       * @return array validation rules for model attributes.

  50       */
  51      public function rules()
  52      {
  53          // NOTE: you should only define rules for those attributes that

  54          // will receive user inputs.

  55          return array(
  56          );
  57      }
  58  
  59      /**

  60       * @return array relational rules.

  61       */
  62      public function relations()
  63      {
  64          // NOTE: you may need to adjust the relation name and the related

  65          // class name for the relations automatically generated below.

  66          //

  67          return array(
  68              'acoNode' => array(static::BELONGS_TO, Strategy::getClass('AcoNode'), 'aco_id'),
  69              'aroNode' => array(static::BELONGS_TO, Strategy::getClass('AroNode'), 'aro_id'),
  70              'action' => array(static::BELONGS_TO, 'Action', 'action_id')
  71          );
  72      }
  73  
  74      /**

  75       * @return array customized attribute labels (name=>label)

  76       */
  77      public function attributeLabels()
  78      {
  79          return array(
  80              'id' => 'ID',
  81              'aco_id' => 'Aco',
  82              'aro_id' => 'Aro',
  83              'aco_path' => 'Aco Path',
  84              'aro_path' => 'Aro Path',
  85              'action_id' => 'Action',
  86          );
  87      }
  88  
  89      /**

  90       * Retrieves a list of models based on the current search/filter conditions.

  91       * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.

  92       */
  93      public function search()
  94      {
  95          // Warning: Please modify the following code to remove attributes that

  96          // should not be searched.

  97  
  98          $criteria=new CDbCriteria;
  99  
 100          $criteria->compare('id',$this->id);
 101          $criteria->compare('aco_id',$this->aco_id);
 102          $criteria->compare('aro_id',$this->aro_id);
 103          $criteria->compare('action_id',$this->action_id);
 104  
 105          return new CActiveDataProvider($this, array(
 106              'criteria'=>$criteria,
 107          ));
 108      }
 109      
 110      /**

 111       * Clones the object - resets the ID so that it is in fact a new object 

 112       * in the database also

 113       */
 114      public function __clone(){
 115          $this->id = NULL;
 116          $this->isNewRecord = true;
 117      }
 118  } 
 119  
 120  ?>


Generated: Sun Jul 1 19:24:45 2012 Cross-referenced by PHPXref 0.7.1