Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix sort and drop unused fields

Thiago Araujo da Silva3a925d31dde5
diff --git a/backend/src/server/routes/v2/identity-router.ts b/backend/src/server/routes/v2/identity-router.ts
index 8682298a55..11019c1539 100644
--- a/backend/src/server/routes/v2/identity-router.ts
+++ b/backend/src/server/routes/v2/identity-router.ts
@@ -94,8 +94,8 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
.default(OrderByDirection.ASC)
.describe(IDENTITIES.SEARCH_V2.orderDirection)
.optional(),
- limit: z.number().max(100).default(50).describe(IDENTITIES.SEARCH_V2.limit),
- offset: z.number().default(0).describe(IDENTITIES.SEARCH_V2.offset),
+ limit: z.number().int().min(1).max(100).default(50).describe(IDENTITIES.SEARCH_V2.limit),
+ offset: z.number().int().min(0).default(0).describe(IDENTITIES.SEARCH_V2.offset),
search: buildSearchZodSchema(
z
.object({
diff --git a/backend/src/services/identity/identity-org-dal.ts b/backend/src/services/identity/identity-org-dal.ts
index ed608c8335..ee20ac28c5 100644
--- a/backend/src/services/identity/identity-org-dal.ts
+++ b/backend/src/services/identity/identity-org-dal.ts
@@ -782,7 +782,7 @@ export const identityOrgDALFactory = (db: TDbClient) => {
}
if (orderBy === OrgIdentityOrderBy.Role) {
- void searchedMemberships.orderBy("roleSort", orderDirection);
+ void searchedMemberships.orderBy("roleSort", orderDirection, "last");
} else if (orderBy === OrgIdentityOrderBy.LastLogin) {
// Never-used identities (lastLoginTime IS NULL) are always pushed to the bottom
// regardless of sort direction so the visible page is dominated by real activity.
@@ -915,14 +915,13 @@ export const identityOrgDALFactory = (db: TDbClient) => {
db.ref("id").as("tlsCertId").withSchema(TableName.IdentityTlsCertAuth),
db.ref("id").as("spiffeId").withSchema(TableName.IdentitySpiffeAuth)
)
- .select(db.ref("id").as("crId").withSchema(TableName.Role))
.select(db.ref("name").as("crName").withSchema(TableName.Role))
.select(db.ref("slug").as("crSlug").withSchema(TableName.Role))
.select(db.ref("description").as("crDescription").withSchema(TableName.Role))
.select(db.ref("permissions").as("crPermission").withSchema(TableName.Role));
if (orderBy === OrgIdentityOrderBy.Role) {
- void query.orderBy("searchedMemberships.roleSort", orderDirection);
+ void query.orderBy("searchedMemberships.roleSort", orderDirection, "last");
} else if (orderBy === OrgIdentityOrderBy.LastLogin) {
void query.orderBy("searchedMemberships.lastLoginSort", orderDirection, "last");
} else {
@@ -1015,7 +1014,6 @@ export const identityOrgDALFactory = (db: TDbClient) => {
membershipRoleId,
role,
roleId,
- crId,
crName,
crSlug,
crDescription,
@@ -1037,16 +1035,7 @@ export const identityOrgDALFactory = (db: TDbClient) => {
temporaryMode,
temporaryRange,
temporaryAccessStartTime,
- temporaryAccessEndTime,
- customRole: roleId
- ? {
- id: crId,
- name: crName,
- slug: crSlug,
- permissions: crPermission,
- description: crDescription
- }
- : undefined
+ temporaryAccessEndTime
})
}
]