Skip to content

Commit

Permalink
feat: added new alias message type
Browse files Browse the repository at this point in the history
  • Loading branch information
mebo4b committed Jun 7, 2021
1 parent 4b1db38 commit f3d07cb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
5 changes: 3 additions & 2 deletions api/messageservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ paths:
tags:
- message-controller
summary: 'Saves a new empty system message containing the provided message type in the alias.
[Authorization: Role: user, consultant]'
[Authorization: Role: user, consultant, technical]'
operationId: saveAliasOnlyMessage
parameters:
- name: rcGroupId
Expand Down Expand Up @@ -478,9 +478,10 @@ components:
MessageType:
type: string
enum:
- "FINISHED_CONVERSATION"
- "FORWARD"
- "FURTHER_STEPS"
- "UPDATE_SESSION_DATA"
- "FORWARD"
- "VIDEOCALL"

UserDTO:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ protected void configure(HttpSecurity http) throws Exception {
.antMatchers("/messages/new")
.hasAnyAuthority(USER_DEFAULT, CONSULTANT_DEFAULT, TECHNICAL_DEFAULT, ANONYMOUS_DEFAULT)
.antMatchers("/messages/forward", "/messages/feedback/new")
.hasAnyAuthority(USE_FEEDBACK)
.hasAuthority(USE_FEEDBACK)
.antMatchers("/messages/aliasonly/new")
.hasAuthority(USER_DEFAULT)
.hasAnyAuthority(USER_DEFAULT, TECHNICAL_DEFAULT)
.anyRequest()
.denyAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,4 +473,24 @@ public void getMessagesStream_Should_ReturnNoContent_When_AnonyousAuthority()
.andExpect(status().isNoContent());
}

@Test
@WithMockUser(authorities = {AuthorityValue.TECHNICAL_DEFAULT})
public void saveAliasOnlyMessage_Should_ReturnCreatedAndCallPostGroupMessageFacade_When_TechnicalDefaultAuthority()
throws Exception {
AliasOnlyMessageDTO aliasOnlyMessageDTO =
new EasyRandom().nextObject(AliasOnlyMessageDTO.class);

mvc.perform(
post(PATH_POST_CREATE_ALIAS_ONLY_MESSAGE)
.cookie(csrfCookie)
.header(CSRF_HEADER, CSRF_VALUE)
.header("rcGroupId", RC_GROUP_ID)
.contentType(MediaType.APPLICATION_JSON)
.content(new ObjectMapper().writeValueAsString(aliasOnlyMessageDTO))
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());

verify(postGroupMessageFacade, times(1)).postAliasOnlyMessage(any(), any());
}

}

0 comments on commit f3d07cb

Please sign in to comment.