@@ -63,12 +63,12 @@ public void removeProperty(Closure<RemovePropertyOptions> closure) {
6363 public void addToGroup (GroupOptions options ) {
6464 AclGroup group = context .determineGroup (options .getGroup (), options .getGroupId ());
6565 String groupId = context .determineId (options .getGroup (), options .getGroupId ());
66-
66+
6767 if (group == null ) {
6868 context .getLogger ().info ("Skipped adding authorizable '{}' to group '{}' (group not found)" , id , groupId );
6969 return ;
7070 }
71-
71+
7272 boolean changed = context .getAuthorizableManager ().addMember (group .get (), authorizable );
7373 if (changed ) {
7474 context .getLogger ().info ("Added authorizable '{}' to group '{}'" , id , groupId );
@@ -92,12 +92,13 @@ public void addToGroup(AclGroup group) {
9292 public void removeFromGroup (GroupOptions options ) {
9393 AclGroup group = context .determineGroup (options .getGroup (), options .getGroupId ());
9494 String groupId = context .determineId (options .getGroup (), options .getGroupId ());
95-
95+
9696 if (group == null ) {
97- context .getLogger ().info ("Skipped removing authorizable '{}' from group '{}' (group not found)" , id , groupId );
97+ context .getLogger ()
98+ .info ("Skipped removing authorizable '{}' from group '{}' (group not found)" , id , groupId );
9899 return ;
99100 }
100-
101+
101102 boolean changed = context .getAuthorizableManager ().removeMember (group .get (), authorizable );
102103 if (changed ) {
103104 context .getLogger ().info ("Removed authorizable '{}' from group '{}'" , id , groupId );
@@ -132,7 +133,8 @@ public void removeFromAllGroups() {
132133 if (anyChanged ) {
133134 context .getLogger ().info ("Removed authorizable '{}' from all groups" , id );
134135 } else {
135- context .getLogger ().info ("Skipped removing authorizable '{}' from all groups (not a member of any group)" , id );
136+ context .getLogger ()
137+ .info ("Skipped removing authorizable '{}' from all groups (not a member of any group)" , id );
136138 }
137139 } catch (RepositoryException e ) {
138140 throw new AclException (String .format ("Cannot remove authorizable '%s' from all groups!" , id ), e );
@@ -145,18 +147,27 @@ public void clear(ClearOptions options) {
145147
146148 public void clear (String path , boolean strict ) {
147149 if (context .isCompositeNodeStore () && isAppsOrLibsPath (path )) {
148- context .getLogger ().info ("Skipped clearing permissions for authorizable '{}' at path '{}' (composite node store)" , id , path );
150+ context .getLogger ()
151+ .info (
152+ "Skipped clearing permissions for authorizable '{}' at path '{}' (composite node store)" ,
153+ id ,
154+ path );
149155 return ;
150156 }
151157 if (context .getResourceResolver ().getResource (path ) == null ) {
152- context .getLogger ().info ("Skipped clearing permissions for authorizable '{}' at path '{}' (path not found)" , id , path );
158+ context .getLogger ()
159+ .info ("Skipped clearing permissions for authorizable '{}' at path '{}' (path not found)" , id , path );
153160 return ;
154161 }
155162 boolean changed = context .getPermissionsManager ().clear (authorizable , path , strict );
156163 if (changed ) {
157164 context .getLogger ().info ("Cleared permissions for authorizable '{}' at path '{}'" , id , path );
158165 } else {
159- context .getLogger ().info ("Skipped clearing permissions for authorizable '{}' at path '{}' (no permissions to clear)" , id , path );
166+ context .getLogger ()
167+ .info (
168+ "Skipped clearing permissions for authorizable '{}' at path '{}' (no permissions to clear)" ,
169+ id ,
170+ path );
160171 }
161172 }
162173
@@ -173,25 +184,41 @@ private void apply(PermissionsOptions options, boolean allow) {
173184 List <String > permissions = options .determineAllPermissions ();
174185 Map <String , Object > restrictions = options .determineAllRestrictions ();
175186 PermissionsOptions .Mode mode = options .getMode ();
176-
187+
177188 if (context .isCompositeNodeStore () && isAppsOrLibsPath (path )) {
178189 String actionDescription = allow ? "allow permissions" : "deny permissions" ;
179- context .getLogger ().info ("Skipped setting {} for authorizable '{}' at path '{}' (composite node store)" , actionDescription , id , path );
190+ context .getLogger ()
191+ .info (
192+ "Skipped setting {} for authorizable '{}' at path '{}' (composite node store)" ,
193+ actionDescription ,
194+ id ,
195+ path );
180196 return ;
181197 }
182-
198+
183199 if (context .getResourceResolver ().getResource (path ) == null ) {
184200 if (mode == PermissionsOptions .Mode .FAIL ) {
185- throw new AclException (String .format ("Cannot apply permissions for authorizable '%s' at path '%s'! (path not found)" , id , path ));
201+ throw new AclException (String .format (
202+ "Cannot apply permissions for authorizable '%s' at path '%s'! (path not found)" , id , path ));
186203 }
187204 String actionDescription = allow ? "allow permissions" : "deny permissions" ;
188- context .getLogger ().info ("Skipped setting {} for authorizable '{}' at path '{}' (path not found)" , actionDescription , id , path );
205+ context .getLogger ()
206+ .info (
207+ "Skipped setting {} for authorizable '{}' at path '{}' (path not found)" ,
208+ actionDescription ,
209+ id ,
210+ path );
189211 return ;
190212 }
191-
213+
192214 if (context .getPermissionsManager ().check (authorizable , path , permissions , restrictions , allow )) {
193215 String actionDescription = allow ? "allow permissions" : "deny permissions" ;
194- context .getLogger ().info ("Skipped setting {} for authorizable '{}' at path '{}' (already set)" , actionDescription , id , path );
216+ context .getLogger ()
217+ .info (
218+ "Skipped setting {} for authorizable '{}' at path '{}' (already set)" ,
219+ actionDescription ,
220+ id ,
221+ path );
195222 } else {
196223 context .getPermissionsManager ().apply (authorizable , path , permissions , restrictions , allow );
197224 String actionDescription = allow ? "allow permissions" : "deny permissions" ;
@@ -230,7 +257,8 @@ public void removeProperty(String relPath) {
230257 if (changed ) {
231258 context .getLogger ().info ("Removed property '{}' for authorizable '{}'" , relPath , id );
232259 } else {
233- context .getLogger ().info ("Skipped removing property '{}' for authorizable '{}' (property not set)" , relPath , id );
260+ context .getLogger ()
261+ .info ("Skipped removing property '{}' for authorizable '{}' (property not set)" , relPath , id );
234262 }
235263 }
236264
0 commit comments