mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 22:27:22 +00:00
Fix populate service in getAuthDataProjectPermissions
This commit is contained in:
@@ -290,27 +290,27 @@ export const getAuthDataProjectPermissions = async ({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ActorType.SERVICE_V3: {
|
case ActorType.SERVICE_V3: {
|
||||||
const serviceMembership = await MachineMembership.findOne({
|
const machineMembership = await MachineMembership.findOne({
|
||||||
machineIdentity: authData.authPayload._id,
|
machineIdentity: authData.authPayload._id,
|
||||||
workspace: workspaceId
|
workspace: workspaceId
|
||||||
})
|
})
|
||||||
.populate<{
|
.populate<{
|
||||||
customRole: IRole & { permissions: RawRuleOf<MongoAbility<ProjectPermissionSet>>[] };
|
customRole: IRole & { permissions: RawRuleOf<MongoAbility<ProjectPermissionSet>>[] };
|
||||||
machineIdentity: IMachineIdentity
|
machineIdentity: IMachineIdentity
|
||||||
}>("customRole service")
|
}>("customRole machineIdentity")
|
||||||
.exec();
|
.exec();
|
||||||
|
|
||||||
if (!serviceMembership || (serviceMembership.role === "custom" && !serviceMembership.customRole)) {
|
if (!machineMembership || (machineMembership.role === "custom" && !machineMembership.customRole)) {
|
||||||
throw UnauthorizedRequestError();
|
throw UnauthorizedRequestError();
|
||||||
}
|
}
|
||||||
|
|
||||||
checkIPAgainstBlocklist({
|
checkIPAgainstBlocklist({
|
||||||
ipAddress: authData.ipAddress,
|
ipAddress: authData.ipAddress,
|
||||||
trustedIps: serviceMembership.machineIdentity.trustedIps
|
trustedIps: machineMembership.machineIdentity.trustedIps
|
||||||
});
|
});
|
||||||
|
|
||||||
role = serviceMembership.role;
|
role = machineMembership.role;
|
||||||
customRole = serviceMembership.customRole;
|
customRole = machineMembership.customRole;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user