Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role and Permission name validation #145

Open
ale1981 opened this issue Nov 22, 2020 · 1 comment
Open

Role and Permission name validation #145

ale1981 opened this issue Nov 22, 2020 · 1 comment

Comments

@ale1981
Copy link

ale1981 commented Nov 22, 2020

The validation on the Role and Permission name field is wrong, you can have a Role or Permission with the same name but not the same name and guard, so I believe...

            Text::make(__('nova-permission-tool::roles.name'), 'name')
                ->rules(['required', 'string', 'max:255'])
                ->creationRules('unique:'.config('permission.table_names.roles'))
                ->updateRules('unique:'.config('permission.table_names.roles').',name,{{resourceId}}'),

should be ...


            Text::make(__('nova-permission-tool::roles.name'), 'name')
                ->rules(['required', 'string', 'max:255'])
                ->creationRules('unique:'.config('permission.table_names.roles').',name,,,guard_name,'.$request->guard_name)
                ->updateRules('unique:'.config('permission.table_names.roles').',name,{{resourceId}},id,guard_name,'.$request->guard_name),
@FrancoFourmantin
Copy link

+1 This is a problem when you have two guards and the same permission name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants