File tree 5 files changed +14
-11
lines changed
java/ru/mystamps/web/support
webapp/WEB-INF/views/series
5 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public final class Authority {
30
30
public static final GrantedAuthority CREATE_CATEGORY = new SimpleGrantedAuthority (StringAuthority .CREATE_CATEGORY );
31
31
public static final GrantedAuthority CREATE_COUNTRY = new SimpleGrantedAuthority (StringAuthority .CREATE_COUNTRY );
32
32
public static final GrantedAuthority CREATE_SERIES = new SimpleGrantedAuthority (StringAuthority .CREATE_SERIES );
33
+ public static final GrantedAuthority DOWNLOAD_IMAGE = new SimpleGrantedAuthority (StringAuthority .DOWNLOAD_IMAGE );
33
34
public static final GrantedAuthority UPDATE_COLLECTION = new SimpleGrantedAuthority (StringAuthority .UPDATE_COLLECTION );
34
35
public static final GrantedAuthority VIEW_SITE_EVENTS = new SimpleGrantedAuthority (StringAuthority .VIEW_SITE_EVENTS );
35
36
public static final GrantedAuthority VIEW_SERIES_SALES = new SimpleGrantedAuthority (StringAuthority .VIEW_SERIES_SALES );
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ private static Collection<? extends GrantedAuthority> getAuthorities(UserDetails
79
79
authorities .add (Authority .VIEW_SITE_EVENTS );
80
80
authorities .add (Authority .ADD_PARTICIPANT );
81
81
authorities .add (Authority .ADD_SERIES_SALES );
82
+ authorities .add (Authority .DOWNLOAD_IMAGE );
82
83
authorities .add (Authority .VIEW_SERIES_SALES );
83
84
authorities .add (Authority .MANAGE_TOGGLZ );
84
85
}
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ public final class StringAuthority {
26
26
public static final String CREATE_CATEGORY = "CREATE_CATEGORY" ;
27
27
public static final String CREATE_COUNTRY = "CREATE_COUNTRY" ;
28
28
public static final String CREATE_SERIES = "CREATE_SERIES" ;
29
+ public static final String DOWNLOAD_IMAGE = "DOWNLOAD_IMAGE" ;
29
30
public static final String UPDATE_COLLECTION = "UPDATE_COLLECTION" ;
30
31
public static final String VIEW_SITE_EVENTS = "VIEW_SITE_EVENTS" ;
31
32
public static final String VIEW_SERIES_SALES = "VIEW_SERIES_SALES" ;
Original file line number Diff line number Diff line change @@ -82,11 +82,7 @@ public enum Features implements Feature {
82
82
83
83
@ Label ("/series/add: show link with auto-suggestions" )
84
84
@ EnabledByDefault
85
- SHOW_SUGGESTION_LINK ,
86
-
87
- @ Label ("/series/add: possibility to download image from external server" )
88
- @ EnabledByDefault
89
- DOWNLOAD_IMAGE ;
85
+ SHOW_SUGGESTION_LINK ;
90
86
91
87
public boolean isActive () {
92
88
return FeatureContext .getFeatureManager ().isActive (this );
Original file line number Diff line number Diff line change @@ -263,14 +263,16 @@ <h3 th:text="${#strings.capitalize(add_series)}">
263
263
Image
264
264
</ span >
265
265
<!--/*/
266
- <span id="image.required" class="required_field" togglz:inactive=" DOWNLOAD_IMAGE">*</span>
266
+ <span id="image.required" class="required_field" th:if="${not #authorization.expression('hasAuthority('' DOWNLOAD_IMAGE'')')} ">*</span>
267
267
/*/-->
268
268
</ label >
269
269
< div class ="col-sm-7 ">
270
- < input type ="file " id ="image " style ="box-shadow: none; border: 0px; " accept ="image/png,image/jpeg " th:field ="*{image} " togglz:active ="DOWNLOAD_IMAGE "/>
271
- <!--/*/
272
- <input type="file" id="image" style="box-shadow: none; border: 0px;" required="required" accept="image/png,image/jpeg" th:field="*{image}" togglz:inactive="DOWNLOAD_IMAGE"/>
273
- /*/-->
270
+ < input id ="image "
271
+ type ="file "
272
+ style ="box-shadow: none; border: 0px; "
273
+ accept ="image/png,image/jpeg "
274
+ th:field ="*{image} "
275
+ th:attr ="required=${not #authorization.expression('hasAuthority(''DOWNLOAD_IMAGE'')') ? 'required' : null} " />
274
276
< small togglz:active ="ADD_ADDITIONAL_IMAGES_TO_SERIES " sec:authorize ="hasAuthority('ADD_IMAGES_TO_SERIES') ">
275
277
< span class ="hint-block " th:text ="#{t_add_more_images_hint} ">
276
278
Later you will be able to add additional images
@@ -282,7 +284,9 @@ <h3 th:text="${#strings.capitalize(add_series)}">
282
284
</ div >
283
285
</ div >
284
286
285
- < div class ="form-group form-group-sm " th:classappend ="${#fields.hasErrors('imageUrl') or #fields.hasErrors('downloadedImage') ? 'has-error' : ''} " togglz:active ="DOWNLOAD_IMAGE ">
287
+ < div class ="form-group form-group-sm "
288
+ th:classappend ="${#fields.hasErrors('imageUrl') or #fields.hasErrors('downloadedImage') ? 'has-error' : ''} "
289
+ sec:authorize ="hasAuthority('DOWNLOAD_IMAGE') ">
286
290
< label for ="image-url " class ="control-label col-sm-3 ">
287
291
< span class ="field-label " th:text ="#{t_image_url} ">
288
292
Image URL
You can’t perform that action at this time.
0 commit comments