mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
chore: remove org role scopes field since it relies on pagination setup
This commit is contained in:
parent
8ac95a1bc2
commit
e5e378d1bb
2 changed files with 2 additions and 14 deletions
|
@ -6,10 +6,6 @@ import { type ScopeLibrary } from '#src/libraries/scope.js';
|
|||
import { type UserLibrary } from '#src/libraries/user.js';
|
||||
import type Queries from '#src/tenants/Queries.js';
|
||||
|
||||
// Show top 20 organization roles.
|
||||
const limit = 20;
|
||||
const offset = 0;
|
||||
|
||||
export const createJwtCustomizerLibrary = (
|
||||
queries: Queries,
|
||||
userLibrary: UserLibrary,
|
||||
|
@ -20,7 +16,7 @@ export const createJwtCustomizerLibrary = (
|
|||
rolesScopes: { findRolesScopesByRoleIds },
|
||||
scopes: { findScopesByIds },
|
||||
userSsoIdentities,
|
||||
organizations: { relations, roles: organizationRoles },
|
||||
organizations: { relations },
|
||||
} = queries;
|
||||
const { findUserRoles } = userLibrary;
|
||||
const { attachResourceToScopes } = scopeLibrary;
|
||||
|
@ -34,7 +30,6 @@ export const createJwtCustomizerLibrary = (
|
|||
const scopes = await findScopesByIds(scopeIds);
|
||||
const scopesWithResources = await attachResourceToScopes(scopes);
|
||||
const organizationsWithRoles = await relations.users.getOrganizationsByUserId(userId);
|
||||
const [_, organizationRolesWithScopes] = await organizationRoles.findAll(limit, offset);
|
||||
const userContext = {
|
||||
...pick(user, ...userInfoSelectFields),
|
||||
ssoIdentities: fullSsoIdentities.map(pickState('issuer', 'identityId', 'detail')),
|
||||
|
@ -57,7 +52,6 @@ export const createJwtCustomizerLibrary = (
|
|||
organizationId,
|
||||
roleId,
|
||||
roleName,
|
||||
scopes: organizationRolesWithScopes.find(({ id }) => id === roleId)?.scopes ?? [],
|
||||
}))
|
||||
),
|
||||
};
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import { z } from 'zod';
|
||||
|
||||
import {
|
||||
Organizations,
|
||||
OrganizationScopes,
|
||||
Roles,
|
||||
UserSsoIdentities,
|
||||
} from '../db-entries/index.js';
|
||||
import { Organizations, Roles, UserSsoIdentities } from '../db-entries/index.js';
|
||||
import { mfaFactorsGuard, jsonObjectGuard } from '../foundations/index.js';
|
||||
|
||||
import { jwtCustomizerGuard } from './logto-config/index.js';
|
||||
|
@ -31,7 +26,6 @@ export const jwtCustomizerUserContextGuard = userInfoGuard.extend({
|
|||
organizationId: z.string(),
|
||||
roleId: z.string(),
|
||||
roleName: z.string(),
|
||||
scopes: OrganizationScopes.guard.pick({ id: true, name: true }).array(),
|
||||
})
|
||||
.array(),
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue