vova07 / yii2-start

Yii2-Start application
Other
273 stars 115 forks source link

Admin-update of a permission #136

Closed nunomaduro closed 9 years ago

nunomaduro commented 9 years ago

Hey,

Any specific reason to scenario admin-update ( on permission model in rbac ) don't have 'name' on it ?

Thanks.

vova07 commented 9 years ago

Hi @nunomaduro , Yes, this is like so, because in case you change the permission name it will be like a new one, so all parents of this permission will run into an unexpected error in case it will be used with DbAuthManager just because permission name is a foreign key.

nunomaduro commented 9 years ago

That only happens if the permission have parents:

PhpManager line 579 -> throw new InvalidParamException("Unable to change the item name. The name '{$item->name}' is already used by another item.");

But ok, thank you. I will problably make a pull request the enable update name in this case ( no parents ) and disable input form in the others case ( with parents ).