X-Git-Url: http://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fauth%2FImpliedByPrincipal.java;fp=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Finternal%2Fauth%2FImpliedByPrincipal.java;h=0000000000000000000000000000000000000000;hp=9e0ebce97d230ec24828ccbbb548786855013ae6;hb=b95462873703848193e56fcbe997693630db6121;hpb=55d88fba80cec198a0f11ba7545e19878c51fc5e diff --git a/org.argeo.cms/src/org/argeo/cms/internal/auth/ImpliedByPrincipal.java b/org.argeo.cms/src/org/argeo/cms/internal/auth/ImpliedByPrincipal.java deleted file mode 100644 index 9e0ebce97..000000000 --- a/org.argeo.cms/src/org/argeo/cms/internal/auth/ImpliedByPrincipal.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.argeo.cms.internal.auth; - -import java.security.Principal; -import java.util.HashSet; -import java.util.Set; - -import javax.xml.namespace.QName; - -import org.argeo.cms.RoleNameUtils; -import org.osgi.service.useradmin.Authorization; - -/** - * A {@link Principal} which has been implied by an {@link Authorization}. If it - * is empty it means this is an additional identity, otherwise it lists the - * users (typically the logged in user but possibly empty - * {@link ImpliedByPrincipal}s) which have implied it. When an additional - * identity is removed, the related {@link ImpliedByPrincipal}s can thus be - * removed. - */ -public final class ImpliedByPrincipal implements Principal { - private final String name; - private final QName roleName; - private final boolean systemRole; - private final String context; - - private Set causes = new HashSet(); - - public ImpliedByPrincipal(String name, Principal userPrincipal) { - this.name = name; - roleName = RoleNameUtils.getLastRdnAsName(name); - systemRole = RoleNameUtils.isSystemRole(roleName); - context = RoleNameUtils.getContext(name); - if (userPrincipal != null) - causes.add(userPrincipal); - } - - public String getName() { - return name; - } - - /* - * OBJECT - */ - - public QName getRoleName() { - return roleName; - } - - public String getContext() { - return context; - } - - public boolean isSystemRole() { - return systemRole; - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof ImpliedByPrincipal) { - ImpliedByPrincipal that = (ImpliedByPrincipal) obj; - // TODO check members too? - return name.equals(that.name); - } - return false; - } - - @Override - public String toString() { - return name.toString(); - } -}