Skip to content
Snippets Groups Projects
Unverified Commit 3998f77f authored by Timm Fitschen's avatar Timm Fitschen
Browse files

STY: formatting

parent f33df066
No related branches found
No related tags found
No related merge requests found
......@@ -31,14 +31,10 @@ import java.util.Map.Entry;
public abstract class AbstractEntityACLFactory<T extends EntityACL> {
private final Map<ResponsibleAgent, Long> normalGrants =
new HashMap<>();
private final Map<ResponsibleAgent, Long> priorityGrants =
new HashMap<>();
private final Map<ResponsibleAgent, Long> normalDenials =
new HashMap<>();
private final Map<ResponsibleAgent, Long> priorityDenials =
new HashMap<>();
private final Map<ResponsibleAgent, Long> normalGrants = new HashMap<>();
private final Map<ResponsibleAgent, Long> priorityGrants = new HashMap<>();
private final Map<ResponsibleAgent, Long> normalDenials = new HashMap<>();
private final Map<ResponsibleAgent, Long> priorityDenials = new HashMap<>();
public void grant(final ResponsibleAgent role, final int... permissionBitNumber) {
grant(role, false, permissionBitNumber);
......@@ -183,8 +179,7 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
set.getKey(), this.normalDenials.get(set.getKey()) & ~set.getValue());
}
if (this.normalGrants.containsKey(set.getKey())) {
this.normalGrants.put(
set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
this.normalGrants.put(set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
}
}
for (final Entry<ResponsibleAgent, Long> set : this.priorityGrants.entrySet()) {
......@@ -193,14 +188,12 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
set.getKey(), this.normalDenials.get(set.getKey()) & ~set.getValue());
}
if (this.normalGrants.containsKey(set.getKey())) {
this.normalGrants.put(
set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
this.normalGrants.put(set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
}
}
for (final Entry<ResponsibleAgent, Long> set : this.normalDenials.entrySet()) {
if (this.normalGrants.containsKey(set.getKey())) {
this.normalGrants.put(
set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
this.normalGrants.put(set.getKey(), this.normalGrants.get(set.getKey()) & ~set.getValue());
}
}
}
......
......@@ -24,6 +24,10 @@ package caosdb.server.permissions;
import static caosdb.server.permissions.Role.OTHER_ROLE;
import static caosdb.server.permissions.Role.OWNER_ROLE;
import caosdb.server.accessControl.AuthenticationUtils;
import caosdb.server.accessControl.Principal;
import caosdb.server.database.exceptions.TransactionException;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Collection;
......@@ -36,9 +40,6 @@ import org.apache.shiro.subject.Subject;
import org.eclipse.jetty.util.ajax.JSON;
import org.jdom2.DataConversionException;
import org.jdom2.Element;
import caosdb.server.accessControl.AuthenticationUtils;
import caosdb.server.accessControl.Principal;
import caosdb.server.database.exceptions.TransactionException;
public class EntityACL {
......@@ -153,7 +154,8 @@ public class EntityACL {
private static boolean subjectIsOwner(
final Subject subject, final List<ResponsibleAgent> owners) {
for (final ResponsibleAgent owner : owners) {
if ((owner instanceof Role && subject.hasRole(owner.toString())) || (owner instanceof Principal && subject.getPrincipal().equals(owner))) {
if ((owner instanceof Role && subject.hasRole(owner.toString()))
|| (owner instanceof Principal && subject.getPrincipal().equals(owner))) {
return true;
}
}
......
package caosdb.server.permissions;
import java.util.Collection;
public class EntityACLFactory extends AbstractEntityACLFactory<EntityACL> {
@Override
protected EntityACL create(final Collection<EntityACI> acis) {
return new EntityACL(acis);
}
}
......@@ -22,10 +22,10 @@
*/
package caosdb.server.permissions;
import caosdb.server.accessControl.UserSources;
import java.util.HashMap;
import org.jdom2.Attribute;
import org.jdom2.Element;
import caosdb.server.accessControl.UserSources;
public class Role implements ResponsibleAgent {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment