update phân quyền chi tiết
This commit is contained in:
@@ -47,12 +47,12 @@ class AuthItem extends \yii\db\ActiveRecord {
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'name' => 'Name',
|
||||
'name' => 'Tên quyền',
|
||||
'type' => 'Type',
|
||||
'description' => 'Description',
|
||||
'description' => 'Ghi chú',
|
||||
'rule_name' => 'Rule Name',
|
||||
'data' => 'Data',
|
||||
'created_at' => 'Created At',
|
||||
'created_at' => 'Ngày tạo',
|
||||
'updated_at' => 'Updated At',
|
||||
];
|
||||
}
|
||||
@@ -85,8 +85,17 @@ class AuthItem extends \yii\db\ActiveRecord {
|
||||
return $this->hasMany(AuthItem::className(), ['name' => 'parent'])->viaTable('auth_item_child', ['child' => 'name']);
|
||||
}
|
||||
|
||||
public static $roleArray = [
|
||||
"department" => "Phòng ban",
|
||||
"staff" => "Nhân viên",
|
||||
"area" => "Khu vực",
|
||||
"device" => "Thiết bị",
|
||||
"schedule" => "Kiểm soát truy cập",
|
||||
"logs" => "Báo cáo"
|
||||
];
|
||||
|
||||
public static function roleArray() {
|
||||
$ls = self::find()->all();
|
||||
$ls = self::find()->andWhere(['type' => 1])->all();
|
||||
$re = [];
|
||||
foreach ($ls as $key => $value) {
|
||||
$re[$value->name] = Yii::t("app", $value->description);
|
||||
@@ -94,4 +103,13 @@ class AuthItem extends \yii\db\ActiveRecord {
|
||||
return $re;
|
||||
}
|
||||
|
||||
public function getChildList() {
|
||||
$ls = AuthItemChild::find()->andWhere(['parent' => $this->name])->all();
|
||||
$re = [];
|
||||
foreach ($ls as $key => $value) {
|
||||
$re[] = $value->child;
|
||||
}
|
||||
return $re;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user