Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
permissions.ts804 B
import { flatten } from "lodash"; import { Account, Permission } from "@/api/openapi-schema"; export function hasPermission(account?: Account, ...permissions: Permission[]) { if (!account) return false; // extract each permission from each role const accountPermissions = new Set( flatten(account.roles.map((role) => role.permissions)), ); if (accountPermissions.has("ADMINISTRATOR")) { return true; } return permissions.some((permission) => accountPermissions.has(permission)); } export function hasPermissionOr( account?: Account, fn?: () => boolean, ...permissions: Permission[] ) { if (!account) return false; const hasPerm = hasPermission(account, ...permissions); if (hasPerm) { return true; } if (fn?.()) { return true; } return false; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server