-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add Import CSV and Export CSV Permissions #13421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Introduced new permission flags for importing and exporting CSV files in the PermissionFlagType enum. - Updated relevant components to check for these permissions before rendering export/import actions. - Enhanced the SettingsRolePermissionsToolSection to include options for managing CSV permissions. This change improves the role-based access control for CSV operations in the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements granular permission controls for CSV import and export functionality across the Twenty CRM application. The changes add two new permission flags (IMPORT_CSV
and EXPORT_CSV
) to the existing role-based permission system, allowing administrators to control which users can import data from CSV files or export data to CSV files.
The implementation follows the established permissions architecture by:
- Adding the new permission flags to the backend constants and services with secure defaults (disabled by default)
- Updating the frontend GraphQL generated types to include the new permission flags
- Integrating permission checks into existing action components using the
useHasSettingsPermission
hook - Adding UI configuration for these permissions in the settings panel under the "Actions" section
The changes affect multiple layers of the application: the backend permission service sets secure defaults, the frontend action components (ExportMultipleRecordsAction
, ExportSingleRecordAction
, ImportRecordsNoSelectionRecordAction
) now conditionally render based on user permissions, and the settings UI allows administrators to configure these permissions per role. This follows the principle of least privilege by defaulting new permissions to false and requiring explicit granting of access.
Confidence score: 5/5
- This PR is extremely safe to merge with minimal risk of production issues
- The implementation follows established patterns consistently across all modified files and maintains backward compatibility
- No files need additional attention as the changes are straightforward permission additions with proper security defaults
8 files reviewed, 1 comment
...gs/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
Outdated
Show resolved
Hide resolved
📊 API Changes ReportGraphQL Schema ChangesGraphQL Schema Changes[log] [log] ✖ Field settingsPermissions was removed from object type UserWorkspace
GraphQL Metadata Schema ChangesGraphQL Metadata Schema Changes[log] [log] ✖ Field settingsPermissions was removed from object type UserWorkspace
REST Metadata API Analysis ErrorError Output
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:36648 This environment will automatically shut down when the PR is closed or after 5 hours. |
- Introduced a new constants file for tool permission flags, including 'SEND_EMAIL_TOOL', 'IMPORT_CSV', and 'EXPORT_CSV'. - Updated the PermissionsService to incorporate tool permissions, allowing for more granular access control based on the new flags. - Refactored permission checking logic to utilize the new tool permission flags, improving the overall role-based access control system.
...tion-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx
Outdated
Show resolved
Hide resolved
...gs/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
Outdated
Show resolved
Hide resolved
...tion-menu/actions/record-actions/multiple-records/components/ExportMultipleRecordsAction.tsx
Outdated
Show resolved
Hide resolved
- Added `requiredPermissionFlag` to action configurations for CSV import and export actions. - Updated `useRegisteredActions` hook to filter actions based on the new permission flags. - Imported `PermissionFlagType` to manage permissions effectively. This change improves role-based access control for CSV operations in the action menu.
…with `useHasPermissionFlag` in relevant components - Updated `useRecordGroupActions` and `SettingsProtectedRouteWrapper` to utilize the new permission hook. - Introduced `useHasPermissionFlag` to centralize permission checks based on permission flags, enhancing role-based access control.
… with `permissionFlags`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
Thanks @abdulrahmancodes for your contribution! |
No description provided.