mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
- Implement RBAC with viewer/editor/owner roles using bitwise permissions
- Add AccessRole, AclEntry, and Group models for permission management
- Create PermissionService for core permission logic and validation
- Integrate Microsoft Graph API for Entra ID user/group search
- Add middleware for resource access validation with custom ID resolvers
- Implement bulk permission updates with transaction support
- Create permission management UI with people picker and role selection
- Add public sharing capabilities for resources
- Include database migration for existing agent ownership
- Support hybrid local/Entra ID identity management
- Add comprehensive test coverage for all new services
chore: Update @librechat/data-schemas to version 0.0.9 and export common module in index.ts
fix: Update userGroup tests to mock logger correctly and change principalId expectation from null to undefined
59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import React from 'react';
|
|
import { Globe } from 'lucide-react';
|
|
import { Switch } from '~/components/ui';
|
|
import { useLocalize } from '~/hooks';
|
|
import AccessRolesPicker from './AccessRolesPicker';
|
|
|
|
interface PublicSharingToggleProps {
|
|
isPublic: boolean;
|
|
publicRole: string;
|
|
onPublicToggle: (isPublic: boolean) => void;
|
|
onPublicRoleChange: (role: string) => void;
|
|
className?: string;
|
|
resourceType?: string;
|
|
}
|
|
|
|
export default function PublicSharingToggle({
|
|
isPublic,
|
|
publicRole,
|
|
onPublicToggle,
|
|
onPublicRoleChange,
|
|
className = '',
|
|
resourceType = 'agent',
|
|
}: PublicSharingToggleProps) {
|
|
const localize = useLocalize();
|
|
|
|
return (
|
|
<div className={`space-y-3 border-t pt-4 ${className}`}>
|
|
<div className="flex items-center justify-between">
|
|
<div>
|
|
<h3 className="flex items-center gap-2 text-sm font-medium">
|
|
<Globe className="h-4 w-4" />
|
|
{localize('com_ui_share_with_everyone')}
|
|
</h3>
|
|
<p className="mt-1 text-xs text-muted-foreground">
|
|
{localize('com_ui_make_agent_available_all_users')}
|
|
</p>
|
|
</div>
|
|
<Switch
|
|
checked={isPublic}
|
|
onCheckedChange={onPublicToggle}
|
|
aria-label={localize('com_ui_share_with_everyone')}
|
|
/>
|
|
</div>
|
|
|
|
{isPublic && (
|
|
<div>
|
|
<label className="mb-2 block text-sm font-medium">
|
|
{localize('com_ui_public_access_level')}
|
|
</label>
|
|
<AccessRolesPicker
|
|
resourceType={resourceType}
|
|
selectedRoleId={publicRole}
|
|
onRoleChange={onPublicRoleChange}
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|