mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-21 01:56:38 +00:00
dont show create org for oidc users
This commit is contained in:
@@ -29,6 +29,7 @@ import { usePathname, useRouter } from "next/navigation";
|
|||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useUserContext } from "@app/hooks/useUserContext";
|
import { useUserContext } from "@app/hooks/useUserContext";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
import { build } from "@server/build";
|
||||||
|
|
||||||
interface OrgSelectorProps {
|
interface OrgSelectorProps {
|
||||||
orgId?: string;
|
orgId?: string;
|
||||||
@@ -50,6 +51,11 @@ export function OrgSelector({
|
|||||||
|
|
||||||
const selectedOrg = orgs?.find((org) => org.orgId === orgId);
|
const selectedOrg = orgs?.find((org) => org.orgId === orgId);
|
||||||
|
|
||||||
|
let canCreateOrg = !env.flags.disableUserCreateOrg || user.serverAdmin;
|
||||||
|
if (build === "saas" && user.type !== "internal") {
|
||||||
|
canCreateOrg = false;
|
||||||
|
}
|
||||||
|
|
||||||
const sortedOrgs = useMemo(() => {
|
const sortedOrgs = useMemo(() => {
|
||||||
if (!orgs?.length) return orgs ?? [];
|
if (!orgs?.length) return orgs ?? [];
|
||||||
return [...orgs].sort((a, b) => {
|
return [...orgs].sort((a, b) => {
|
||||||
@@ -161,7 +167,7 @@ export function OrgSelector({
|
|||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
</CommandList>
|
</CommandList>
|
||||||
</Command>
|
</Command>
|
||||||
{(!env.flags.disableUserCreateOrg || user.serverAdmin) && (
|
{canCreateOrg && (
|
||||||
<div className="p-2 border-t border-border">
|
<div className="p-2 border-t border-border">
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
|
|||||||
Reference in New Issue
Block a user