Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions services/trex/core/server/plugin/function.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { env, global, logger } from "../env.ts";
import { waitfor } from "./utils.ts";
import * as LogtoAPI from "../api/LogtoAPI.ts";
import { authn } from "../auth/authn.ts";
import { authz } from "../auth/authz.ts";
import { Hono, Context } from "npm:hono";
Expand Down Expand Up @@ -438,36 +437,13 @@ export async function addPlugin(
.filter((v: any, i: any, self: any) => self.lastIndexOf(v) == i);
else {
global.ROLE_SCOPES[_name] = cfg;
const roleName = _name;
// Create the Logto role when the role doesn't exist
try {
const result = await LogtoAPI.createLogtoRole(roleName);
if (result.status === 200) {
logger.info(`Created Logto role: ${roleName}`);
} else if (result.status === 422) {
logger.info(`Logto role '${roleName}' exists`);
} else {
logger.info(
`Logto role creation for '${roleName}' returned status ${
result.status
}: ${JSON.stringify(result.data)}`
);
}
} catch (err) {
logger.error(`Failed to create Logto role '${roleName}': ${err}`);
}
}
Comment thread
SantanM marked this conversation as resolved.
});
}
if (value.scopes) {
global.REQUIRED_URL_SCOPES = global.REQUIRED_URL_SCOPES.concat(
value.scopes
);
try {
await LogtoAPI.createLogtoApisAndScopes(value.scopes);
} catch (error) {
logger.error(`Failed to create Logto APIs and scopes: ${error}`);
}
}

if (value.api)
Expand Down
Loading