tankerkiller125
I see, thanks, that makes sense.
Would I add a similar code snippet to the extend.php
of my extension or where would I put that, so Flarum understands it?
Snippet from Documentation
app.initializers.add('interstellar', function(app) {
app.extensionData
.for('acme-interstellar')
.registerPermission(
{
icon: 'fas fa-rocket', // Font-Awesome Icon
label: app.translator.trans('acme-interstellar.admin.permissions.fly_rockets_label'), // Permission Label
permission: 'discussion.rocket_fly', // Actual permission name stored in database (and used when checking permission).
tagScoped: true, // Whether it be possible to apply this permission on tags, not just globally. Explained in the next paragraph.
},
'start', // Category permission will be added to on the grid
95 // Optional: Priority
);
});
I now checked all the related documentation, looked at other extensions to get an idea by example, though I'm not sure how to implement this. Where exactly do I put the permission setting? Where & how exactly would I ask, whether the user has the permission? Wouldn't the post validator need access to the current User
instance?
I would appreciate specific examples on how this would work in my extension.
https://github.com/theAkito/flarum-limit-post-length
Been trying to figure out how to implement this & it won't budge. All I want is a getActor
in the configuration for new Extend\Validator(PostValidator::class)
, but it does not seem to be possible & I don't know how I would tell the validation to skip the character limit, when the callback is registered without an if
telling it to skip on certain conditions.