mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
chore: chagne mangament attr name
This commit is contained in:
parent
70a5d78cc5
commit
31ece363c3
|
@ -49,7 +49,7 @@ const PluginSettingModal: FC<Props> = ({
|
|||
</div>
|
||||
<div className='flex px-6 py-3 flex-col justify-center items-start gap-4 self-stretch'>
|
||||
{[
|
||||
{ title: t(`${i18nPrefix}.whoCanInstall`), key: 'canInstall', value: tempPrivilege.canInstall },
|
||||
{ title: t(`${i18nPrefix}.whoCanInstall`), key: 'canManagement', value: tempPrivilege.canManagement },
|
||||
{ title: t(`${i18nPrefix}.whoCanDebug`), key: 'canDebugger', value: tempPrivilege.canDebugger },
|
||||
].map(({ title, key, value }) => (
|
||||
<div key={key} className='flex flex-col items-start gap-1 self-stretch'>
|
||||
|
|
|
@ -22,7 +22,7 @@ export type PluginPageContextValue = {
|
|||
export const PluginPageContext = createContext<PluginPageContextValue>({
|
||||
containerRef: { current: null },
|
||||
permissions: {
|
||||
canInstall: PermissionType.noOne,
|
||||
canManagement: PermissionType.noOne,
|
||||
canDebugger: PermissionType.noOne,
|
||||
},
|
||||
setPermissions: () => { },
|
||||
|
@ -41,7 +41,7 @@ export const PluginPageContextProvider = ({
|
|||
}: PluginPageContextProviderProps) => {
|
||||
const containerRef = useRef<HTMLDivElement>(null)
|
||||
const [permissions, setPermissions] = useState<PluginPageContextValue['permissions']>({
|
||||
canInstall: PermissionType.noOne,
|
||||
canManagement: PermissionType.noOne,
|
||||
canDebugger: PermissionType.noOne,
|
||||
})
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ const PluginPage = ({
|
|||
}: PluginPageProps) => {
|
||||
const { t } = useTranslation()
|
||||
const {
|
||||
canInstall,
|
||||
canManagement,
|
||||
canDebugger,
|
||||
canSetPermissions,
|
||||
permissions,
|
||||
|
@ -88,7 +88,7 @@ const PluginPage = ({
|
|||
/>
|
||||
</div>
|
||||
<div className='flex flex-shrink-0 items-center gap-1'>
|
||||
{canInstall && (
|
||||
{canManagement && (
|
||||
<InstallPluginDropdown />
|
||||
)}
|
||||
{
|
||||
|
|
|
@ -23,12 +23,12 @@ const usePermission = () => {
|
|||
useEffect(() => {
|
||||
// TODO: fetch permissions from server
|
||||
setPermissions({
|
||||
canInstall: PermissionType.everyone,
|
||||
canManagement: PermissionType.everyone,
|
||||
canDebugger: PermissionType.everyone,
|
||||
})
|
||||
}, [])
|
||||
return {
|
||||
canInstall: hasPermission(permissions.canInstall, isAdmin),
|
||||
canManagement: hasPermission(permissions.canManagement, isAdmin),
|
||||
canDebugger: hasPermission(permissions.canDebugger, isAdmin),
|
||||
canSetPermissions: isAdmin,
|
||||
permissions,
|
||||
|
|
|
@ -33,6 +33,6 @@ export enum PermissionType {
|
|||
}
|
||||
|
||||
export type Permissions = {
|
||||
canInstall: PermissionType
|
||||
canManagement: PermissionType
|
||||
canDebugger: PermissionType
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user