Implementation:Infiniflow Ragflow Admin RoleForm Component
| Knowledge Sources | |
|---|---|
| Domains | Frontend, Admin |
| Last Updated | 2026-02-12 06:00 GMT |
Overview
Role creation and editing form component with a dynamic permissions grid for assigning granular access controls.
Description
The admin/forms/role-form.tsx component renders a form for creating or editing roles. It includes a role name field and a dynamic permissions grid that displays all available permissions grouped by category, with checkboxes for toggling individual permissions. The grid dynamically updates based on available permission definitions fetched from the backend.
Usage
Used within the roles page as a dialog form for creating new roles or editing existing role definitions.
Code Reference
Source Location
- Repository: Infiniflow_Ragflow
- File: web/src/pages/admin/forms/role-form.tsx
- Lines: 1-209
Signature
export default function RoleForm(): JSX.Element;
Import
import RoleForm from '@/pages/admin/forms/role-form';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| role | undefined | No | Existing role data for edit mode; undefined for create mode |
| onSubmit | (role: Role) => void | Yes | Callback with submitted role data |
Outputs
| Name | Type | Description |
|---|---|---|
| Rendered component | JSX.Element | Role form with dynamic permissions grid |
Usage Examples
<RoleForm role={selectedRole} onSubmit={handleSaveRole} />