diff --git a/src/main/java/ru/mystamps/web/Url.java b/src/main/java/ru/mystamps/web/Url.java index 1ccf61b213..1ecc7e293b 100644 --- a/src/main/java/ru/mystamps/web/Url.java +++ b/src/main/java/ru/mystamps/web/Url.java @@ -118,31 +118,32 @@ private Url() { } public static Map asMap(boolean serveContentFromSingleHost) { - // There is not all urls but only those which used on views + // There is not all urls but only those which used on views. + // Listed in alphabetical order. Map map = new HashMap<>(); - map.put("PUBLIC_URL", PUBLIC_URL); - map.put("AUTHENTICATION_PAGE", AUTHENTICATION_PAGE); - map.put("LOGIN_PAGE", LOGIN_PAGE); - map.put("LOGOUT_PAGE", LOGOUT_PAGE); map.put("ACTIVATE_ACCOUNT_PAGE", ACTIVATE_ACCOUNT_PAGE); - map.put("REGISTRATION_PAGE", REGISTRATION_PAGE); + map.put("ADD_CATEGORY_PAGE", ADD_CATEGORY_PAGE); + map.put("ADD_COUNTRY_PAGE", ADD_COUNTRY_PAGE); + map.put("ADD_IMAGE_SERIES_PAGE", ADD_IMAGE_SERIES_PAGE); map.put("ADD_PARTICIPANT_PAGE", ADD_PARTICIPANT_PAGE); - map.put("ADD_SERIES_PAGE", ADD_SERIES_PAGE); map.put("ADD_SERIES_ASK_PAGE", ADD_SERIES_ASK_PAGE); - map.put("INFO_SERIES_PAGE", INFO_SERIES_PAGE); - map.put("ADD_IMAGE_SERIES_PAGE", ADD_IMAGE_SERIES_PAGE); - map.put("SEARCH_SERIES_BY_CATALOG", SEARCH_SERIES_BY_CATALOG); - map.put("SUGGEST_SERIES_COUNTRY", SUGGEST_SERIES_COUNTRY); - map.put("ADD_CATEGORY_PAGE", ADD_CATEGORY_PAGE); + map.put("ADD_SERIES_PAGE", ADD_SERIES_PAGE); + map.put("AUTHENTICATION_PAGE", AUTHENTICATION_PAGE); + map.put("BOOTSTRAP_LANGUAGE", BOOTSTRAP_LANGUAGE); + map.put("DAILY_STATISTICS", DAILY_STATISTICS); map.put("INFO_CATEGORY_PAGE", INFO_CATEGORY_PAGE); - map.put("LIST_CATEGORIES_PAGE", LIST_CATEGORIES_PAGE); - map.put("ADD_COUNTRY_PAGE", ADD_COUNTRY_PAGE); + map.put("INFO_COLLECTION_PAGE", INFO_COLLECTION_PAGE); map.put("INFO_COUNTRY_PAGE", INFO_COUNTRY_PAGE); + map.put("INFO_SERIES_PAGE", INFO_SERIES_PAGE); + map.put("LIST_CATEGORIES_PAGE", LIST_CATEGORIES_PAGE); map.put("LIST_COUNTRIES_PAGE", LIST_COUNTRIES_PAGE); - map.put("INFO_COLLECTION_PAGE", INFO_COLLECTION_PAGE); + map.put("LOGIN_PAGE", LOGIN_PAGE); + map.put("LOGOUT_PAGE", LOGOUT_PAGE); + map.put("PUBLIC_URL", PUBLIC_URL); + map.put("REGISTRATION_PAGE", REGISTRATION_PAGE); + map.put("SEARCH_SERIES_BY_CATALOG", SEARCH_SERIES_BY_CATALOG); map.put("SITE_EVENTS_PAGE", SITE_EVENTS_PAGE); - map.put("BOOTSTRAP_LANGUAGE", BOOTSTRAP_LANGUAGE); - map.put("DAILY_STATISTICS", DAILY_STATISTICS); + map.put("SUGGEST_SERIES_COUNTRY", SUGGEST_SERIES_COUNTRY); if (serveContentFromSingleHost) { map.put("BOOTSTRAP_CSS", BOOTSTRAP_CSS); diff --git a/src/main/java/ru/mystamps/web/support/spring/security/Authority.java b/src/main/java/ru/mystamps/web/support/spring/security/Authority.java index f3313a7c09..37e0513277 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/Authority.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/Authority.java @@ -22,18 +22,19 @@ @SuppressWarnings("checkstyle:linelength") public final class Authority { + // Constants are listed in alphabetical order. public static final GrantedAuthority ADD_COMMENTS_TO_SERIES = new SimpleGrantedAuthority(StringAuthority.ADD_COMMENTS_TO_SERIES); public static final GrantedAuthority ADD_IMAGES_TO_SERIES = new SimpleGrantedAuthority(StringAuthority.ADD_IMAGES_TO_SERIES); public static final GrantedAuthority ADD_PARTICIPANT = new SimpleGrantedAuthority(StringAuthority.ADD_PARTICIPANT); public static final GrantedAuthority ADD_SERIES_SALES = new SimpleGrantedAuthority(StringAuthority.ADD_SERIES_SALES); - public static final GrantedAuthority MANAGE_TOGGLZ = new SimpleGrantedAuthority(StringAuthority.MANAGE_TOGGLZ); public static final GrantedAuthority CREATE_CATEGORY = new SimpleGrantedAuthority(StringAuthority.CREATE_CATEGORY); public static final GrantedAuthority CREATE_COUNTRY = new SimpleGrantedAuthority(StringAuthority.CREATE_COUNTRY); public static final GrantedAuthority CREATE_SERIES = new SimpleGrantedAuthority(StringAuthority.CREATE_SERIES); + public static final GrantedAuthority MANAGE_TOGGLZ = new SimpleGrantedAuthority(StringAuthority.MANAGE_TOGGLZ); public static final GrantedAuthority UPDATE_COLLECTION = new SimpleGrantedAuthority(StringAuthority.UPDATE_COLLECTION); - public static final GrantedAuthority VIEW_SITE_EVENTS = new SimpleGrantedAuthority(StringAuthority.VIEW_SITE_EVENTS); - public static final GrantedAuthority VIEW_SERIES_SALES = new SimpleGrantedAuthority(StringAuthority.VIEW_SERIES_SALES); public static final GrantedAuthority VIEW_DAILY_STATS = new SimpleGrantedAuthority(StringAuthority.VIEW_DAILY_STATS); + public static final GrantedAuthority VIEW_SERIES_SALES = new SimpleGrantedAuthority(StringAuthority.VIEW_SERIES_SALES); + public static final GrantedAuthority VIEW_SITE_EVENTS = new SimpleGrantedAuthority(StringAuthority.VIEW_SITE_EVENTS); private Authority() { } diff --git a/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java b/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java index cf72ec4551..ba5f1744d7 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/CustomUserDetailsService.java @@ -74,14 +74,15 @@ private static Collection getAuthorities(UserDetails authorities.add(Authority.UPDATE_COLLECTION); if (userDetails.isAdmin()) { + // Listed in alphabetical order. authorities.add(Authority.ADD_COMMENTS_TO_SERIES); authorities.add(Authority.ADD_IMAGES_TO_SERIES); - authorities.add(Authority.VIEW_SITE_EVENTS); authorities.add(Authority.ADD_PARTICIPANT); authorities.add(Authority.ADD_SERIES_SALES); - authorities.add(Authority.VIEW_SERIES_SALES); authorities.add(Authority.MANAGE_TOGGLZ); authorities.add(Authority.VIEW_DAILY_STATS); + authorities.add(Authority.VIEW_SERIES_SALES); + authorities.add(Authority.VIEW_SITE_EVENTS); } return authorities; diff --git a/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java b/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java index a6f54248eb..23016d60b5 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/HasAuthority.java @@ -19,15 +19,16 @@ @SuppressWarnings({ "checkstyle:linelength", "PMD.AvoidDuplicateLiterals" }) public final class HasAuthority { + // Constants are listed in alphabetical order. public static final String ADD_PARTICIPANT = "hasAuthority('" + StringAuthority.ADD_PARTICIPANT + "')"; public static final String ADD_SERIES_SALES = "hasAuthority('" + StringAuthority.ADD_SERIES_SALES + "')"; - public static final String CREATE_SERIES = "hasAuthority('" + StringAuthority.CREATE_SERIES + "')"; public static final String CREATE_CATEGORY = "hasAuthority('" + StringAuthority.CREATE_CATEGORY + "')"; public static final String CREATE_COUNTRY = "hasAuthority('" + StringAuthority.CREATE_COUNTRY + "')"; - public static final String VIEW_DAILY_STATS = "hasAuthority('" + StringAuthority.VIEW_DAILY_STATS + "')"; + public static final String CREATE_SERIES = "hasAuthority('" + StringAuthority.CREATE_SERIES + "')"; public static final String UPDATE_COLLECTION = "hasAuthority('" + StringAuthority.UPDATE_COLLECTION + "')"; - public static final String VIEW_SITE_EVENTS = "hasAuthority('" + StringAuthority.VIEW_SITE_EVENTS + "')"; + public static final String VIEW_DAILY_STATS = "hasAuthority('" + StringAuthority.VIEW_DAILY_STATS + "')"; public static final String VIEW_SERIES_SALES = "hasAuthority('" + StringAuthority.VIEW_SERIES_SALES + "')"; + public static final String VIEW_SITE_EVENTS = "hasAuthority('" + StringAuthority.VIEW_SITE_EVENTS + "')"; private HasAuthority() { } diff --git a/src/main/java/ru/mystamps/web/support/spring/security/StringAuthority.java b/src/main/java/ru/mystamps/web/support/spring/security/StringAuthority.java index 3c1f4be77b..de1dc04e02 100644 --- a/src/main/java/ru/mystamps/web/support/spring/security/StringAuthority.java +++ b/src/main/java/ru/mystamps/web/support/spring/security/StringAuthority.java @@ -18,18 +18,19 @@ package ru.mystamps.web.support.spring.security; public final class StringAuthority { + // Constants are listed in alphabetical order. public static final String ADD_COMMENTS_TO_SERIES = "ADD_COMMENTS_TO_SERIES"; public static final String ADD_IMAGES_TO_SERIES = "ADD_IMAGES_TO_SERIES"; public static final String ADD_PARTICIPANT = "ADD_PARTICIPANT"; public static final String ADD_SERIES_SALES = "ADD_SERIES_SALES"; - public static final String MANAGE_TOGGLZ = "MANAGE_TOGGLZ"; public static final String CREATE_CATEGORY = "CREATE_CATEGORY"; public static final String CREATE_COUNTRY = "CREATE_COUNTRY"; public static final String CREATE_SERIES = "CREATE_SERIES"; + public static final String MANAGE_TOGGLZ = "MANAGE_TOGGLZ"; public static final String UPDATE_COLLECTION = "UPDATE_COLLECTION"; - public static final String VIEW_SITE_EVENTS = "VIEW_SITE_EVENTS"; - public static final String VIEW_SERIES_SALES = "VIEW_SERIES_SALES"; public static final String VIEW_DAILY_STATS = "VIEW_DAILY_STATS"; + public static final String VIEW_SERIES_SALES = "VIEW_SERIES_SALES"; + public static final String VIEW_SITE_EVENTS = "VIEW_SITE_EVENTS"; private StringAuthority() { }