File tree 3 files changed +6
-3
lines changed
src/main/java/ru/mystamps/web
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 754
754
<showWarnings >true</showWarnings >
755
755
<debug >false</debug >
756
756
<failOnWarning >true</failOnWarning >
757
+ <!-- Required for using method's parameters inside of @PreAuthorize expressions -->
758
+ <parameters >true</parameters >
757
759
</configuration >
758
760
</plugin >
759
761
Original file line number Diff line number Diff line change @@ -152,10 +152,9 @@ public List<LinkEntityDto> findRecentlyCreated(int quantity) {
152
152
}
153
153
154
154
// @todo #884 CollectionService.findSeriesWithPricesBySlug(): add unit tests
155
- // @todo #884 CollectionService.findSeriesWithPricesBySlug(): restrict access by only an owner
156
155
@ Override
157
156
@ Transactional (readOnly = true )
158
- @ PreAuthorize (HasAuthority .ADD_SERIES_PRICE )
157
+ @ PreAuthorize (HasAuthority .ADD_SERIES_PRICE_AND_COLLECTION_OWNER )
159
158
public List <SeriesInCollectionWithPriceDto > findSeriesWithPricesBySlug (
160
159
String slug ,
161
160
String lang ) {
Original file line number Diff line number Diff line change 21
21
public final class HasAuthority {
22
22
// Constants sorted in an ascending order.
23
23
public static final String ADD_PARTICIPANT = "hasAuthority('" + StringAuthority .ADD_PARTICIPANT + "')" ;
24
- public static final String ADD_SERIES_PRICE = "hasAuthority('" + StringAuthority .ADD_SERIES_PRICE + "')" ;
24
+ @ SuppressWarnings ("PMD.LongVariable" )
25
+ public static final String ADD_SERIES_PRICE_AND_COLLECTION_OWNER
26
+ = "hasAuthority('" + StringAuthority .ADD_SERIES_PRICE + "') and principal?.userCollectionSlug == #slug" ;
25
27
public static final String ADD_SERIES_SALES = "hasAuthority('" + StringAuthority .ADD_SERIES_SALES + "')" ;
26
28
public static final String CREATE_CATEGORY = "hasAuthority('" + StringAuthority .CREATE_CATEGORY + "')" ;
27
29
public static final String CREATE_COUNTRY = "hasAuthority('" + StringAuthority .CREATE_COUNTRY + "')" ;
You can’t perform that action at this time.
0 commit comments