Twill advanced permissions
I've followed the documentation with regard to adding the enabled and permission key to config/twill.php. I ran the migrations, although it reported back there were no migrations. However i don't see the permissions tab in my module. What am i missing?
33 Replies
Hi @.zeenux did you add a module to the configuration? Do you see Roles management in the CMS users section?
No i can't see it.
i did add a module to the config
ok so the feature isn't enabled
'modules' => ['posts'],
can you share your config?
'enabled' => [
'permissions-management'
],
'permissions' => [
'level' => \A17\Twill\Enums\PermissionLevel::LEVEL_ROLE,
'modules' => ['posts'],
],
oh you need a boolean value in enabled
like 'enabled'=[ ?=true]
'permissions-management' => true
Call to a member function permissions() on string Error now.
Call to a member function permissions() on string (View: /var/www/html/twill_perms/vendor/area17/twill/views/layouts/main.blade.php
does your posts module have a morphmap?
no
so you cant reference it with just 'posts'
you can use the fully qualified model instead, but I'd recommend you to use morphmaps on all your models
can't find the documentation on morphmap
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
I know laravel morphtomany. However i don't have a permission model to reference to
it isn't about twill permission model, it is about your own post model
if you haven't defined a morphmap mapping 'posts' to your Post model Laravel and subsequently Twill won't find it
so defined in AppServiceProvider boot method Relation::enforceMorphMap([
'post' => 'App\Models\Post',
]); Still doesn't work
]); Still doesn't work
https://discord.com/channels/811936425858695198/1105835250636030082/1105835732964212817
you used
posts
here, so you should use posts
in the morphmap too'modules' => ['post'], not working still.
use
posts
, since that's the name of your module (plural model name). and did you migrate after fixing your enabled
config?i ran the migration, but can't see roles management in the dashboard
here's the code that adds a "Roles" section to the users navigation:
so if
config('twill.enabled.permissions-management')
is true and I assume that you're logged in as a superadmin, you should definitely see itsorry to be a bother but still nothing.
i'm talking about the CMS users section, not a record of your own module
and you won't see any change at the record level if you don't use the highest level of permissions available
RoleGroupItem
right now you are using the ROLE level, which is:
When using the permission level role users will be given a role. Roles can be managed from the admin interface subnavigation when managing users.
LEVEL_ROLE_GROUP_ITEM
yes
That did it. Thanks a million for the patient support. Can i disable the email notification that goes after registering a user?
No morph map defined for model [A17\Twill\Models\Role].
Added a morphmap for role and it works
if you don't enable the user and register it yourself from the cms before enabling, I don't think they are notified
that's because you used
enforceMorphMap
you can use ::morphMap
if you don't want to have to register Twill internal models
but that's something we should address