From 02cf55ec2ebb1d7fbe35cd6d5ea54d8e8e230cba Mon Sep 17 00:00:00 2001 From: Virtually Nick Date: Sat, 10 Jun 2023 17:34:43 -0400 Subject: [PATCH] GUACAMOLE-1020: Remove Weekend and Weekday definitions to avoid locale issues. --- .../calendar/TimeRestrictionParser.java | 34 ++----------------- .../timeRestrictionFieldController.js | 6 ++-- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/calendar/TimeRestrictionParser.java b/extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/calendar/TimeRestrictionParser.java index d308272d38..3c7099f45f 100644 --- a/extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/calendar/TimeRestrictionParser.java +++ b/extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/calendar/TimeRestrictionParser.java @@ -43,14 +43,13 @@ public class TimeRestrictionParser { * */ private static final Pattern RESTRICTION_REGEX = - Pattern.compile("(?:^|;)+([1-7*]|(?:[w][ed]))(?::((?:[01][0-9]|2[0-3])[0-5][0-9])\\-((?:[01][0-9]|2[0-3])[0-5][0-9]))+"); + Pattern.compile("(?:^|;)+([1-7*])(?::((?:[01][0-9]|2[0-3])[0-5][0-9])\\-((?:[01][0-9]|2[0-3])[0-5][0-9]))+"); /** * The RegEx group that contains the start day-of-week of the restriction. @@ -67,25 +66,6 @@ public class TimeRestrictionParser { */ private static final int RESTRICTION_TIME_END_GROUP = 3; - /** - * A list of DayOfWeek items that make up weekdays. - */ - private static final List RESTRICTION_WEEKDAYS = Arrays.asList( - DayOfWeek.MONDAY, - DayOfWeek.TUESDAY, - DayOfWeek.WEDNESDAY, - DayOfWeek.THURSDAY, - DayOfWeek.FRIDAY - ); - - /** - * A list of DayOfWeek items that make up weekends. - */ - private static final List RESTRICTION_WEEKEND = Arrays.asList( - DayOfWeek.SATURDAY, - DayOfWeek.SUNDAY - ); - /** * A list of DayOfWeek items that make up all days of the week. */ @@ -154,16 +134,6 @@ public static List parseString(String restrictionString) { restrictions.add(new DailyRestriction(RESTRICTION_ALL_DAYS, startTime, endTime)); break; - // Weekdays only. - case "wd": - restrictions.add(new DailyRestriction(RESTRICTION_WEEKDAYS, startTime, endTime)); - break; - - // Weekend days only. - case "we": - restrictions.add(new DailyRestriction(RESTRICTION_WEEKEND, startTime, endTime)); - break; - // A specific day of the week. default: restrictions.add(new DailyRestriction(DayOfWeek.of(Integer.parseInt(dayString)), startTime, endTime)); diff --git a/extensions/guacamole-auth-restrict/src/main/resources/controllers/timeRestrictionFieldController.js b/extensions/guacamole-auth-restrict/src/main/resources/controllers/timeRestrictionFieldController.js index a238e61e9f..fd7e7b68f5 100644 --- a/extensions/guacamole-auth-restrict/src/main/resources/controllers/timeRestrictionFieldController.js +++ b/extensions/guacamole-auth-restrict/src/main/resources/controllers/timeRestrictionFieldController.js @@ -64,9 +64,7 @@ angular.module('guacRestrict').controller('timeRestrictionFieldController', ['$s { id : '5', day : 'Friday' }, { id : '6', day : 'Saturday' }, { id : '7', day : 'Sunday' }, - { id : '*', day : 'All days' }, - { id : 'wd', day: 'Week days' }, - { id : 'we', day: 'Week end' } + { id : '*', day : 'All days' } ]; /** @@ -118,7 +116,7 @@ angular.module('guacRestrict').controller('timeRestrictionFieldController', ['$s return restrictions; // Set up the RegEx and split the string using the separator. - const restrictionRegex = new RegExp('^([1-7*]|(?:[w][ed]))(?::((?:[01][0-9]|2[0-3])[0-5][0-9])\-((?:[01][0-9]|2[0-3])[0-5][0-9]))$'); + const restrictionRegex = new RegExp('^([1-7*])(?::((?:[01][0-9]|2[0-3])[0-5][0-9])\-((?:[01][0-9]|2[0-3])[0-5][0-9]))$'); var restrArray = restrString.split(";"); // Loop through split string and process each item