mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 21:27:10 +00:00
added missed endpoint
This commit is contained in:
@@ -339,7 +339,7 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
privilege: {
|
privilege: {
|
||||||
...privilege,
|
...privilege,
|
||||||
identityId: req.query.identityId,
|
identityId: req.query.identityId,
|
||||||
projectMembershipId: privilege.projectId as string,
|
projectMembershipId: privilege.projectMembershipId || (privilege.projectId as string),
|
||||||
projectId,
|
projectId,
|
||||||
slug: privilege.name
|
slug: privilege.name
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -294,6 +294,21 @@ export const additionalPrivilegeServiceFactory = ({
|
|||||||
const dbActorField = dto.selector.actorType === ActorType.IDENTITY ? "actorIdentityId" : "actorUserId";
|
const dbActorField = dto.selector.actorType === ActorType.IDENTITY ? "actorIdentityId" : "actorUserId";
|
||||||
const scope = factory.getScopeField(dto.scopeData);
|
const scope = factory.getScopeField(dto.scopeData);
|
||||||
|
|
||||||
|
let projectMembershipId: string | undefined;
|
||||||
|
if (scope.key === "projectId") {
|
||||||
|
const projectMembership = await membershipDAL.findOne({
|
||||||
|
[dbActorField]: dto.selector.actorId,
|
||||||
|
scopeProjectId: scope.value,
|
||||||
|
scope: AccessScope.Project
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!projectMembership) {
|
||||||
|
throw new NotFoundError({
|
||||||
|
message: `Project membership for ${dto.selector.actorType} ${dto.selector.actorId} not found`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
projectMembershipId = projectMembership.id;
|
||||||
|
}
|
||||||
const additionalPrivilege = await additionalPrivilegeDAL.findOne({
|
const additionalPrivilege = await additionalPrivilegeDAL.findOne({
|
||||||
name: selector.name,
|
name: selector.name,
|
||||||
[dbActorField]: dto.selector.actorId,
|
[dbActorField]: dto.selector.actorId,
|
||||||
@@ -303,7 +318,11 @@ export const additionalPrivilegeServiceFactory = ({
|
|||||||
throw new NotFoundError({ message: `Additional privilege with name ${selector.name} doesn't exist` });
|
throw new NotFoundError({ message: `Additional privilege with name ${selector.name} doesn't exist` });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
additionalPrivilege: { ...additionalPrivilege, permissions: unpackPermissions(additionalPrivilege.permissions) }
|
additionalPrivilege: {
|
||||||
|
...additionalPrivilege,
|
||||||
|
permissions: unpackPermissions(additionalPrivilege.permissions),
|
||||||
|
projectMembershipId
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user