Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions src/main/java/ru/mystamps/web/Url.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,31 +118,32 @@ private Url() {
}

public static Map<String, String> 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<String, String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ private static Collection<? extends GrantedAuthority> 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
}
Expand Down