Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Mar 22, 2024
1 parent ef0cf90 commit bf40703
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 64 deletions.
5 changes: 0 additions & 5 deletions src/Can.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,6 @@ public function access(?Authenticatable $user, array $options = []): Permission
if ($this->isGuest($this->user)) {
$permission->markIsGuest();
}
// dump([
// '$isGuest' => $isGuest,
// '$permission' => $permission,
// '$user' => $user,
// ]);

if ($permission->isGuest()) {
// Deny if guest is not permitted
Expand Down
21 changes: 0 additions & 21 deletions src/Issuer.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,6 @@ protected function compileAbilitiesByGroup(string $group): array
}
}

// dump([
// '__METHOD__' => __METHOD__,
// '$group' => $group,
// '$abilities' => $abilities,
// '$package_abilities' => $package_abilities,
// '$this->rootAccessGroups' => $this->rootAccessGroups,
// '$this->rootAbilities' => $this->rootAbilities,
// '$this->isRoot' => $this->isRoot,
// '$this->isAdmin' => $this->isAdmin,
// '$this->isManager' => $this->isManager,
// '$this->isUser' => $this->isUser,
// '$this->isGuest' => $this->isGuest,
// ]);
return $abilities;
}

Expand Down Expand Up @@ -360,11 +347,6 @@ public function authorize(Authenticatable $user): array
} else {
$tokens = [];
}
// dd([
// '$tokens' => $tokens,
// '$this->useSanctum' => $this->useSanctum,
// '$this->hasSanctum' => $this->hasSanctum,
// ]);

return $tokens;
}
Expand All @@ -378,9 +360,6 @@ public function sanctum(Authenticatable $user): array
* @var array<string, mixed> $config
*/
$config = config('playground-auth.token');
// dump([
// '$config' => $config,
// ]);

$this->init($user);

Expand Down
22 changes: 0 additions & 22 deletions src/Policies/ModelPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ public function delete(
*/
public function detail(Authenticatable $user, Model $model): bool|Response
{
// dd([
// '__METHOD__' => __METHOD__,
// '__FILE__' => __FILE__,
// '__LINE__' => __LINE__,
// 'static::class' => static::class,
// '$user' => $user->toArray(),
// '$this->allowRootOverride' => $this->allowRootOverride,
// '$this->package' => $this->package,
// '$this->entity' => $this->entity,
// 'config(playground-auth)' => config('playground-auth'),
// ]);
return $this->verify($user, 'view');
}

Expand Down Expand Up @@ -120,17 +109,6 @@ public function store(Authenticatable $user): bool|Response
*/
public function update(Authenticatable $user, Model $model): bool|Response
{
// dd([
// '__METHOD__' => __METHOD__,
// '__FILE__' => __FILE__,
// '__LINE__' => __LINE__,
// 'static::class' => static::class,
// '$user' => $user->toArray(),
// '$this->allowRootOverride' => $this->allowRootOverride,
// '$this->package' => $this->package,
// '$this->entity' => $this->entity,
// 'config(playground-auth)' => config('playground-auth'),
// ]);
// Models must be unlocked to allow updating.
// NOTE: This lock check is bypassed by a root user.
if ($model->getAttribute('locked')) {
Expand Down
7 changes: 0 additions & 7 deletions src/Policies/PolicyTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ public function setToken(PersonalAccessToken $token = null): self
public function verify(Authenticatable $user, string $ability): bool|Response
{
$verify = config('playground-auth.verify');
// dump([
// '__METHOD__' => __METHOD__,
// '$verify' => $verify,
// '$ability' => $ability,
// '$user' => $user,
// 'test' => config('app.debug') && config('playground-auth.debug'),
// ]);
if (in_array($verify, ['policy', 'privileges', 'sanctum'])) {
return $this->hasPrivilege($user, $this->privilege($ability));
} elseif ($verify === 'roles') {
Expand Down
9 changes: 0 additions & 9 deletions src/Policies/RoleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,6 @@ public function hasRole(Authenticatable $user, string $ability): bool|Response
}
}

// dump([
// '__METHOD__' => __METHOD__,
// '$user' => $user,
// 'userRole' => config('playground-auth.userRole'),
// 'userRoles' => config('playground-auth.userRoles'),
// 'hasRole' => config('playground-auth.hasRole') && method_exists($user, 'hasRole'),
// '$ability' => $ability,
// '$roles' => $roles,
// ]);
return Response::denyWithStatus(401, __('playground-auth::auth.unauthorized'));
}
}

0 comments on commit bf40703

Please sign in to comment.