Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

427 B
Raw Blame
import { parseInstanceRoles } from "@kaneo/permissions";

/**
 * The one role the directory shows and edits: admin when present, else the
 * first custom role, else user. Admins assign a single role.
 */
export function getPrimaryInstanceRole(role: string | null | undefined) {
  const names = parseInstanceRoles(role);
  if (names.includes("admin")) return "admin";
  return names.find((name) => name !== "user") ?? "user";
}