mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 02:46:52 +08:00
feat: new editor user permission profile (#4435)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
@@ -19,6 +19,7 @@ export type AppContextValue = {
|
||||
currentWorkspace: ICurrentWorkspace
|
||||
isCurrentWorkspaceManager: boolean
|
||||
isCurrentWorkspaceOwner: boolean
|
||||
isCurrentWorkspaceEditor: boolean
|
||||
mutateCurrentWorkspace: VoidFunction
|
||||
pageContainerRef: React.RefObject<HTMLDivElement>
|
||||
langeniusVersionInfo: LangGeniusVersionResponse
|
||||
@@ -59,6 +60,7 @@ const AppContext = createContext<AppContextValue>({
|
||||
currentWorkspace: initialWorkspaceInfo,
|
||||
isCurrentWorkspaceManager: false,
|
||||
isCurrentWorkspaceOwner: false,
|
||||
isCurrentWorkspaceEditor: false,
|
||||
mutateUserProfile: () => { },
|
||||
mutateCurrentWorkspace: () => { },
|
||||
pageContainerRef: createRef(),
|
||||
@@ -86,6 +88,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
||||
const [currentWorkspace, setCurrentWorkspace] = useState<ICurrentWorkspace>(initialWorkspaceInfo)
|
||||
const isCurrentWorkspaceManager = useMemo(() => ['owner', 'admin'].includes(currentWorkspace.role), [currentWorkspace.role])
|
||||
const isCurrentWorkspaceOwner = useMemo(() => currentWorkspace.role === 'owner', [currentWorkspace.role])
|
||||
const isCurrentWorkspaceEditor = useMemo(() => ['owner', 'admin', 'editor'].includes(currentWorkspace.role), [currentWorkspace.role])
|
||||
const updateUserProfileAndVersion = useCallback(async () => {
|
||||
if (userProfileResponse && !userProfileResponse.bodyUsed) {
|
||||
const result = await userProfileResponse.json()
|
||||
@@ -121,6 +124,7 @@ export const AppContextProvider: FC<AppContextProviderProps> = ({ children }) =>
|
||||
currentWorkspace,
|
||||
isCurrentWorkspaceManager,
|
||||
isCurrentWorkspaceOwner,
|
||||
isCurrentWorkspaceEditor,
|
||||
mutateCurrentWorkspace,
|
||||
}}>
|
||||
<div className='flex flex-col h-full overflow-y-auto'>
|
||||
|
||||
Reference in New Issue
Block a user