Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

524 B
Raw Blame
import { useAuth } from "@editor/auth/UseSession";
import { useAppConfig } from "@editor/contexts/AppConfigContext";

/**
 * Whether the signed-in account administers this instance.
 *
 * <p>Same two sources the editor's own gates use, session first: app config answers for a build
 * with login off, where everyone is effectively the administrator.
 */
export function usePortalAdmin(): boolean {
  const authState = useAuth();
  const { config } = useAppConfig();
  return authState.isAdmin ?? config?.isAdmin ?? false;
}