mirror of
https://github.com/langgenius/dify.git
synced 2026-07-21 20:15:31 -04:00
a84c2d36a3
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
24 lines
529 B
TypeScript
24 lines
529 B
TypeScript
import { PermissionType } from './types'
|
|
|
|
type LegacyPluginPermissionAccessOptions = {
|
|
isAdminOrOwner: boolean
|
|
permission?: PermissionType
|
|
rbacEnabled?: boolean
|
|
}
|
|
|
|
export const hasLegacyPluginPermissionAccess = ({
|
|
isAdminOrOwner,
|
|
permission,
|
|
rbacEnabled,
|
|
}: LegacyPluginPermissionAccessOptions) => {
|
|
if (rbacEnabled !== false) return true
|
|
|
|
if (!permission) return false
|
|
|
|
if (permission === PermissionType.everyone) return true
|
|
|
|
if (permission === PermissionType.admin) return isAdminOrOwner
|
|
|
|
return false
|
|
}
|