diff --git a/backend/src/ee/services/saml-config/saml-config-types.ts b/backend/src/ee/services/saml-config/saml-config-types.ts index 3ccc1e743..9aedf5d19 100644 --- a/backend/src/ee/services/saml-config/saml-config-types.ts +++ b/backend/src/ee/services/saml-config/saml-config-types.ts @@ -32,7 +32,7 @@ export type TGetSamlCfgDTO = actor: ActorType; actorId: string; actorAuthMethod: ActorAuthMethod; - actorOrgId?: string; + actorOrgId: string | undefined; } | { type: "orgSlug"; diff --git a/backend/src/lib/types/index.ts b/backend/src/lib/types/index.ts index 547e85af9..a81517c94 100644 --- a/backend/src/lib/types/index.ts +++ b/backend/src/lib/types/index.ts @@ -5,7 +5,7 @@ export type TOrgPermission = { actorId: string; orgId: string; actorAuthMethod: ActorAuthMethod; - actorOrgId?: string; + actorOrgId: string | undefined; }; export type TProjectPermission = { @@ -13,7 +13,7 @@ export type TProjectPermission = { actorId: string; projectId: string; actorAuthMethod: AuthMethod | null; - actorOrgId?: string; + actorOrgId: string | undefined; }; export type RequiredKeys<T> = { diff --git a/backend/src/services/org/org-role-service.ts b/backend/src/services/org/org-role-service.ts index 74c4887fb..70c54ff18 100644 --- a/backend/src/services/org/org-role-service.ts +++ b/backend/src/services/org/org-role-service.ts @@ -28,7 +28,7 @@ export const orgRoleServiceFactory = ({ orgRoleDAL, permissionService }: TOrgRol orgId: string, data: Omit<TOrgRolesInsert, "orgId">, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.Role); @@ -48,7 +48,7 @@ export const orgRoleServiceFactory = ({ orgRoleDAL, permissionService }: TOrgRol roleId: string, data: Omit<TOrgRolesUpdate, "orgId">, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Edit, OrgPermissionSubjects.Role); @@ -70,7 +70,7 @@ export const orgRoleServiceFactory = ({ orgRoleDAL, permissionService }: TOrgRol orgId: string, roleId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Delete, OrgPermissionSubjects.Role); @@ -80,7 +80,12 @@ export const orgRoleServiceFactory = ({ orgRoleDAL, permissionService }: TOrgRol return deletedRole; }; - const listRoles = async (userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, actorOrgId?: string) => { + const listRoles = async ( + userId: string, + orgId: string, + actorAuthMethod: ActorAuthMethod, + actorOrgId: string | undefined + ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Role); const customRoles = await orgRoleDAL.find({ orgId }); @@ -128,7 +133,7 @@ export const orgRoleServiceFactory = ({ orgRoleDAL, permissionService }: TOrgRol userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission, membership } = await permissionService.getUserOrgPermission( userId, diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts index 916029648..bab3b9869 100644 --- a/backend/src/services/org/org-service.ts +++ b/backend/src/services/org/org-service.ts @@ -82,7 +82,7 @@ export const orgServiceFactory = ({ userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); const org = await orgDAL.findOrgById(orgId); @@ -103,7 +103,7 @@ export const orgServiceFactory = ({ userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.Member); @@ -330,7 +330,7 @@ export const orgServiceFactory = ({ userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { membership } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); if ((membership.role as OrgMembershipRole) !== OrgMembershipRole.Admin) @@ -613,7 +613,7 @@ export const orgServiceFactory = ({ userId: string, orgId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Read, OrgPermissionSubjects.IncidentAccount); @@ -626,7 +626,7 @@ export const orgServiceFactory = ({ orgId: string, email: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Create, OrgPermissionSubjects.IncidentAccount); @@ -647,7 +647,7 @@ export const orgServiceFactory = ({ orgId: string, id: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getUserOrgPermission(userId, orgId, actorAuthMethod, actorOrgId); ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Delete, OrgPermissionSubjects.IncidentAccount); diff --git a/backend/src/services/org/org-types.ts b/backend/src/services/org/org-types.ts index af8fbd95f..c811f9bc0 100644 --- a/backend/src/services/org/org-types.ts +++ b/backend/src/services/org/org-types.ts @@ -7,7 +7,7 @@ export type TUpdateOrgMembershipDTO = { orgId: string; membershipId: string; role: string; - actorOrgId?: string; + actorOrgId: string | undefined; actorAuthMethod: ActorAuthMethod; }; @@ -15,14 +15,14 @@ export type TDeleteOrgMembershipDTO = { userId: string; orgId: string; membershipId: string; - actorOrgId?: string; + actorOrgId: string | undefined; actorAuthMethod: ActorAuthMethod; }; export type TInviteUserToOrgDTO = { userId: string; orgId: string; - actorOrgId?: string; + actorOrgId: string | undefined; actorAuthMethod: ActorAuthMethod; inviteeEmail: string; }; @@ -45,7 +45,7 @@ export type TFindOrgMembersByEmailDTO = { export type TFindAllWorkspacesDTO = { actor: ActorType; actorId: string; - actorOrgId?: string; + actorOrgId: string | undefined; actorAuthMethod: ActorAuthMethod; orgId: string; }; diff --git a/backend/src/services/project-role/project-role-service.ts b/backend/src/services/project-role/project-role-service.ts index 10f64bd12..5c8ecdcff 100644 --- a/backend/src/services/project-role/project-role-service.ts +++ b/backend/src/services/project-role/project-role-service.ts @@ -30,7 +30,7 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }: projectId: string, data: Omit<TProjectRolesInsert, "projectId">, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getProjectPermission( actor, @@ -57,7 +57,7 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }: roleId: string, data: Omit<TOrgRolesUpdate, "orgId">, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getProjectPermission( actor, @@ -86,7 +86,7 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }: projectId: string, roleId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getProjectPermission( actor, @@ -107,7 +107,7 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }: actorId: string, projectId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission } = await permissionService.getProjectPermission( actor, @@ -172,7 +172,7 @@ export const projectRoleServiceFactory = ({ projectRoleDAL, permissionService }: userId: string, projectId: string, actorAuthMethod: ActorAuthMethod, - actorOrgId?: string + actorOrgId: string | undefined ) => { const { permission, membership } = await permissionService.getUserProjectPermission( userId, diff --git a/backend/src/services/project/project-types.ts b/backend/src/services/project/project-types.ts index 2b84dc1db..5b2b635f2 100644 --- a/backend/src/services/project/project-types.ts +++ b/backend/src/services/project/project-types.ts @@ -33,7 +33,7 @@ export type TDeleteProjectBySlugDTO = { slug: string; actor: ActorType; actorId: string; - actorOrgId?: string; + actorOrgId: string | undefined; }; export type TGetProjectDTO = { @@ -60,7 +60,7 @@ export type TDeleteProjectDTO = { filter: Filter; actor: ActorType; actorId: string; - actorOrgId?: string; + actorOrgId: string | undefined; } & Omit<TProjectPermission, "projectId">; export type TUpgradeProjectDTO = {