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

View File

@@ -18,50 +18,50 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({
environmentsUsed: 0,
identityLimit: null,
identitiesUsed: 0,
dynamicSecret: false,
dynamicSecret: true,
secretVersioning: true,
pitRecovery: false,
ipAllowlisting: false,
rbac: false,
githubOrgSync: false,
customRateLimits: false,
customAlerts: false,
secretAccessInsights: false,
auditLogs: false,
pitRecovery: true,
ipAllowlisting: true,
rbac: true,
githubOrgSync: true,
customRateLimits: true,
customAlerts: true,
secretAccessInsights: true,
auditLogs: true,
auditLogsRetentionDays: 0,
auditLogStreams: false,
auditLogStreams: true,
auditLogStreamLimit: 3,
samlSSO: false,
hsm: false,
oidcSSO: false,
scim: false,
ldap: false,
groups: false,
samlSSO: true,
hsm: true,
oidcSSO: true,
scim: true,
ldap: true,
groups: true,
status: null,
trial_end: null,
has_used_trial: true,
secretApproval: false,
secretRotation: false,
caCrl: false,
instanceUserManagement: false,
externalKms: false,
secretApproval: true,
secretRotation: true,
caCrl: true,
instanceUserManagement: true,
externalKms: true,
rateLimits: {
readLimit: 60,
writeLimit: 200,
secretsLimit: 40
},
pkiEst: false,
enforceMfa: false,
projectTemplates: false,
kmip: false,
gateway: false,
sshHostGroups: false,
secretScanning: false,
enterpriseSecretSyncs: false,
enterpriseAppConnections: false,
fips: false,
eventSubscriptions: false,
machineIdentityAuthTemplates: false
pkiEst: true,
enforceMfa: true,
projectTemplates: true,
kmip: true,
gateway: true,
sshHostGroups: true,
secretScanning: true,
enterpriseSecretSyncs: true,
enterpriseAppConnections: true,
fips: true,
eventSubscriptions: true,
machineIdentityAuthTemplates: true
});
export const setupLicenseRequestWithStore = (

View File

@@ -478,4 +478,27 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
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;
}
});
};

View File

@@ -29,30 +29,18 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
},
schema: {
response: {
200: z.union([
z.object({
id: z.string(),
name: z.string(),
slug: z.string(),
role: z.string()
}),
z.object({
organizations: sanitizedOrganizationSchema
.extend({
orgAuthMethod: z.string(),
userRole: z.string()
})
.array()
})
])
200: 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) => {
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);
return { organizations };
}