Hello, i'm struggling to understand permissions for flarum, for instance, i want to allow or disallow certain logic inside a certain tag based on permissions...
from what i understand reading the docs, i need first to create a policy...
so inside \Access\UserPolicy i have
class UserPolicy extends AbstractPolicy
{
public function canDoSomething(User $actor, User $user)
{
if (!$actor->hasPermission('justoverclock-my-namespace.canDoSomething') && $this->isSuspended($user)) {
return $this->deny();
}
return $this->allow();
}
protected function isSuspended(User $user): bool
{
return $user->suspended_until !== null
&& $user->suspended_until instanceof Carbon
&& $user->suspended_until->isFuture();
}
}
in my admin settings i have registered the permission:
.registerPermission({
icon: 'far fa-thumbs-up',
label: app.translator.trans('justoverclock-my-namespace.admin.permission.canDoSomething'),
permission: 'justoverclock-my-namespace.canDoSomething',
allowGuest: false,
}, 'moderate')
now this return always true even if in my admin settings i have only admins
also, i cannot set permissions for groups.....
why this not work?