Skip to content

Commit

Permalink
Fix Beheer group (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoepdeJong committed Oct 1, 2023
1 parent 811fb8f commit e2a4ba9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void createWebhookTask(WebhookTrigger webhookTrigger, Object content) {
* @return boolean
*/
private boolean isWebhookAuthenticated(Webhook webhook, Object content) {
if (webhook.getLdapGroup() == ch.wisv.events.utils.LdapGroup.CHBEHEER) {
if (webhook.getLdapGroup() == ch.wisv.events.utils.LdapGroup.BEHEER) {
return true;
} else {
if (content instanceof Event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public SalesServiceImpl(EventService eventService, OrderService orderService) {
*/
@Override
public List<Event> getAllGrantedEventByCustomer(Customer customer) {
if (customer.getLdapGroups().contains(LdapGroup.BESTUUR)) {
if (customer.getLdapGroups().contains(LdapGroup.BESTUUR) || customer.getLdapGroups().contains(LdapGroup.BEHEER)) {
return eventService.getUpcoming();
} else {
return eventService.getUpcoming().stream()
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/wisv/events/utils/LdapGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public enum LdapGroup {
AKCIE("AkCie"),
ANNUCIE("AnnuCie"),
BT("Business Tour"),
CHBEHEER("CH Beheer"),
BEHEER("Beheer"),
CHIPCIE("CHipCie"),
CHOCO("CHoCo"),
COMMA("ComMA"),
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/dev/data/webhooks.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"ldapGroup": "CHBEHEER",
"ldapGroup": "BEHEER",
"payloadUrl": "http://localhost:1234/wp-json/events-sync/v1/single/",
"triggers": [
"EVENT_CREATE_UPDATE",
Expand All @@ -10,7 +10,7 @@
]
},
{
"ldapGroup": "CHBEHEER",
"ldapGroup": "BEHEER",
"payloadUrl": "http://localhost:9000/payments/api/chevents/sync/product/",
"triggers": [
"PRODUCT_CREATE_UPDATE",
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ch/wisv/events/ControllerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ protected OrderProduct createOrderProduct(Product product) {
protected Webhook createWebhook() {
Webhook webhook = new Webhook();
webhook.setActive(true);
webhook.setLdapGroup(LdapGroup.CHBEHEER);
webhook.setLdapGroup(LdapGroup.BEHEER);
webhook.setPayloadUrl("https://test.frl/");
webhook.setSecret("secret");
webhook.setWebhookTriggers(ImmutableList.of(WebhookTrigger.EVENT_CREATE_UPDATE));
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ch/wisv/events/EventsApplicationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public MailService mailService() {
public AuthenticationService authenticationService() {
AuthenticationService service = Mockito.mock(AuthenticationService.class);
Customer customer = new Customer();
customer.setLdapGroups(ImmutableList.of(LdapGroup.CHBEHEER));
customer.setLdapGroups(ImmutableList.of(LdapGroup.BEHEER));
Mockito.when(service.getCurrentCustomer()).thenReturn(customer);

return service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void testCreatePost() throws Exception {

mockMvc.perform(post("/administrator/webhooks/create")
.param("payloadUrl", "https://test.frl")
.param("ldapGroup", "CHBEHEER")
.param("ldapGroup", "BEHEER")
.sessionAttr("webhook", webhook))
.andExpect(status().is3xxRedirection())
.andExpect(redirectedUrl("/administrator/webhooks/"))
Expand Down Expand Up @@ -138,7 +138,7 @@ public void testEditPost() throws Exception {

mockMvc.perform(post("/administrator/webhooks/edit/" + webhook.getKey())
.param("payloadUrl", "https://test.frl")
.param("ldapGroup", "CHBEHEER")
.param("ldapGroup", "BEHEER")
.sessionAttr("webhook", webhook))
.andExpect(status().is3xxRedirection())
.andExpect(redirectedUrl("/administrator/webhooks/view/" + webhook.getKey()))
Expand All @@ -152,7 +152,7 @@ public void testEditPostInvalidPayloadUrl() throws Exception {

mockMvc.perform(post("/administrator/webhooks/edit/" + webhook.getKey())
.param("payloadUrl", "")
.param("ldapGroup", "CHBEHEER")
.param("ldapGroup", "BEHEER")
.sessionAttr("webhook", webhook))
.andExpect(status().is3xxRedirection())
.andExpect(redirectedUrl("/administrator/webhooks/edit/" + webhook.getKey()))
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/application-test.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Connect Configuration
wisvch.connect.issuerUri=https://connect.ch.tudelft.nl/
wisvch.connect.clientUri=http://localhost:9000/
wisvch.connect.admin.groups=bestuur,chbeheer,w3cie,vc
wisvch.connect.admin.groups=bestuur,beheer,w3cie,vc

# Serve connect
server.port=9000
Expand Down

0 comments on commit e2a4ba9

Please sign in to comment.