Move identity org details to new endpoint

This commit is contained in:
Carlos Monastyrski
2025-08-13 11:43:28 -07:00
parent 18881749fd
commit aa4dbfa073
3 changed files with 65 additions and 54 deletions
+33 -33
View File
@@ -18,50 +18,50 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
environmentsUsed: 0, environmentsUsed: 0,
identityLimit: null, identityLimit: null,
identitiesUsed: 0, identitiesUsed: 0,
dynamicSecret: false, dynamicSecret: true,
secretVersioning: true, secretVersioning: true,
pitRecovery: false, pitRecovery: true,
ipAllowlisting: false, ipAllowlisting: true,
rbac: false, rbac: true,
githubOrgSync: false, githubOrgSync: true,
customRateLimits: false, customRateLimits: true,
customAlerts: false, customAlerts: true,
secretAccessInsights: false, secretAccessInsights: true,
auditLogs: false, auditLogs: true,
auditLogsRetentionDays: 0, auditLogsRetentionDays: 0,
auditLogStreams: false, auditLogStreams: true,
auditLogStreamLimit: 3, auditLogStreamLimit: 3,
samlSSO: false, samlSSO: true,
hsm: false, hsm: true,
oidcSSO: false, oidcSSO: true,
scim: false, scim: true,
ldap: false, ldap: true,
groups: false, groups: true,
status: null, status: null,
trial_end: null, trial_end: null,
has_used_trial: true, has_used_trial: true,
secretApproval: false, secretApproval: true,
secretRotation: false, secretRotation: true,
caCrl: false, caCrl: true,
instanceUserManagement: false, instanceUserManagement: true,
externalKms: false, externalKms: true,
rateLimits: { rateLimits: {
readLimit: 60, readLimit: 60,
writeLimit: 200, writeLimit: 200,
secretsLimit: 40 secretsLimit: 40
}, },
pkiEst: false, pkiEst: true,
enforceMfa: false, enforceMfa: true,
projectTemplates: false, projectTemplates: true,
kmip: false, kmip: true,
gateway: false, gateway: true,
sshHostGroups: false, sshHostGroups: true,
secretScanning: false, secretScanning: true,
enterpriseSecretSyncs: false, enterpriseSecretSyncs: true,
enterpriseAppConnections: false, enterpriseAppConnections: true,
fips: false, fips: true,
eventSubscriptions: false, eventSubscriptions: true,
machineIdentityAuthTemplates: false machineIdentityAuthTemplates: true
}); });
export const setupLicenseRequestWithStore = ( export const setupLicenseRequestWithStore = (
@@ -478,4 +478,27 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
return { identityMemberships }; return { identityMemberships };
} }
}); });
server.route({
method: "GET",
url: "/details",
config: {
rateLimit: readLimit
},
schema: {
response: {
200: z.object({
id: z.string(),
name: z.string(),
slug: z.string(),
role: z.string()
})
}
},
onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN], { requireOrg: false }),
handler: async (req) => {
const organization = await server.services.org.findIdentityOrganization(req.permission.id);
return organization;
}
});
}; };
@@ -29,30 +29,18 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
}, },
schema: { schema: {
response: { response: {
200: z.union([ 200: z.object({
z.object({ organizations: sanitizedOrganizationSchema
id: z.string(), .extend({
name: z.string(), orgAuthMethod: z.string(),
slug: z.string(), userRole: z.string()
role: z.string() })
}), .array()
z.object({ })
organizations: sanitizedOrganizationSchema
.extend({
orgAuthMethod: z.string(),
userRole: z.string()
})
.array()
})
])
} }
}, },
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN], { requireOrg: false }), onRequest: verifyAuth([AuthMode.JWT], { requireOrg: false }),
handler: async (req) => { handler: async (req) => {
if (req.permission.type === ActorType.IDENTITY) {
const organization = await server.services.org.findIdentityOrganization(req.permission.id);
return organization;
}
const organizations = await server.services.org.findAllOrganizationOfUser(req.permission.id); const organizations = await server.services.org.findAllOrganizationOfUser(req.permission.id);
return { organizations }; return { organizations };
} }