Import latest app updates from streamline

An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
This commit is contained in:
2024-04-11 11:16:51 -07:00
parent cb4c6b4c1a
commit 4a89356390
10435 changed files with 107737 additions and 1220538 deletions
@@ -1,14 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use Illuminate\Support\Collection;
use InvalidArgumentException;
class GuardDoesNotMatch extends InvalidArgumentException
{
public static function create(string $givenGuard, Collection $expectedGuards)
{
return new static("The given role or permission should use guard `{$expectedGuards->implode(', ')}` instead of `{$givenGuard}`.");
}
}
@@ -1,13 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class PermissionAlreadyExists extends InvalidArgumentException
{
public static function create(string $permissionName, string $guardName)
{
return new static("A `{$permissionName}` permission already exists for guard `{$guardName}`.");
}
}
@@ -1,18 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class PermissionDoesNotExist extends InvalidArgumentException
{
public static function create(string $permissionName, string $guardName = '')
{
return new static("There is no permission named `{$permissionName}` for guard `{$guardName}`.");
}
public static function withId(int $permissionId, string $guardName = '')
{
return new static("There is no [permission] with id `{$permissionId}` for guard `{$guardName}`.");
}
}
@@ -1,13 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class RoleAlreadyExists extends InvalidArgumentException
{
public static function create(string $roleName, string $guardName)
{
return new static("A role `{$roleName}` already exists for guard `{$guardName}`.");
}
}
@@ -1,18 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class RoleDoesNotExist extends InvalidArgumentException
{
public static function named(string $roleName)
{
return new static("There is no role named `{$roleName}`.");
}
public static function withId(int $roleId)
{
return new static("There is no role with id `{$roleId}`.");
}
}
@@ -1,69 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use Symfony\Component\HttpKernel\Exception\HttpException;
class UnauthorizedException extends HttpException
{
private $requiredRoles = [];
private $requiredPermissions = [];
public static function forRoles(array $roles): self
{
$message = 'User does not have the right roles.';
if (config('permission.display_role_in_exception')) {
$message .= ' Necessary roles are '.implode(', ', $roles);
}
$exception = new static(403, $message, null, []);
$exception->requiredRoles = $roles;
return $exception;
}
public static function forPermissions(array $permissions): self
{
$message = 'User does not have the right permissions.';
if (config('permission.display_permission_in_exception')) {
$message .= ' Necessary permissions are '.implode(', ', $permissions);
}
$exception = new static(403, $message, null, []);
$exception->requiredPermissions = $permissions;
return $exception;
}
public static function forRolesOrPermissions(array $rolesOrPermissions): self
{
$message = 'User does not have any of the necessary access rights.';
if (config('permission.display_permission_in_exception') && config('permission.display_role_in_exception')) {
$message .= ' Necessary roles or permissions are '.implode(', ', $rolesOrPermissions);
}
$exception = new static(403, $message, null, []);
$exception->requiredPermissions = $rolesOrPermissions;
return $exception;
}
public static function notLoggedIn(): self
{
return new static(403, 'User is not logged in.', null, []);
}
public function getRequiredRoles(): array
{
return $this->requiredRoles;
}
public function getRequiredPermissions(): array
{
return $this->requiredPermissions;
}
}
@@ -1,13 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class WildcardPermissionInvalidArgument extends InvalidArgumentException
{
public static function create()
{
return new static('Wildcard permission must be string, permission id or permission instance');
}
}
@@ -1,13 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class WildcardPermissionNotImplementsContract extends InvalidArgumentException
{
public static function create()
{
return new static('Wildcard permission class must implements Spatie\Permission\Contracts\Wildcard contract');
}
}
@@ -1,13 +0,0 @@
<?php
namespace Spatie\Permission\Exceptions;
use InvalidArgumentException;
class WildcardPermissionNotProperlyFormatted extends InvalidArgumentException
{
public static function create(string $permission)
{
return new static("Wildcard permission `{$permission}` is not properly formatted.");
}
}