mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 02:51:51 +00:00
Update orgScope to orgId naming for org-level auth ref, rewire user invite saml block to org authEnforce field
This commit is contained in:
@@ -29,9 +29,9 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }:
|
||||
actorId: string,
|
||||
projectId: string,
|
||||
data: Omit<TProjectRolesInsert, "projectId">,
|
||||
actorOrgScope?: string
|
||||
actorOrgId?: string
|
||||
) => {
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgScope);
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgId);
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Create, ProjectPermissionSub.Role);
|
||||
const existingRole = await projectRoleDAL.findOne({ slug: data.slug, projectId });
|
||||
if (existingRole) throw new BadRequestError({ name: "Create Role", message: "Duplicate role" });
|
||||
@@ -49,9 +49,9 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }:
|
||||
projectId: string,
|
||||
roleId: string,
|
||||
data: Omit<TOrgRolesUpdate, "orgId">,
|
||||
actorOrgScope?: string
|
||||
actorOrgId?: string
|
||||
) => {
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgScope);
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgId);
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Edit, ProjectPermissionSub.Role);
|
||||
if (data?.slug) {
|
||||
const existingRole = await projectRoleDAL.findOne({ slug: data.slug, projectId });
|
||||
@@ -71,9 +71,9 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }:
|
||||
actorId: string,
|
||||
projectId: string,
|
||||
roleId: string,
|
||||
actorOrgScope?: string
|
||||
actorOrgId?: string
|
||||
) => {
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgScope);
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgId);
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Delete, ProjectPermissionSub.Role);
|
||||
const [deletedRole] = await projectRoleDAL.delete({ id: roleId, projectId });
|
||||
if (!deleteRole) throw new BadRequestError({ message: "Role not found", name: "Update role" });
|
||||
@@ -81,8 +81,8 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }:
|
||||
return deletedRole;
|
||||
};
|
||||
|
||||
const listRoles = async (actor: ActorType, actorId: string, projectId: string, actorOrgScope?: string) => {
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgScope);
|
||||
const listRoles = async (actor: ActorType, actorId: string, projectId: string, actorOrgId?: string) => {
|
||||
const { permission } = await permissionService.getProjectPermission(actor, actorId, projectId, actorOrgId);
|
||||
ForbiddenError.from(permission).throwUnlessCan(ProjectPermissionActions.Read, ProjectPermissionSub.Role);
|
||||
const customRoles = await projectRoleDAL.find({ projectId });
|
||||
const roles = [
|
||||
@@ -135,12 +135,8 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }:
|
||||
return roles;
|
||||
};
|
||||
|
||||
const getUserPermission = async (userId: string, projectId: string, actorOrgScope?: string) => {
|
||||
const { permission, membership } = await permissionService.getUserProjectPermission(
|
||||
userId,
|
||||
projectId,
|
||||
actorOrgScope
|
||||
);
|
||||
const getUserPermission = async (userId: string, projectId: string, actorOrgId?: string) => {
|
||||
const { permission, membership } = await permissionService.getUserProjectPermission(userId, projectId, actorOrgId);
|
||||
return { permissions: packRules(permission.rules), membership };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user