0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

fix(core,phrases): fix custom JWT PUT API block admin tenant logic

This commit is contained in:
Darcy Ye 2024-03-25 23:39:18 +08:00
parent af53be8639
commit 1f0ae00ce4
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610
16 changed files with 35 additions and 6 deletions

View file

@ -230,11 +230,12 @@ export default function logtoConfigRoutes<T extends AuthedRouter>(
status: [200, 201, 400, 403],
}),
async (ctx, next) => {
if (
tenantId !== adminTenantId &&
!(EnvSet.values.isUnitTest || EnvSet.values.isIntegrationTest)
) {
throw new RequestError({ code: 'auth.forbidden', status: 403 });
const { isCloud, isUnitTest, isIntegrationTest } = EnvSet.values;
if (tenantId === adminTenantId && isCloud && !(isUnitTest || isIntegrationTest)) {
throw new RequestError({
code: 'jwt_customizer.can_not_create_for_admin_tenant',
status: 422,
});
}
const {

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,6 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);

View file

@ -1,6 +1,8 @@
const jwt_customizer = {
/** UNTRANSLATED */
general: 'An error occurred while customizing the JWT token. Please try again later.',
/** UNTRANSLATED */
can_not_create_for_admin_tenant: 'Cannot create a JWT token customizer for the admin tenant.',
};
export default Object.freeze(jwt_customizer);