1 | <?php |
||
17 | class ImpersonationPolicy extends Policy |
||
18 | { |
||
19 | /* ----------------------------------------------------------------- |
||
20 | | Main Methods |
||
21 | | ----------------------------------------------------------------- |
||
22 | */ |
||
23 | |||
24 | /** |
||
25 | * Get the ability's prefix. |
||
26 | * |
||
27 | * @return string |
||
28 | */ |
||
29 | 168 | protected static function prefix(): string |
|
33 | |||
34 | 168 | public function abilities(): iterable |
|
52 | |||
53 | /* ----------------------------------------------------------------- |
||
54 | | Policies |
||
55 | | ----------------------------------------------------------------- |
||
56 | */ |
||
57 | |||
58 | /** |
||
59 | * Check if the current user can impersonate. |
||
60 | * |
||
61 | * @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable|\Illuminate\Foundation\Auth\User $user |
||
62 | * |
||
63 | * @return bool |
||
64 | */ |
||
65 | 36 | public function canImpersonate(User $user) |
|
70 | |||
71 | /** |
||
72 | * Check if the given user can be impersonated. |
||
73 | * |
||
74 | * @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable|\Illuminate\Foundation\Auth\User $user |
||
75 | * @param \Arcanedev\LaravelImpersonator\Contracts\Impersonatable $impersonated |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | 36 | public function canBeImpersonated(User $user, Impersonatable $impersonated) |
|
84 | |||
85 | /* ----------------------------------------------------------------- |
||
86 | | Other Methods |
||
87 | | ----------------------------------------------------------------- |
||
88 | */ |
||
89 | |||
90 | /** |
||
91 | * Check if the impersonation is enabled. |
||
92 | * |
||
93 | * @return bool |
||
94 | */ |
||
95 | 36 | private function isEnabled() |
|
99 | } |
||
100 |