-
|
Currently the impersonate feature in Nova is not as powerful as the package it took inspiration from https://github.com/KABBOUCHI/nova-impersonate In the above package, the method signature is like this use \Illuminate\Contracts\Auth\Authenticatable;
public function canImpersonate($impersonated = null): bool // Not sure if I can type hint $impersonated with Authenticatable
{
}
public function canBeImpersonated(Authenticatable $impersonator = null): bool
{
}In Nova Impersonate trait, the 2 methods have the same name but they currently accept no arguments. Thus less flexibility to decide when to allow impersonation public function canImpersonate()
{
return Gate::forUser($this)->check('viewNova');
}
public function canBeImpersonated()
{
return true;
}An example use case of why I want it to be the same as KABBOUCHI/nova-impersonate public function canImpersonate($impersonated = null): bool // Not sure if I can type hint $impersonated with Authenticatable
{
return $this->rank > $impersonated->rank;
} |
Beta Was this translation helpful? Give feedback.
Answered by
crynobone
May 8, 2022
Replies: 1 comment 1 reply
-
|
You may use https://github.com/KABBOUCHI/nova-impersonate |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
crynobone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You may use https://github.com/KABBOUCHI/nova-impersonate