feat(backend/ApiCallService): allow limited access for suspend accounts

This commit is contained in:
Kagami Sascha Rosylight
2023-08-13 15:30:19 +02:00
parent ab58b651f7
commit c28e0abb75
49 changed files with 109 additions and 55 deletions

View File

@@ -276,17 +276,10 @@ export class ApiCallService implements OnApplicationShutdown {
id: '1384574d-a912-4b81-8601-c7b1c4085df1',
httpStatusCode: 401,
});
} else if (user!.isSuspended) {
throw new ApiError({
message: 'Your account has been suspended.',
code: 'YOUR_ACCOUNT_SUSPENDED',
kind: 'permission',
id: 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370',
});
}
}
if (ep.meta.prohibitMoved) {
if (ep.meta.prohibitDeactivated) {
if (user?.movedToUri) {
throw new ApiError({
message: 'You have moved your account.',
@@ -295,6 +288,14 @@ export class ApiCallService implements OnApplicationShutdown {
id: '56f20ec9-fd06-4fa5-841b-edd6d7d4fa31',
});
}
if (user?.isSuspended) {
throw new ApiError({
message: 'Your account has been suspended.',
code: 'YOUR_ACCOUNT_SUSPENDED',
kind: 'permission',
id: 'a8c724b3-6e9c-4b46-b1a8-bc3ed6258370',
});
}
}
if ((ep.meta.requireModerator || ep.meta.requireAdmin) && !user!.isRoot) {