Skip to content

Commit ba3af08

Browse files
committed
Improvements for BaseAclAdvice
Add a strategies for resolving a parent ACL identities and objects
1 parent 8d92bcf commit ba3af08

8 files changed

Lines changed: 318 additions & 375 deletions

File tree

gsec/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@
4949
<artifactId>commons-logging</artifactId>
5050
</dependency>
5151

52+
<dependency>
53+
<groupId>org.apache.commons</groupId>
54+
<artifactId>commons-collections4</artifactId>
55+
<version>4.5.0</version>
56+
</dependency>
57+
5258
<!-- Hibernate -->
5359
<dependency>
5460
<groupId>org.hibernate</groupId>
@@ -137,7 +143,7 @@
137143
<dependency>
138144
<groupId>org.json</groupId>
139145
<artifactId>json</artifactId>
140-
<version>20250107</version>
146+
<version>20251224</version>
141147
<optional>true</optional>
142148
</dependency>
143149
<dependency>
@@ -318,7 +324,7 @@
318324
<plugin>
319325
<groupId>org.codehaus.mojo</groupId>
320326
<artifactId>versions-maven-plugin</artifactId>
321-
<version>2.20.1</version>
327+
<version>2.21.0</version>
322328
<configuration>
323329
<dependencyExcludes>
324330
<dependencyExclude>org.hibernate:hibernate-core:*</dependencyExclude>

gsec/src/main/java/gemma/gsec/acl/BaseAclAdvice.java

Lines changed: 276 additions & 366 deletions
Large diffs are not rendered by default.

gsec/src/main/java/gemma/gsec/acl/ObjectTransientnessRetrievalStrategyImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package gemma.gsec.acl;
22

3-
import gemma.gsec.acl.ObjectTransientnessRetrievalStrategy;
43
import gemma.gsec.model.Securable;
54
import org.springframework.util.Assert;
65

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package gemma.gsec.acl;
2+
3+
import org.springframework.security.acls.model.ObjectIdentity;
4+
5+
import javax.annotation.Nullable;
6+
7+
/**
8+
* Strategy for locating parent ACL identities.
9+
*
10+
* @author poirigui
11+
*/
12+
public interface ParentIdentityRetrievalStrategy {
13+
14+
/**
15+
* Obtain the parent ACL identity for the given domain object.
16+
*
17+
* @return the parent ACL identity if it can be determined, null otherwise
18+
*/
19+
@Nullable
20+
ObjectIdentity getParentIdentity( Object domainObject );
21+
}

gsec/src/main/java/gemma/gsec/acl/domain/AclObjectIdentity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.springframework.util.Assert;
2626
import org.springframework.util.ClassUtils;
2727

28+
import javax.annotation.Nullable;
2829
import java.util.HashSet;
2930
import java.util.Objects;
3031
import java.util.Set;
@@ -49,6 +50,7 @@ public class AclObjectIdentity implements ObjectIdentity {
4950

5051
private AclSid ownerSid;
5152

53+
@Nullable
5254
private AclObjectIdentity parentObject;
5355

5456
private Set<AclEntry> entries = new HashSet<>();
@@ -138,11 +140,12 @@ public void setOwnerSid( Sid ownerSid ) {
138140
this.ownerSid = ( AclSid ) ownerSid;
139141
}
140142

143+
@Nullable
141144
public AclObjectIdentity getParentObject() {
142145
return parentObject;
143146
}
144147

145-
public void setParentObject( AclObjectIdentity parentObject ) {
148+
public void setParentObject( @Nullable AclObjectIdentity parentObject ) {
146149
assert parentObject != this && !this.equals( parentObject );
147150
this.parentObject = parentObject;
148151
}

gsec/src/main/java/gemma/gsec/model/Securable.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
package gemma.gsec.model;
2020

2121
/**
22-
* Interface that indicates an entity can be secured. By default, permissions are inherited by associated objects.
22+
* Interface that indicates an entity can be secured.
23+
* <p>
24+
* Securables have ACLs associated with them and may inherit permissions from parent securables (see {@link SecuredChild}), or
25+
* not (see {@link SecuredNotChild}).
2326
*
2427
* @author paul
2528
* @version $Id: Securable.java,v 1.4 2013/03/16 00:39:24 paul Exp $

gsec/src/main/java/gemma/gsec/model/SecuredChild.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@
1818
*/
1919
package gemma.gsec.model;
2020

21+
import javax.annotation.Nullable;
22+
2123
/**
22-
* Indicates a securable that must have a parent that holds the permissons. For example, BioAssays are given the same
23-
* permissions as the holding Experiment, and no object should have the BioAssay's ACL as its parent.
24+
* Indicates a {@link Securable} must have a parent from which it inherits permissions.
2425
*
2526
* @author paul
2627
* @version $Id: SecuredChild.java,v 1.3 2013/03/16 00:39:24 paul Exp $
2728
*/
2829
public interface SecuredChild extends Securable {
2930

31+
@Nullable
3032
Securable getSecurityOwner();
3133
}

gsec/src/main/java/gemma/gsec/model/SecuredNotChild.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
package gemma.gsec.model;
2020

2121
/**
22-
* Interface to mark entities which are secured, and which should not have 'parent's, and therefore do not inherit
23-
* permissions from other objects.
22+
* Indicates that a {@link Securable} cannot have a parent.
2423
*
2524
* @author paul
2625
* @version $Id: SecuredNotChild.java,v 1.2 2009/11/23 20:26:42 paul Exp $

0 commit comments

Comments
 (0)