public JetspeedPrincipalAssociationTypeImpl(String associationName, JetspeedPrincipalType fromType, JetspeedPrincipalType toType, boolean required, boolean dependent, boolean singular, boolean dominant) { this.associationName = associationName; this.fromType = fromType; this.toType = toType; this.required = required; this.dependent = dependent; this.singular = singular; this.dominant = dominant; this.mixedTypes = !fromType.getName().equals(toType.getName()); }
public JetspeedPrincipalManager getManager(JetspeedPrincipalType type) { return managersMap.get(type.getName()); }
protected final void validatePrincipal(JetspeedPrincipal principal) { if (!principal.getType().getName().equals(principalType.getName())) { throw new IllegalArgumentException("Principal is not of type "+principalType.getName()); } if (principal.isTransient()) { throw new IllegalArgumentException("Principal is transient"); } }
public final List<? extends JetspeedPrincipal> getAssociatedFrom(String principalFromName, JetspeedPrincipalType from, String associationName) { if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, from.getName(), principalType.getName()))) { return Collections.emptyList(); } return jpam.getAssociatedFrom(principalFromName, from, principalType, associationName); }
public final List<String> getAssociatedNamesTo(String principalToName, JetspeedPrincipalType to, String associationName) { if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, principalType.getName(), to.getName()))) { return Collections.emptyList(); } return jpam.getAssociatedNamesTo(principalToName, principalType, to, associationName); }
public final List<String> getAssociatedNamesFrom(String principalFromName, JetspeedPrincipalType from, String associationName) { if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, from.getName(), principalType.getName()))) { return Collections.emptyList(); } return jpam.getAssociatedNamesFrom(principalFromName, from, principalType, associationName); }
public final List<? extends JetspeedPrincipal> getAssociatedTo(String principalToName, JetspeedPrincipalType to, String associationName) { if ( !assHandlers.containsKey(new AssociationHandlerKey(associationName, principalType.getName(), to.getName()))) { return Collections.emptyList(); } return jpam.getAssociatedTo(principalToName, principalType, to, associationName); }
protected TransientJetspeedPrincipal() { type = jpmp.getPrincipalTypeByClassName(getClass().getName()).getName(); }
public void addSubjectPrincipalsResolver(UserSubjectPrincipalsResolver resolver) { this.usprMap.put(resolver.getPrincipalType().getName(), resolver); } }
public JetspeedPrincipalResultList getPrincipals(JetspeedPrincipalQueryContext queryContext, JetspeedPrincipalType type, Long securityDomain) { // paged principal queries not cached: used only for UI purposes where // results should reflect exact set of principals in database JetspeedPrincipalLookupManager jppm = jpplf.getJetspeedPrincipalLookupManager(); queryContext.put(JetspeedPrincipalQueryContext.JETSPEED_PRINCIPAL_TYPE, type.getName()); queryContext.put(JetspeedPrincipalQueryContext.SECURITY_DOMAIN, securityDomain); return jppm.getPrincipals(queryContext); }
public void removePrincipal(String name) throws SecurityException { JetspeedPrincipal principal = jpam.getPrincipal(name, principalType); if (principal == null) { throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(principalType.getName(),name)); } removePrincipal(principal); }
private JSPrincipalAssociation createJSPrincipalAssociation(String associationName, JetspeedPrincipal from, JetspeedPrincipal to) { JSPrincipalAssociation jsAssoc = new JSPrincipalAssociation(); jsAssoc.setName(associationName); jsAssoc.setFromType(from.getType().getName()); jsAssoc.setFromName(from.getName()); jsAssoc.setToType(to.getType().getName()); jsAssoc.setToName(to.getName()); return jsAssoc; }
public void addAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName) throws SecurityException { if (!SynchronizationStateAccess.isSynchronizing() && !ldapEntityManager.isReadOnly()) { SecurityEntityRelationType relationType = ldapEntityManager.getSupportedEntityRelationType(associationName, from.getType().getName(), to.getType().getName()); if (relationType != null && relationType.isCreateAllowed()) { ldapEntityManager.addRelation(from.getName(), to.getName(), relationType); } } databaseStorageManager.addAssociation(from, to, associationName); }
public String toString() { return getType().getName()+": "+getName()+" (id: "+(getId())+", transient: "+isTransient()+", mapped: "+isMapped()+")"; }
public void removeAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName) throws SecurityException { if (!SynchronizationStateAccess.isSynchronizing() && !ldapEntityManager.isReadOnly()) { SecurityEntityRelationType relationType = ldapEntityManager.getSupportedEntityRelationType(associationName, from.getType().getName(), to.getType().getName()); if (relationType != null && relationType.isRemoveAllowed()) { ldapEntityManager.removeRelation(from.getName(), to.getName(), relationType); } } databaseStorageManager.removeAssociation(from, to, associationName); } }
public void setEnabled(boolean enabled) throws SecurityException { if (isReadOnly() && !isSynchronizing()) { throw new SecurityException(SecurityException.PRINCIPAL_IS_READ_ONLY.createScoped(getType().getName(), getName())); } this.enabled = enabled; }
public void addPrincipal(JetspeedPrincipal principal, Set<JetspeedPrincipalAssociationReference> associations) throws SecurityException { if (!SynchronizationStateAccess.isSynchronizing() && !ldapEntityManager.isReadOnly()) { EntityFactory entityFactory = ldapEntityManager.getEntityFactory(principal.getType().getName()); if (entityFactory.isCreateAllowed()) { ldapEntityManager.addEntity(entityFactory.createEntity(principal)); } } delegateJpsm.addPrincipal(principal, associations); }
public void removePrincipal(JetspeedPrincipal principal) throws SecurityException { if (!SynchronizationStateAccess.isSynchronizing() && !ldapEntityManager.isReadOnly()) { EntityFactory entityFactory = ldapEntityManager.getEntityFactory(principal.getType().getName()); if (entityFactory.isRemoveAllowed()) { ldapEntityManager.removeEntity(entityFactory.createEntity(principal)); } } delegateJpsm.removePrincipal(principal); }
public void updatePrincipal(JetspeedPrincipal principal) throws SecurityException { validatePrincipal(principal); if (principal.isReadOnly() && !isSynchronizing()) { throw new SecurityException(SecurityException.PRINCIPAL_IS_READ_ONLY.createScoped(principal.getType().getName(), principal.getName())); } jpsm.updatePrincipal(principal); notifyUpdatedPrincipal(principal); }