feat: implemented user role impersonation

This commit is contained in:
=
2025-04-21 18:43:21 +05:30
parent eba12912f8
commit 7219ba3b46
40 changed files with 750 additions and 51 deletions
@@ -551,13 +551,26 @@ export const permissionServiceFactory = ({
};
const getProjectPermission = async <T extends ActorType>({
actor,
actorId,
actor: inputActor,
actorId: inputActorId,
projectId,
actorAuthMethod,
actorOrgId,
actionProjectType
}: TGetProjectPermissionArg): Promise<TProjectPermissionRT<T>> => {
let actor = inputActor;
let actorId = inputActorId;
const projectAssumeRole = requestContext.get("projectAssumeRole");
if (
projectAssumeRole &&
actor === ActorType.USER &&
actorId === projectAssumeRole.userId &&
projectId === projectAssumeRole.projectId
) {
actor = projectAssumeRole.actorType;
actorId = projectAssumeRole.actorId;
}
switch (actor) {
case ActorType.USER:
return getUserProjectPermission({