diff --git a/src/Database/Helpers/Role.php b/src/Database/Helpers/Role.php index 1682cb547..239262c75 100644 --- a/src/Database/Helpers/Role.php +++ b/src/Database/Helpers/Role.php @@ -175,4 +175,9 @@ public static function member(string $identifier): self { return new self('member', $identifier); } + + public static function project(string $identifier, string $dimension = ''): self + { + return new self('project', $identifier, $dimension); + } } diff --git a/src/Database/Validator/Roles.php b/src/Database/Validator/Roles.php index 0306118e7..d55723cda 100644 --- a/src/Database/Validator/Roles.php +++ b/src/Database/Validator/Roles.php @@ -15,6 +15,7 @@ class Roles extends Validator public const ROLE_TEAM = 'team'; public const ROLE_MEMBER = 'member'; public const ROLE_LABEL = 'label'; + public const ROLE_PROJECT = 'project'; public const ROLES = [ self::ROLE_ANY, @@ -24,6 +25,7 @@ class Roles extends Validator self::ROLE_TEAM, self::ROLE_MEMBER, self::ROLE_LABEL, + self::ROLE_PROJECT, ]; protected string $message = 'Roles Error'; @@ -108,6 +110,16 @@ class Roles extends Validator 'required' => false, ], ], + self::ROLE_PROJECT => [ + 'identifier' => [ + 'allowed' => true, + 'required' => true, + ], + 'dimension' => [ + 'allowed' => true, + 'required' => true, + ], + ] ]; // Dimensions @@ -286,8 +298,6 @@ protected function isValidRole( } // Required and has no dimension - // PHPStan complains because there are currently no dimensions that are required, but there might be in future - // @phpstan-ignore-next-line if ($allowed && $required && empty($dimension)) { $this->message = 'Role "' . $role . '"' . ' must have a dimension value.'; return false;