* create zapier app * install sanctum * move OAuthProviderController * make `api-external` middleware * add zapier endpoints * add tests * token management * zapier event handler * add policy * use `slug` instead of `id` * wip * check policies * change api prefix to `external` * ui tweaks * validate token abilities * open zapier URL * zapier ui tweaks * update zap * Fix linting * Added sample endpoints + minor UI changes * Run PHP code linter --------- Co-authored-by: Julien Nahum <julien@nahum.net>
29 lines
615 B
PHP
29 lines
615 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
enum AccessTokenAbility: string
|
|
{
|
|
case ManageIntegrations = 'manage-integrations';
|
|
case ListForms = 'list-forms';
|
|
case ListWorkspaces = 'list-workspaces';
|
|
|
|
public static function values(): array
|
|
{
|
|
return array_map(
|
|
fn (AccessTokenAbility $case) => $case->value,
|
|
static::cases()
|
|
);
|
|
}
|
|
|
|
public static function allowed(array $abilities): array
|
|
{
|
|
return Arr::where(
|
|
$abilities,
|
|
fn (string $ability) => in_array($ability, static::values())
|
|
);
|
|
}
|
|
}
|