Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit 51a7aa0

Browse files
committed
Clean up ItemForm, updated changelog v1.1
1 parent 80b5d4d commit 51a7aa0

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=====================
33

4+
v1.1
5+
---------------------
6+
* Role permission selector now have better UI with real trees.
7+
* Bugfix: Item name validation not allow '*'.
8+
49
v1.0.1
510
---------------------
611
* Disable inherit permissions in role permissions selector.

src/forms/ItemForm.php

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -63,51 +63,7 @@ public function attributeLabels()
6363
*/
6464
public static function getNamePattern()
6565
{
66-
return '/^[a-z0-9\s\_\-\/]+$/i';
66+
return '/^[a-z0-9\s\_\-\/\*]+$/i';
6767
}
6868

69-
///=======================
70-
/// TODO: regactor below
71-
72-
/**
73-
* @param array $array_parent
74-
* @param array $params
75-
* @param bool $permission
76-
* @return bool
77-
*/
78-
public function addChildrenArray(array $array_parent, array $params, $permission = true)
79-
{
80-
foreach ($array_parent as $name) {
81-
82-
if ($permission) {
83-
$item = Yii::$app->authManager->getPermission($name);
84-
}else{
85-
$item = Yii::$app->authManager->getRole($name);
86-
}
87-
88-
if (isset($params['child'])) {
89-
Yii::$app->authManager->addChild($item, $params['child']);
90-
}elseif (isset($params['parent'])){
91-
Yii::$app->authManager->addChild($params['parent'], $item);
92-
}else{
93-
return false;
94-
}
95-
}
96-
97-
return true;
98-
}
99-
100-
/**
101-
* @param array $array_parent
102-
* @param $child
103-
* @return bool
104-
*/
105-
public function removeChildrenArray(array $array_parent, $child)
106-
{
107-
foreach ($array_parent as $parent){
108-
Yii::$app->authManager->removeChild($parent, $child);
109-
}
110-
111-
return true;
112-
}
11369
}

0 commit comments

Comments
 (0)