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?
I
ifox354d ago
Hi @.zeenux did you add a module to the configuration? Do you see Roles management in the CMS users section?
Z
.zeenux354d ago
No i can't see it. i did add a module to the config
I
ifox354d ago
ok so the feature isn't enabled
Z
.zeenux354d ago
'modules' => ['posts'],
I
ifox354d ago
can you share your config?
Z
.zeenux354d ago
'enabled' => [ 'permissions-management' ], 'permissions' => [ 'level' => \A17\Twill\Enums\PermissionLevel::LEVEL_ROLE, 'modules' => ['posts'], ],
I
ifox354d ago
oh you need a boolean value in enabled
Z
.zeenux354d ago
like 'enabled'=[ ?=true]
I
ifox354d ago
'permissions-management' => true
Z
.zeenux354d ago
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
I
ifox354d ago
does your posts module have a morphmap?
Z
.zeenux354d ago
no
I
ifox354d ago
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
Z
.zeenux354d ago
can't find the documentation on morphmap
I
ifox354d ago
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.
Z
.zeenux354d ago
I know laravel morphtomany. However i don't have a permission model to reference to
I
ifox354d ago
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
Z
.zeenux354d ago
so defined in AppServiceProvider boot method Relation::enforceMorphMap([ 'post' => 'App\Models\Post',
]); Still doesn't work
I
ifox354d ago
https://discord.com/channels/811936425858695198/1105835250636030082/1105835732964212817 you used posts here, so you should use posts in the morphmap too
Z
.zeenux354d ago
'modules' => ['post'], not working still.
I
ifox354d ago
use posts, since that's the name of your module (plural model name). and did you migrate after fixing your enabled config?
Z
.zeenux354d ago
i ran the migration, but can't see roles management in the dashboard
I
ifox354d ago
here's the code that adds a "Roles" section to the users navigation:
NavigationLink::make()->title(twillTrans('twill::lang.permissions.roles.title'))
->forModule('roles')
->onlyWhen(
fn() => config('twill.enabled.permissions-management') && Auth::user()->can('edit-user-roles')
)
NavigationLink::make()->title(twillTrans('twill::lang.permissions.roles.title'))
->forModule('roles')
->onlyWhen(
fn() => config('twill.enabled.permissions-management') && Auth::user()->can('edit-user-roles')
)
so if config('twill.enabled.permissions-management') is true and I assume that you're logged in as a superadmin, you should definitely see it
Z
.zeenux354d ago
sorry to be a bother but still nothing.
No description
I
ifox354d ago
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
Z
.zeenux354d ago
RoleGroupItem
I
ifox354d ago
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.
Z
.zeenux354d ago
LEVEL_ROLE_GROUP_ITEM
I
ifox354d ago
yes
Z
.zeenux354d ago
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
I
ifox354d ago
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
Want results from more Discord servers?
Add your server
More Posts
Updating Translations from the Command LineHi all, as usual I assume I'm misunderstanding something basic about how Laravel works, but I have bPreview ModulesHey how do you go about previewing modules? There is not a lot of documentation available. How do yoLegacy Settings Sections return values doesn't workHi, After save Settings to database, values doesn't bind in inputs. How fixed this @ifox.dev ?New module item errorWhen i make a new module i get this error, i'm using the twill metadata pacakage ```Object { messagCustom form fieldsI'm trying to make a custom form field to override the custom WYSIWYG form field. I've followed thiNew Settings approachHey, a i have a small question - how build a settings page like in https://demo.twill.io/settings/seRender repeater in block blade fileI have made a block named "gallery" with a repeater containing medias named "gallery-item", please hFetch all images in a blockHow do you fetch all the images in a block? For e.g i have this block <x-twill::medias name="slRepeater without blocksHow do you add and render a repeater without including it in the block?Adding custom blocks to modulesHow do you add custom blocks to modules? Generally i add blocks to a module using $form->add(BlockEd$renderData returns null when trying to render nestedblocks@php /** @var \A17\Twill\Services\Blocks\RenderData $renderData */ dd($renderData) Fetch all models with field value of XSorry to ask such a basic question but I want to do the following.... I have a model called Work (anDisplaying Block elements on the Front Pagehow do you display block elements on the frontpage? And i don't mean the preview file. I want to accdashboard routeHello. I have a problem with dashboard config I have a Category and CategoryArticle Models I have aTwill Role based accessHow would i go about adding a Role based access to CMS Components and its entries. For e.g in an imaTwill assets errorHello to everyone i have an website in production builded in twill but some twill assets in there aWhere to find block repositories?I've seen in the tutorial(https://www.youtube.com/watch?v=kAcJ5G2GhiA) some blocks like "paragraph &[3.0.0] Block class - getBlockTitle()Hi, I was trying to move Blade blocks to Class. When I wanted to move `@twillBlockTitleField` in cla[3.0.0] componentBlock overriding getBlockIcon doesn't seem to work?(Successfully changed the title by overriding it's static function) Checked twill:list:icon for the[3.0.0] Maintaining automated Permalink Generation when using getCreateForm to add fields.As soon as I add any fields, using the Formbuilder on this function, the automated permalink disappe