mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 06:49:03 +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'
|
||||
|
||||
const hasPermission = (permission: PermissionType | undefined, isAdmin: boolean) => {
|
||||
if (isAdmin)
|
||||
return true // Administrators always have permissions
|
||||
|
||||
if (!permission)
|
||||
return false
|
||||
|
||||
if (permission === PermissionType.noOne)
|
||||
return false
|
||||
|
||||
if (permission === PermissionType.everyone)
|
||||
return true
|
||||
|
||||
return isAdmin
|
||||
return false
|
||||
}
|
||||
|
||||
const usePermission = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user