This pull request includes several changes aimed at enhancing the authentication and authorization mechanisms, improving permissions handling, and refactoring the codebase for better maintainability. The most important changes include updates to the login and logout functionality, the addition of permission checks, and the refactoring of user-related types and hooks.
These changes collectively improve the security, maintainability, and functionality of the authentication and authorization features within the codebase.
Changes in this pull request
Resolves #626
Additional info
This pull request includes several changes aimed at enhancing the authentication and authorization mechanisms, improving permissions handling, and refactoring the codebase for better maintainability. The most important changes include updates to the login and logout functionality, the addition of permission checks, and the refactoring of user-related types and hooks.
Authentication and Authorization Enhancements:
assets/js/src/core/modules/auth/authorization-api-slice.gen.ts
: Introduced new endpoints for login and logout, along with corresponding types (LoginApiResponse
,LoginApiArg
,UserInformation
,Credentials
).assets/js/src/core/components/login-form/login-form.tsx
: Updated the login form to use the newuseLoginMutation
hook and handle authentication errors more robustly.Permissions Handling:
assets/js/src/core/components/editor-tabs/editor-tabs.tsx
: Added permission checks for editor tab visibility and interaction usingcheckElementPermission
andisAllowed
.assets/js/src/core/modules/asset/tree/context-menu/context-menu.tsx
: Implemented permission checks for context menu actions to ensure users have the necessary permissions.Refactoring and Codebase Improvements:
assets/js/src/core/modules/auth/user/user-api-slice.gen.ts
: Refactored user-related types, includingUserInformation
, to replace the oldIUser
type and added new query endpoints.assets/js/src/core/modules/auth/user/user-slice.ts
: Updated the user slice to use the newUserInformation
type and removed the oldIUser
type.These changes collectively improve the security, maintainability, and functionality of the authentication and authorization features within the codebase.