opnform-host-nginx/api/app
Chirag Chhatrala 2366f9515d
Readonly User (#637)
* Readonly User

* Refactor FormPolicy and TemplatePolicy to centralize write operation logic

- Introduced a private method `canPerformWriteOperation` in both FormPolicy and TemplatePolicy to encapsulate the logic for determining if a user can perform write operations on the respective models.
- Updated the `update`, `delete`, `restore`, and `forceDelete` methods in FormPolicy to use the new method for improved readability and maintainability.
- Simplified the `update` and `delete` methods in TemplatePolicy to leverage the centralized write operation logic.

This refactoring enhances code clarity and reduces duplication across policy classes.

* Refactor user and workspace permissions handling

- Updated FormController to authorize form creation based on workspace context.
- Removed the `is_readonly` attribute from UserResource and integrated it into WorkspaceResource for better encapsulation.
- Refactored User model to eliminate the `getIsReadonlyAttribute` method, shifting readonly logic to the Workspace model.
- Adjusted FormPolicy and TemplatePolicy to utilize workspace readonly checks for user permissions.
- Updated various frontend components to reference workspace readonly status instead of user readonly status, enhancing clarity and consistency in permission handling.

These changes improve the management of user permissions in relation to workspaces, ensuring a more robust and maintainable authorization system.

* Fix isReadonlyUser

* fix pint

---------

Co-authored-by: Julien Nahum <julien@nahum.net>
2024-12-30 14:35:23 +01:00
..
Console improve email notfication migration (#602) 2024-10-24 15:48:04 +02:00
Enums Separated laravel app to its own folder (#540) 2024-08-26 18:24:56 +02:00
Events Separated laravel app to its own folder (#540) 2024-08-26 18:24:56 +02:00
Exceptions Separated laravel app to its own folder (#540) 2024-08-26 18:24:56 +02:00
Exports Separated laravel app to its own folder (#540) 2024-08-26 18:24:56 +02:00
Http Readonly User (#637) 2024-12-30 14:35:23 +01:00
Integrations On slack,discord add support for Include hidden fields (#654) 2024-12-30 11:11:17 +01:00
Jobs Custom SMTP Settings (#561) 2024-09-24 12:16:20 +02:00
Listeners Custom SMTP Settings (#561) 2024-09-24 12:16:20 +02:00
Mail Apply Mentions everywhere (#595) 2024-10-22 10:34:29 +02:00
Models Readonly User (#637) 2024-12-30 14:35:23 +01:00
Notifications Send mobile editor email (#634) 2024-12-12 11:19:09 +01:00
Open Enhance redirect URL handling and MentionParser functionality (#639) 2024-12-10 12:26:01 +01:00
Policies Readonly User (#637) 2024-12-30 14:35:23 +01:00
Providers Separated laravel app to its own folder (#540) 2024-08-26 18:24:56 +02:00
Rules Add reCAPTCHA support and update captcha provider handling (#647) 2024-12-18 16:35:09 +01:00
Service Implement regex validation conditions in form logic (#645) 2024-12-16 17:17:29 +01:00
helpers.php Custom SMTP Settings (#561) 2024-09-24 12:16:20 +02:00