Assignments.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Assignments class file.
  4. *
  5. * @author Spyros Soldatos <spyros@valor.gr>
  6. * @link http://code.google.com/p/srbac/
  7. */
  8. /**
  9. * Assignments model is the authManager model that defines which operations /
  10. * tasks / roles are assigned to which user.
  11. *
  12. * @author Spyros Soldatos <spyros@valor.gr>
  13. * @package srbac.models
  14. * @since 1.0.0
  15. */
  16. class Assignments extends CActiveRecord {
  17. /**
  18. * The followings are the available columns in table 'authassignment':
  19. * @var string $itemname
  20. * @var string $userid
  21. * @var string $bizrule
  22. * @var string $data
  23. */
  24. /**
  25. * Returns the static model of the specified AR class.
  26. * @return CActiveRecord the static model class
  27. */
  28. public static function model($className=__CLASS__) {
  29. return parent::model($className);
  30. }
  31. public function getDbConnection() {
  32. return Yii::app()->authManager->db;
  33. }
  34. /**
  35. * @return string the associated database table name
  36. */
  37. public function tableName() {
  38. return Yii::app()->authManager->assignmentTable;
  39. }
  40. /**
  41. * @return array validation rules for model attributes.
  42. */
  43. public function rules() {
  44. return array(
  45. array('itemname','length','max'=>64),
  46. array('userid','length','max'=>64),
  47. array('itemname, userid', 'required'),
  48. array('user_id,itemname,bizrule,data','safe'),
  49. );
  50. }
  51. /**
  52. * @return array relational rules.
  53. */
  54. public function relations() {
  55. // NOTE: you may need to adjust the relation name and the related
  56. // class name for the relations automatically generated below.
  57. return array(
  58. );
  59. }
  60. /**
  61. * @return array customized attribute labels (name=>label)
  62. */
  63. public function attributeLabels() {
  64. return array(
  65. 'itemname'=>Helper::translate('srbac','Itemname'),
  66. 'userid'=>Helper::translate('srbac','User id'),
  67. 'bizrule'=>Helper::translate('srbac','Bizrule'),
  68. 'data'=>Helper::translate('srbac','Data'),
  69. );
  70. }
  71. }