forked from crisu83/yii-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthItemForm.php
63 lines (60 loc) · 1.39 KB
/
AuthItemForm.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* AuthItemForm class file.
* @author Christoffer Niska <[email protected]>
* @copyright Copyright © Christoffer Niska 2012-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package auth.models
*/
/**
* Form model for updating an authorization item.
*/
class AuthItemForm extends CFormModel
{
/**
* @var string item name.
*/
public $name;
/**
* @var string item description.
*/
public $description;
/**
* @var string business rule associated with the item.
*/
public $bizrule;
/**
* @var string additional data for the item.
*/
public $data;
/**
* @var string the item type (0=operation, 1=task, 2=role).
*/
public $type;
/**
* Returns the attribute labels.
* @return array attribute labels (name=>label)
*/
public function attributeLabels()
{
return array(
'name' => Yii::t('AuthModule.main', 'System name'),
'description' => Yii::t('AuthModule.main', 'Description'),
'bizrule' => Yii::t('AuthModule.main', 'Business rule'),
'data' => Yii::t('AuthModule.main', 'Data'),
'type' => Yii::t('AuthModule.main', 'Type'),
);
}
/**
* Returns the validation rules for attributes.
* @return array validation rules.
*/
public function rules()
{
return array(
array('description, type', 'required'),
array('name', 'required', 'on' => 'create'),
array('name', 'length', 'max' => 64),
);
}
}