Role full implementation + member associations#202
Merged
scraft-official merged 14 commits intorelease/0.26from Jan 10, 2026
Merged
Role full implementation + member associations#202scraft-official merged 14 commits intorelease/0.26from
scraft-official merged 14 commits intorelease/0.26from
Conversation
Introduced RoleEntity, RoleEntityMeta, RoleEntityMapper, and RoleEntityRepository for role persistence. Refactored RoleRepositoryImpl to use new infrastructure classes and mapping. Updated TaskEntityMeta and TaskEntityRepository for improved validation and query formatting.
Added specific exception handlers for JwtException and IllegalArgumentException in BaseControllerAdvice, and enabled a generic exception handler for improved error responses. Updated the Role class to use Lombok annotations for builder pattern, all-args constructor, and toString method.
Updated the @column annotation for the 'meta' field in multiple entity classes to specify a length of 65,535. This change ensures consistent column sizing for metadata storage across all relevant entities.
Refactored ChannelAccessControl and ProjectAccessControl to handle missing member associations gracefully by returning AccessLevel.NONE. Updated method parameter order in ChannelDeleteUseCase and ChannelFetchUseCase for consistency. Added superPrivileged flag to default admin, project manager, and lead roles in InitialSetupUseCase to grant elevated permissions.
Removed AccessControlService and updated all use cases to use specific access control implementations (OrganizationAccessControl, ProjectAccessControl, ChannelAccessControl, etc.). This improves separation of concerns and clarifies dependencies for each use case. Also updated method signatures to consistently use (organizationId, memberId, entityId, level) parameter order.
Standardized the order of parameters for access control methods across use cases, placing organizationId before memberId and resourceId. This improves consistency and reduces potential confusion when invoking access control checks.
Introduces command and use case classes for role creation, fetching, and batch fetching, along with a custom role creation meta implementation. Refines ViewController endpoint mapping and adds @nonnull annotations to ViewRepositoryImpl methods for better null safety. Also corrects a query in ViewEntityRepository to remove an unnecessary condition.
Updated service and repository methods for batch fetching entities (channels, projects, roles, tasks, views) to accept Set<HUID> instead of List<HUID> for improved uniqueness and performance. Renamed and refactored related use cases and commands for roles, and added StreamUtils for stream distinct operations. Also added @nonnull annotations to repository implementations for better null safety.
Added support for cascading role deletion, including reassigning affected member associations to a fallback default role. Introduced new command, use case, and meta classes for role deletion, updated repository interfaces and implementations, and extended the shared deletion service to handle member association updates during role removal. Also added utility methods for member association scope checks.
Replaced deletion logic with exception throwing when member association is missing in channel and project role assignment use cases. Improved error message for system default role deletion. Fixed typo in method name from findBydRoleId to findByRoleId in MemberAssociationRepository and its implementation.
Introduces MemberAddToProjectCommand, MemberAddToChannelCommand, and their respective use cases to handle adding members to projects and channels with default role assignment. Also improves exception formatting in MemberAssignProjectRoleUseCase.
Introduced new endpoints in MemberController for adding members to projects and channels. Added MemberAddRequest DTO and MemberAddMapper for mapping requests to commands. This enhances the API to support member addition operations for both projects and channels.
Introduces patching support for roles, including new request, response, command, and use case classes. Adds mappers for create, fetch, and patch operations, and updates service and domain logic to support role modification and inheritance. Transactional annotations added to relevant use cases for consistency.
Introduces batch fetch and list endpoints for roles, including new request and response DTOs and mappers. Refactors role-related mappers to extend a common interface and updates controller logic to use UUIDs instead of HUIDs in API layer. Fixes a bug in ProjectPatchUseCase operation checks, adds missing @Getter to TasksBatchFetchRequest, and updates repository methods to use Set instead of List for IDs.
NikodemCyrzan
approved these changes
Jan 9, 2026
scraft-official
added a commit
that referenced
this pull request
Jan 13, 2026
* Add role entity infrastructure and repository Introduced RoleEntity, RoleEntityMeta, RoleEntityMapper, and RoleEntityRepository for role persistence. Refactored RoleRepositoryImpl to use new infrastructure classes and mapping. Updated TaskEntityMeta and TaskEntityRepository for improved validation and query formatting. * Enhance exception handling and add Lombok to Role Added specific exception handlers for JwtException and IllegalArgumentException in BaseControllerAdvice, and enabled a generic exception handler for improved error responses. Updated the Role class to use Lombok annotations for builder pattern, all-args constructor, and toString method. * Set meta column length to 65535 in entity classes Updated the @column annotation for the 'meta' field in multiple entity classes to specify a length of 65,535. This change ensures consistent column sizing for metadata storage across all relevant entities. * Improve access control and setup super privileged roles Refactored ChannelAccessControl and ProjectAccessControl to handle missing member associations gracefully by returning AccessLevel.NONE. Updated method parameter order in ChannelDeleteUseCase and ChannelFetchUseCase for consistency. Added superPrivileged flag to default admin, project manager, and lead roles in InitialSetupUseCase to grant elevated permissions. * Refactor access control to use specific control classes Removed AccessControlService and updated all use cases to use specific access control implementations (OrganizationAccessControl, ProjectAccessControl, ChannelAccessControl, etc.). This improves separation of concerns and clarifies dependencies for each use case. Also updated method signatures to consistently use (organizationId, memberId, entityId, level) parameter order. * Refactor access control method parameter order Standardized the order of parameters for access control methods across use cases, placing organizationId before memberId and resourceId. This improves consistency and reduces potential confusion when invoking access control checks. * Add role command/usecase classes and improve view handling Introduces command and use case classes for role creation, fetching, and batch fetching, along with a custom role creation meta implementation. Refines ViewController endpoint mapping and adds @nonnull annotations to ViewRepositoryImpl methods for better null safety. Also corrects a query in ViewEntityRepository to remove an unnecessary condition. * Refactor batch fetch methods to use Set for IDs Updated service and repository methods for batch fetching entities (channels, projects, roles, tasks, views) to accept Set<HUID> instead of List<HUID> for improved uniqueness and performance. Renamed and refactored related use cases and commands for roles, and added StreamUtils for stream distinct operations. Also added @nonnull annotations to repository implementations for better null safety. * Implement role cascade deletion with fallback assignment Added support for cascading role deletion, including reassigning affected member associations to a fallback default role. Introduced new command, use case, and meta classes for role deletion, updated repository interfaces and implementations, and extended the shared deletion service to handle member association updates during role removal. Also added utility methods for member association scope checks. * Refactor role/member association methods and error handling Replaced deletion logic with exception throwing when member association is missing in channel and project role assignment use cases. Improved error message for system default role deletion. Fixed typo in method name from findBydRoleId to findByRoleId in MemberAssociationRepository and its implementation. * Add use cases for adding members to projects and channels Introduces MemberAddToProjectCommand, MemberAddToChannelCommand, and their respective use cases to handle adding members to projects and channels with default role assignment. Also improves exception formatting in MemberAssignProjectRoleUseCase. * Add endpoints to add members to projects and channels Introduced new endpoints in MemberController for adding members to projects and channels. Added MemberAddRequest DTO and MemberAddMapper for mapping requests to commands. This enhances the API to support member addition operations for both projects and channels. * Add role patching and mapping functionality Introduces patching support for roles, including new request, response, command, and use case classes. Adds mappers for create, fetch, and patch operations, and updates service and domain logic to support role modification and inheritance. Transactional annotations added to relevant use cases for consistency. * Add batch and list role APIs, refactor role mappers Introduces batch fetch and list endpoints for roles, including new request and response DTOs and mappers. Refactors role-related mappers to extend a common interface and updates controller logic to use UUIDs instead of HUIDs in API layer. Fixes a bug in ProjectPatchUseCase operation checks, adds missing @Getter to TasksBatchFetchRequest, and updates repository methods to use Set instead of List for IDs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces major enhancements and refactoring to the member and role management APIs in the backend. The key updates include the addition of endpoints for adding members to projects and channels, a comprehensive new
RoleControllerwith full CRUD and batch operations, improved exception handling, and a consistent approach to mapping and request/response objects. These changes improve the modularity, error handling, and extensibility of the API layer.Member Management Enhancements:
MemberController, with corresponding request and mapper classes (MemberAddRequest,MemberAddMapper). [1] [2] [3]UUIDinstead ofHUIDfor role IDs, improving consistency and interoperability. [1] [2]Role Management Refactor and Expansion:
RoleControllerimplementing endpoints for role CRUD, patch, batch fetch, and organization-wide role listing, leveraging new mappers and request/response types.RoleMapper,RoleCreateMapper,RoleFetchMapper, andRolePatchMapper. [1] [2] [3] [4]Error Handling Improvements:
JwtException,IllegalArgumentException, and a generic catch-all handler that logs stack traces and returns a standardized error response. [1] [2] [3]These updates collectively make the API more robust, maintainable, and ready for further feature development.