|
18 | 18 |
|
19 | 19 | import java.security.Principal; |
20 | 20 | import java.util.Arrays; |
21 | | -import java.util.Collection; |
22 | 21 | import java.util.Collections; |
23 | 22 | import java.util.HashSet; |
24 | | -import java.util.List; |
25 | 23 | import java.util.Map; |
26 | 24 | import java.util.Set; |
27 | 25 | import java.util.TreeSet; |
|
41 | 39 | import biz.netcentric.cq.tools.actool.comparators.AcePermissionComparator; |
42 | 40 | import biz.netcentric.cq.tools.actool.configmodel.AcConfiguration; |
43 | 41 | import biz.netcentric.cq.tools.actool.configmodel.AceBean; |
44 | | -import biz.netcentric.cq.tools.actool.configmodel.Restriction; |
45 | 42 | import biz.netcentric.cq.tools.actool.helper.AccessControlUtils; |
46 | 43 | import biz.netcentric.cq.tools.actool.helper.ContentHelper; |
47 | 44 | import biz.netcentric.cq.tools.actool.helper.RestrictionsHolder; |
@@ -168,25 +165,15 @@ protected boolean installPrivileges(AceBean aceBean, Principal principal, Jackra |
168 | 165 | * @throws UnsupportedRepositoryOperationException |
169 | 166 | * @throws RepositoryException */ |
170 | 167 | protected RestrictionsHolder getRestrictions(AceBean aceBean, Session session, JackrabbitAccessControlList acl) |
171 | | - throws ValueFormatException, UnsupportedRepositoryOperationException, RepositoryException { |
172 | | - |
173 | | - final Collection<String> supportedRestrictionNames = Arrays.asList(acl.getRestrictionNames()); |
| 168 | + throws RepositoryException { |
174 | 169 |
|
175 | 170 | if (aceBean.getRestrictions().isEmpty()) { |
176 | 171 | return RestrictionsHolder.empty(); |
177 | 172 | } |
178 | | - |
179 | | - List<Restriction> restrictions = aceBean.getRestrictions(); |
180 | | - for (Restriction restriction : restrictions) { |
181 | | - if (!supportedRestrictionNames.contains(restriction.getName())) { |
182 | | - throw new IllegalStateException( |
183 | | - "The AccessControlList at " + acl.getPath() + " does not support setting " + restriction.getName() |
184 | | - + " restrictions!"); |
185 | | - } |
186 | | - } |
187 | | - |
188 | | - RestrictionsHolder restrictionsHolder = new RestrictionsHolder(restrictions, session.getValueFactory(), acl); |
189 | | - return restrictionsHolder; |
| 173 | + // no need to check if restrictions are supported, Oak is lenient nowadays and does the proper checks internally |
| 174 | + // see https://github.com/apache/jackrabbit-oak/blob/17281282fe82d0f0c4e86d0a42ecfb20bfe404e3/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/accesscontrol/ACL.java#L213 |
| 175 | + // also it supports non-mandatory restrictions like the ones from com.adobe.cq.dam.assetmetadatarestrictionprovider.impl.AssetMetadataRestrictionProvider |
| 176 | + return new RestrictionsHolder(aceBean.getRestrictions(), session.getValueFactory(), acl); |
190 | 177 | } |
191 | 178 |
|
192 | 179 | /** Converts the given privilege names into a set of privilege objects. |
|
0 commit comments