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.

452 B
Raw Blame
import { DEFAULT_ROLE_NAMES } from "@kaneo/permissions";
import { isWorkspaceOwnerRole } from "./is-workspace-owner-role";

export function getAssignableRoleOptions(
  roles: readonly string[] | undefined,
  currentRole?: string,
) {
  const options = [...(roles ?? DEFAULT_ROLE_NAMES)];
  if (
    currentRole &&
    !isWorkspaceOwnerRole(currentRole) &&
    !options.includes(currentRole)
  ) {
    options.push(currentRole);
  }
  return options;
}