laravel-permission icon indicating copy to clipboard operation
laravel-permission copied to clipboard

Support guard_name on middleware

Open erikn69 opened this issue 2 years ago • 1 comments

I add some tests When a model uses more than one guard, it seems that the permissions cannot be reached

I don't know if it is an issue or expected behavior


Also, on next test, testRole has web guard_name, but login and roleMiddleware uses api, give me 200,Shouldn't it be 403?

/** @test */
public function multiple_guard_user_can_access_role_while_login_using_specific_guard2(): void
{
    config()->set('auth.guards.api.driver', 'session');
    Auth::guard('api')->login($this->testUser);

    $this->testUser->assignRole('testRole');

    $this->assertEquals(
        403,
        $this->runMiddleware($this->roleMiddleware, 'testRole', 'api')
    );
}

erikn69 avatar Nov 15 '23 22:11 erikn69

Right. Good points.

Yes, should add that test for the 403.

drbyte avatar Dec 14 '23 01:12 drbyte

Dear contributor,

because this pull request seems to be inactive for quite some time now, I've automatically closed it. If you feel this pull request deserves some attention from my human colleagues feel free to reopen it.

spatie-bot avatar Apr 15 '24 10:04 spatie-bot