Laravel AT Protocol Client (alpha & unstable)
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow BackedEnum for collection parameter in ScopeChecker methods

+5 -2
+5 -2
src/Auth/ScopeChecker.php
··· 2 2 3 3 namespace SocialDept\AtpClient\Auth; 4 4 5 + use BackedEnum; 5 6 use Illuminate\Support\Facades\Log; 6 7 use SocialDept\AtpClient\Enums\Scope; 7 8 use SocialDept\AtpClient\Enums\ScopeEnforcementLevel; ··· 197 198 /** 198 199 * Check if the session has repo access for a specific collection and action. 199 200 */ 200 - public function checkRepoScope(Session $session, string $collection, string $action): bool 201 + public function checkRepoScope(Session $session, string|BackedEnum $collection, string $action): bool 201 202 { 203 + $collection = $collection instanceof BackedEnum ? $collection->value : $collection; 202 204 $required = "repo:{$collection}?action={$action}"; 203 205 204 206 return $this->sessionHasScope($session, $required); ··· 209 211 * 210 212 * @throws MissingScopeException 211 213 */ 212 - public function checkRepoScopeOrFail(Session $session, string $collection, string $action): void 214 + public function checkRepoScopeOrFail(Session $session, string|BackedEnum $collection, string $action): void 213 215 { 216 + $collection = $collection instanceof BackedEnum ? $collection->value : $collection; 214 217 $required = "repo:{$collection}?action={$action}"; 215 218 216 219 $this->checkOrFail($session, [$required]);