添加网关列表权限
This commit is contained in:
@@ -20,6 +20,8 @@ import { Button } from "@/components/ui/button"
|
|||||||
import type { Gateway } from "@/models/gateway"
|
import type { Gateway } from "@/models/gateway"
|
||||||
import CreatePage from "./create"
|
import CreatePage from "./create"
|
||||||
import { format } from "date-fns"
|
import { format } from "date-fns"
|
||||||
|
import { ScopeProxyWrite } from "@/lib/scopes"
|
||||||
|
import { Auth } from "@/components/auth"
|
||||||
|
|
||||||
export default function GatewayPage() {
|
export default function GatewayPage() {
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
@@ -28,11 +30,13 @@ export default function GatewayPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<div className="flex justify-between items-stretch">
|
<Auth scope={ScopeProxyWrite}>
|
||||||
<div className="flex gap-3">
|
<div className="flex justify-between items-stretch">
|
||||||
<CreatePage onSuccess={table.refresh} />
|
<div className="flex gap-3">
|
||||||
|
<CreatePage onSuccess={table.refresh} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Auth>
|
||||||
<Suspense>
|
<Suspense>
|
||||||
<DataTable<Gateway>
|
<DataTable<Gateway>
|
||||||
{...table}
|
{...table}
|
||||||
@@ -70,7 +74,7 @@ export default function GatewayPage() {
|
|||||||
header: "操作",
|
header: "操作",
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
<Delete gateway={row.original} onSuccess={table.refresh} />
|
<Auth scope={ScopeProxyWrite}><Delete gateway={row.original} onSuccess={table.refresh} /></Auth>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import {
|
|||||||
ScopeDiscountRead,
|
ScopeDiscountRead,
|
||||||
ScopePermissionRead,
|
ScopePermissionRead,
|
||||||
ScopeProductRead,
|
ScopeProductRead,
|
||||||
|
ScopeProxyRead,
|
||||||
ScopeResourceRead,
|
ScopeResourceRead,
|
||||||
ScopeTradeRead,
|
ScopeTradeRead,
|
||||||
ScopeUserRead,
|
ScopeUserRead,
|
||||||
@@ -254,6 +255,7 @@ const menuSections: { title: string; items: NavItemProps[] }[] = [
|
|||||||
href: "/gateway",
|
href: "/gateway",
|
||||||
icon: DoorClosedIcon,
|
icon: DoorClosedIcon,
|
||||||
label: "网关列表",
|
label: "网关列表",
|
||||||
|
requiredScope:ScopeProxyRead
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
href: "/admin",
|
href: "/admin",
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ export const ScopeTrade = "trade"
|
|||||||
export const ScopeTradeRead = "trade:read" // 读取交易列表
|
export const ScopeTradeRead = "trade:read" // 读取交易列表
|
||||||
export const ScopeTradeReadOfUser = "trade:read:of_user" // 读取指定用户的交易列表
|
export const ScopeTradeReadOfUser = "trade:read:of_user" // 读取指定用户的交易列表
|
||||||
export const ScopeTradeWrite = "trade:write" // 写入交易
|
export const ScopeTradeWrite = "trade:write" // 写入交易
|
||||||
export const ScopeTradeWriteComplete = "trade:write:complete" // 完成交易
|
|
||||||
|
|
||||||
// 账单
|
// 账单
|
||||||
export const ScopeBill = "bill"
|
export const ScopeBill = "bill"
|
||||||
@@ -85,3 +84,9 @@ export const ScopeBillWrite = "bill:write" // 写入账单
|
|||||||
export const ScopeBalanceActivity = "balance_activity"
|
export const ScopeBalanceActivity = "balance_activity"
|
||||||
export const ScopeBalanceActivityRead = "balance_activity:read" // 读取余额变动列表
|
export const ScopeBalanceActivityRead = "balance_activity:read" // 读取余额变动列表
|
||||||
export const ScopeBalanceActivityReadOfUser = "balance_activity:read:of_user" // 读取指定用户的余额变动列表
|
export const ScopeBalanceActivityReadOfUser = "balance_activity:read:of_user" // 读取指定用户的余额变动列表
|
||||||
|
|
||||||
|
// 代理
|
||||||
|
export const ScopeProxy = "proxy"
|
||||||
|
export const ScopeProxyRead = "proxy:read" // 读取代理列表
|
||||||
|
export const ScopeProxyWrite = "proxy:write" // 写入代理
|
||||||
|
export const ScopeProxyWriteStatus = "proxy:write:status" // 更改代理状态
|
||||||
Reference in New Issue
Block a user