diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e14f47..7bf8206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog ============== +1.0.2 +----------------- + * Fixed bugs + 1.0.1 ----------------- * To read app configs diff --git a/controllers/AdminPermissionController.php b/controllers/AdminPermissionController.php index 1540ea0..21d2761 100644 --- a/controllers/AdminPermissionController.php +++ b/controllers/AdminPermissionController.php @@ -165,7 +165,10 @@ public function actionView() if (in_array($name, $children)) { continue; } - $avaliable[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name . ' — ' . $role->description;; + if (isset($name[0])) + { + $avaliable[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name . ' — ' . $role->description; + } } foreach ($authManager->getChildren($id) as $name => $child) { $assigned[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name . ' — ' . $child->description;; diff --git a/controllers/AdminRoleController.php b/controllers/AdminRoleController.php index 12a872e..276e4ef 100644 --- a/controllers/AdminRoleController.php +++ b/controllers/AdminRoleController.php @@ -126,7 +126,11 @@ public function actionView() if (in_array($name, $children)) { continue; } - $avaliable[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name . ' — ' . $role->description; + + if (isset($name[0])) + { + $avaliable[$name[0] === '/' ? 'Routes' : 'Permission'][$name] = $name . ' — ' . $role->description; + } } foreach ($authManager->getChildren($id) as $name => $child) { if ($child->type == Item::TYPE_ROLE) { diff --git a/models/AuthItem.php b/models/AuthItem.php index 7c3515b..e3feb99 100644 --- a/models/AuthItem.php +++ b/models/AuthItem.php @@ -8,6 +8,7 @@ namespace skeeks\cms\rbac\models; use Yii; +use yii\helpers\ArrayHelper; use yii\rbac\Item; use yii\helpers\Json; /** @@ -58,6 +59,7 @@ public function rules() [['ruleName'], 'in', 'range' => array_keys(Yii::$app->authManager->getRules()), 'message' => 'Rule not exists'], + //[['name'], 'unique', 'targetAttribute' => array_keys(ArrayHelper::map(\Yii::$app->authManager->getRoles(), 'name', 'name')) ], [['name', 'type'], 'required'], [['type'], 'integer'], [['description', 'data', 'ruleName'], 'default'], diff --git a/views/admin-permission/_form.php b/views/admin-permission/_form.php index 74a9639..18a690d 100644 --- a/views/admin-permission/_form.php +++ b/views/admin-permission/_form.php @@ -43,7 +43,7 @@ ]) ?> - field($model, 'data')->textarea(['rows' => 6, 'readonly' => 'readonly'])->label(\Yii::t('app','Data')) ?> + field($model, 'data')->textarea(['rows' => 6, 'readonly' => 'readonly'])->label(\Yii::t('app','Data')) */?> buttonsCreateOrUpdate($model); ?> diff --git a/views/admin-role/_form.php b/views/admin-role/_form.php index c0ea70f..f371b04 100644 --- a/views/admin-role/_form.php +++ b/views/admin-role/_form.php @@ -24,7 +24,7 @@ ]) */?> - field($model, 'data')->textarea(['rows' => 6, 'readonly' => 'readonly'])->label(\Yii::t('app','Data')) ?> + field($model, 'data')->textarea(['rows' => 6, 'readonly' => 'readonly'])->label(\Yii::t('app','Data')) */?> buttonsCreateOrUpdate($model); ?>