mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 23:45:54 +08:00
fix: update permission logic to ensure administrators always have access (#17360)
This commit is contained in:
parent
78409dfec1
commit
e2b8f40275
@ -5,15 +5,19 @@ import { useTranslation } from 'react-i18next'
|
|||||||
import { useInvalidatePermissions, useMutationPermissions, usePermissions } from '@/service/use-plugins'
|
import { useInvalidatePermissions, useMutationPermissions, usePermissions } from '@/service/use-plugins'
|
||||||
|
|
||||||
const hasPermission = (permission: PermissionType | undefined, isAdmin: boolean) => {
|
const hasPermission = (permission: PermissionType | undefined, isAdmin: boolean) => {
|
||||||
|
if (isAdmin)
|
||||||
|
return true // Administrators always have permissions
|
||||||
|
|
||||||
if (!permission)
|
if (!permission)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (permission === PermissionType.noOne)
|
if (permission === PermissionType.noOne)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
if (permission === PermissionType.everyone)
|
if (permission === PermissionType.everyone)
|
||||||
return true
|
return true
|
||||||
|
|
||||||
return isAdmin
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const usePermission = () => {
|
const usePermission = () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user