fix(stage): isolate credentialless author bootstrap and recovery rehearsal
Stage author bootstrap (dedicated repair) / bootstrap (push) Failing after 3m55s
Stage author bootstrap (dedicated repair) / bootstrap (push) Failing after 3m55s
This commit is contained in:
1 parent
6ed0e73311
commit
46da1c5339
30 files changed
+1295
-62
No files matched your search
@@ -10,7 +10,7 @@ import {
|
||||
export class HumanAdminGuard implements CanActivate {
|
||||
canActivate(context: ExecutionContext): boolean {
|
||||
const user = context.switchToHttp().getRequest().user;
|
||||
if (!user || user.isApiKey || !['Admin', 'SUPER_ADMIN'].includes(user.role))
|
||||
if (!user || user.isPublicAuthor || user.isApiKey || !['Admin', 'SUPER_ADMIN'].includes(user.role))
|
||||
throw new ForbiddenException('Human administrator required');
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ interface RequestWithUser {
|
||||
role?: string;
|
||||
isApiKey?: boolean;
|
||||
scopes?: string[];
|
||||
isPublicAuthor?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,12 +26,14 @@ export class RolesGuard implements CanActivate {
|
||||
[context.getHandler(), context.getClass()],
|
||||
);
|
||||
|
||||
const request = context.switchToHttp().getRequest<RequestWithUser>();
|
||||
const user = request.user;
|
||||
if (user?.isPublicAuthor) throw new ForbiddenException("Public authors have no permissions");
|
||||
|
||||
if (!requiredRoles || requiredRoles.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const request = context.switchToHttp().getRequest<RequestWithUser>();
|
||||
const user = request.user;
|
||||
if (!user || !user.role) {
|
||||
throw new ForbiddenException("شما دسترسی لازم برای این بخش را ندارید");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user