Skip to content

Commit

Permalink
fix AuthItemModel
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-chepurnoi committed Nov 28, 2017
1 parent c319dd1 commit 6f48971
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/AuthItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function rules(): array
[['name', 'description', 'data', 'ruleName'], 'trim'],
[['name', 'type'], 'required'],
['ruleName', 'checkRule'],
['name', 'unique', 'when' => function () {
['name', 'validateName', 'when' => function () {
return $this->getIsNewRecord() || ($this->_item->name != $this->name);
}],
['type', 'integer'],
Expand All @@ -96,9 +96,9 @@ public function rules(): array
}

/**
* Check role is unique
* Validate item name
*/
public function unique()
public function validateName()
{
$value = $this->name;
if ($this->manager->getRole($value) !== null || $this->manager->getPermission($value) !== null) {
Expand Down

0 comments on commit 6f48971

Please sign in to comment.