Skip to content

Commit c22b681

Browse files
committed
refactor: move SUGGEST_SERIES_COUNTRY constant to CountryUrl.
Should be in 232d41e and 3d03247 commits. Addressed to #927 No functional changes.
1 parent f53a9b9 commit c22b681

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/main/java/ru/mystamps/web/Url.java

-3
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ public final class Url {
6161

6262
public static final String IMPORT_SERIES_SALES = "/series/sales/import";
6363

64-
public static final String SUGGEST_SERIES_COUNTRY = "/suggest/series_country";
65-
6664
public static final String FORBIDDEN_PAGE = "/error/403";
6765
public static final String NOT_FOUND_PAGE = "/error/404";
6866
public static final String INTERNAL_ERROR_PAGE = "/error/500";
@@ -136,7 +134,6 @@ public static Map<String, String> asMap(boolean production) {
136134
map.put("REQUEST_IMPORT_SERIES_PAGE", REQUEST_IMPORT_SERIES_PAGE);
137135
map.put("SEARCH_SERIES_BY_CATALOG", SEARCH_SERIES_BY_CATALOG);
138136
map.put("SITE_EVENTS_PAGE", SITE_EVENTS_PAGE);
139-
map.put("SUGGEST_SERIES_COUNTRY", SUGGEST_SERIES_COUNTRY);
140137

141138
if (serveContentFromSingleHost) {
142139
ImageUrl.exposeResourcesToView(map);

src/main/java/ru/mystamps/web/feature/country/CountryUrl.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
@SuppressWarnings("PMD.CommentDefaultAccessModifier")
3030
public final class CountryUrl {
3131

32-
public static final String ADD_COUNTRY_PAGE = "/country/add";
33-
static final String GET_COUNTRIES_PAGE = "/countries";
34-
static final String INFO_COUNTRY_PAGE = "/country/{slug}";
32+
public static final String SUGGEST_SERIES_COUNTRY = "/suggest/series_country";
33+
public static final String ADD_COUNTRY_PAGE = "/country/add";
34+
static final String GET_COUNTRIES_PAGE = "/countries";
35+
static final String INFO_COUNTRY_PAGE = "/country/{slug}";
3536

3637
// For backward compatibility
3738
static final String LIST_COUNTRIES_PAGE = "/country/list";
@@ -44,6 +45,7 @@ public static void exposeUrlsToView(Map<String, String> urls) {
4445
urls.put("ADD_COUNTRY_PAGE", ADD_COUNTRY_PAGE);
4546
urls.put("GET_COUNTRIES_PAGE", GET_COUNTRIES_PAGE);
4647
urls.put("INFO_COUNTRY_PAGE", INFO_COUNTRY_PAGE);
48+
urls.put("SUGGEST_SERIES_COUNTRY", SUGGEST_SERIES_COUNTRY);
4749
}
4850

4951
}

src/main/java/ru/mystamps/web/feature/country/SuggestionController.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.commons.lang3.StringUtils;
2222
import org.springframework.web.bind.annotation.GetMapping;
2323
import org.springframework.web.bind.annotation.RestController;
24-
import ru.mystamps.web.Url;
2524
import ru.mystamps.web.support.spring.security.CurrentUser;
2625

2726
@RestController
@@ -34,7 +33,7 @@ class SuggestionController {
3433
* @author John Shkarin
3534
* @author Slava Semushin
3635
*/
37-
@GetMapping(Url.SUGGEST_SERIES_COUNTRY)
36+
@GetMapping(CountryUrl.SUGGEST_SERIES_COUNTRY)
3837
public String suggestCountryForUser(@CurrentUser Integer currentUserId) {
3938
return StringUtils.defaultString(
4039
countryService.suggestCountryForUser(currentUserId),

src/main/java/ru/mystamps/web/support/spring/security/SecurityConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ protected void configure(HttpSecurity http) throws Exception {
9090
.mvcMatchers(Url.ADD_SERIES_PAGE).hasAuthority(StringAuthority.CREATE_SERIES)
9191
.mvcMatchers(Url.REQUEST_IMPORT_SERIES_PAGE).hasAuthority(StringAuthority.IMPORT_SERIES)
9292
.mvcMatchers(Url.SITE_EVENTS_PAGE).hasAuthority(StringAuthority.VIEW_SITE_EVENTS)
93-
.mvcMatchers(Url.SUGGEST_SERIES_COUNTRY).hasAuthority(StringAuthority.CREATE_SERIES)
93+
.mvcMatchers(CountryUrl.SUGGEST_SERIES_COUNTRY).hasAuthority(StringAuthority.CREATE_SERIES)
9494
.mvcMatchers(Url.DAILY_STATISTICS).hasAuthority(StringAuthority.VIEW_DAILY_STATS)
9595
// @todo #884 /collection/{slug}/estimation: only owner should have access to estimation page
9696
.mvcMatchers(CollectionUrl.ESTIMATION_COLLECTION_PAGE).hasAuthority(StringAuthority.ADD_SERIES_PRICE)

0 commit comments

Comments
 (0)