Details
-
Type:
Bug
-
Status: Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: Mercury
-
Fix Version/s: All Time Backlog
-
Component/s: API
-
Labels:
-
Environment:
aml-user-service feature/mercury branch
Description
In UserServiceComponent, the getAssignedRoles method is returning duplicate "Administrative user" roles in some cases.
It obtains the roles assigned to the user; in the test case, the user has "Administrative user" assigned to it.
Then it obtains the roles assigned to the group the user belongs to. This also contains "Administrative user".
In feature/mercury, the getAssignedRoles method in UserServiceComponent initializes a List<IRole>. UserService in SAPI retrieves this List with the duplicate role and converts it into a Set<String>. Because of this, the duplicate is "removed".
In feature/sapi-documentation, the response was changed to a SetQueryResponse in order to allow documentation using Enunciate and support XML responses. However, it uses the size of the retrieved List<IRole> and the converted Set<String> for the response, which causes the response to look like:
{"total":2,"results":["8a7ab076-822b-4053-9f7a-8fe4ddd9ff31"]}Due to there being duplicates of the role.
This was resolved in feature/sapi-documentation by initializing a Set<IRole>, which "removes" the duplication happening in UserServiceComponent, then returns that as a List<IRole>
Summary:
In feature/mercury, aml-user-service UserServiceComponent#getAssignedRoles is obtaining duplicate roles from the roles assigned to the User and the roles assigned to the Group, and the duplicates are being (unintentionally?) removed due to List to Set conversion.
This results in incorrect size being displayed in feature/sapi-documentation without code changes in UserServiceComponent as the total size of the results are incorrect. feature/sapi-documentation dedupes the roles.