#Permission access on a tenant panel

4 messages · Page 1 of 1 (latest)

stoic fog
#

I'm completely bashing my head against a wall here. Im currently unable to authenticate and its due to failing the user ->canAccessPanel() function.

My use case is I have an Admin Panel, an admin created a role, I can see that role is a team_id set. Then trying to authenticate into Panel B, it fails the check on the role that I've created.

The use case is that Panel B has a whole separate structure and should be able to see content based on the content created in the Admin Panel by matching the tenant.

$this->roles returns empty, but I can query the Role model directly as a test to see the record.

This is where im at so far with the check

    protected function canAccessInstructorPanel(): bool
    {

        // $registrar = app(PermissionRegistrar::class);

        $tenantIds = $this->entities()->pluck('id');

        foreach ($tenantIds as $tenantId) {
            app(PermissionRegistrar::class)->setPermissionsTeamId($tenantId);

            if (
                $this->hasRole(BaseRolesEnum::INSTRUCTOR->value, 'web') ||
                $this->can('access-instructor-panel') ||
                $this->checkPermissionTo('Booking.*')
            ) {
                return true;
            }
        }

        return false;
    }
covert aspenBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

stoic fog
#

I have this part of my login

        if (
            ($user instanceof FilamentUser) &&
            (! $user->canAccessPanel(Filament::getCurrentPanel()))
        ) {
            dd(Filament::getCurrentPanel()->getId(), $user->canAccessPanel(Filament::getCurrentPanel()));

And the latter dump returns false, the first part does return my Panel B correctly

low rivet