Replies: 2 comments
-
and I found that auth()->user()->moonshine_user_role_id === MoonshineUserRole::DEFAULT_ROLE_ID which it = 1 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi! I have not encountered such a problem, but you can copy MoonShineUserResource in the app/MoonShine/Resources and use it in your own way, most importantly do not forget to replace it in the MoonShineServiceProvider |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I found that superadmin (user()->id == 1) can not set permission for another user, and when I dig more to MoonShineUserResource (vendor/moonshine/moonshine/src/Resources/MoonShineUserResource.php) i got this public function components(): array only can set permission for user with id = 1.
return [
PermissionFormComponent::make('Permissions')
->canSee(fn ($user) => $user->moonshine_user_role_id === MoonshineUserRole::DEFAULT_ROLE_ID), // <--- this line make permission oly visible for admin user
ChangeLogFormComponent::make('Change log')
->canSee(fn ($user) => $user->moonshine_user_role_id === MoonshineUserRole::DEFAULT_ROLE_ID),
];
so to make admin can set permission for another user I change it to:
->canSee(fn ($user) => auth()->user()->id === MoonshineUserRole::DEFAULT_ROLE_ID),
any reason why is not work using role_id ??
Beta Was this translation helpful? Give feedback.
All reactions