Skip to content

Commit

Permalink
fix: analysis-permisison permission_id field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Jul 3, 2024
1 parent eecfa9e commit 051ab7e
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,23 @@ export async function runAnalysisPermissionValidation(
if (isAuthupClientUsable()) {
const authup = useAuthupClient();

let permission : Permission;
if (result.data.permission_id) {
let permission: Permission;
try {
permission = await authup.permission.getOne(result.data.permission_id);

try {
permission = await authup.permission.getOne(result.data.permission_id);
result.data.permission = permission;
result.data.permission_realm_id = permission.realm_id;

result.data.permission = permission;
result.data.permission_realm_id = permission.realm_id;
// todo: remove this when validation is reworked.
result.relation.permission = permission;
} catch (e) {
if (isClientErrorWithStatusCode(e, 404)) {
throw new BadRequestError(buildHTTPValidationErrorMessage('permission_id'));
}

// todo: remove this when validation is reworked.
result.relation.permission = permission;
} catch (e) {
if (isClientErrorWithStatusCode(e, 404)) {
throw new BadRequestError(buildHTTPValidationErrorMessage('permission_id'));
throw e;
}

throw e;
}

// todo: this is not possible right now :/
Expand Down

0 comments on commit 051ab7e

Please sign in to comment.