You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by co...@apache.org on 2013/01/31 17:07:47 UTC
svn commit: r1441037 - in /syncope/trunk:
common/src/main/java/org/apache/syncope/common/to/
console/src/main/java/org/apache/syncope/console/pages/panels/
console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/
Author: coheigea
Date: Thu Jan 31 16:07:47 2013
New Revision: 1441037
URL: http://svn.apache.org/viewvc?rev=1441037&view=rev
Log:
[SYNCOPE-297] - External Attributes are showing up for AccoundId/Password in Resource User Mappings
- Applying Francesco's modified version of my patch
Modified:
syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MappingTO.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
Modified: syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MappingTO.java
URL: http://svn.apache.org/viewvc/syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MappingTO.java?rev=1441037&r1=1441036&r2=1441037&view=diff
==============================================================================
--- syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MappingTO.java (original)
+++ syncope/trunk/common/src/main/java/org/apache/syncope/common/to/MappingTO.java Thu Jan 31 16:07:47 2013
@@ -77,7 +77,7 @@ public class MappingTO extends AbstractB
throw new IllegalArgumentException("Password attributes cannot be set as accountId");
}
- accountIdItem.setExtAttrName("__NAME__");
+ accountIdItem.setExtAttrName(null);
accountIdItem.setAccountid(true);
return this.addItem(accountIdItem);
@@ -105,7 +105,7 @@ public class MappingTO extends AbstractB
if (passwordItem == null) {
return this.removeItem(getPasswordItem());
} else {
- passwordItem.setExtAttrName("__PASSWORD__");
+ passwordItem.setExtAttrName(null);
passwordItem.setPassword(true);
return addItem(passwordItem);
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java?rev=1441037&r1=1441036&r2=1441037&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java Thu Jan 31 16:07:47 2013
@@ -297,7 +297,7 @@ public class ResourceMappingPanel extend
final AjaxDropDownChoicePanel entitiesPanel = new AjaxDropDownChoicePanel("entities",
new ResourceModel("entities", "entities").getObject(), new Model(entity));
entitiesPanel.setChoices(attrType == AttributableType.ROLE
- ? Collections.singletonList(AttributableType.ROLE)
+ ? Collections.<AttributableType>singletonList(AttributableType.ROLE)
: Arrays.asList(AttributableType.values()));
entitiesPanel.setStyleSheet(DEF_FIELD_STYLE);
entitiesPanel.getField().add(new AjaxFormComponentUpdatingBehavior(ON_CHANGE) {
@@ -324,12 +324,17 @@ public class ResourceMappingPanel extend
"extAttrNames").getObject(), new PropertyModel<String>(mapItem, "extAttrName"));
} else {
extAttrName = new AjaxDropDownChoicePanel<String>("extAttrName", new ResourceModel("extAttrNames",
- "extAttrNames").getObject(), new PropertyModel(mapItem, "extAttrName"));
+ "extAttrNames").getObject(), new PropertyModel(mapItem, "extAttrName"), false);
((AjaxDropDownChoicePanel) extAttrName).setChoices(schemaNames);
}
boolean required = false;
- if (mapItem != null && !mapItem.isAccountid() && !mapItem.isPassword()) {
- required = true;
+ if (mapItem != null) {
+ boolean accountIdOrPassword = mapItem.isAccountid() || mapItem.isPassword();
+ if (!accountIdOrPassword) {
+ required = true;
+ } else if (accountIdOrPassword && !schemaNames.isEmpty()) {
+ ((AjaxDropDownChoicePanel) extAttrName).setModelObject(null);
+ }
}
extAttrName.setRequired(required);
extAttrName.setEnabled(required);
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java?rev=1441037&r1=1441036&r2=1441037&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java Thu Jan 31 16:07:47 2013
@@ -20,7 +20,6 @@ package org.apache.syncope.console.wicke
import java.io.Serializable;
import java.util.List;
-
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.CheckBox;
@@ -74,7 +73,6 @@ public class AjaxCheckBoxPanel extends F
Boolean value = null;
if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
-
value = "true".equalsIgnoreCase(list.get(0).toString());
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java?rev=1441037&r1=1441036&r2=1441037&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxDropDownChoicePanel.java Thu Jan 31 16:07:47 2013
@@ -20,7 +20,6 @@ package org.apache.syncope.console.wicke
import java.util.Collections;
import java.util.List;
-
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
@@ -34,13 +33,17 @@ public class AjaxDropDownChoicePanel<T>
private static final long serialVersionUID = -4716376580659196095L;
public AjaxDropDownChoicePanel(final String id, final String name, final IModel<T> model) {
+ this(id, name, model, true);
+ }
+ public AjaxDropDownChoicePanel(final String id, final String name, final IModel<T> model, boolean enableOnBlur) {
super(id, name, model);
- field = new DropDownChoice("dropDownChoiceField", model, Collections.emptyList(), new ChoiceRenderer());
+ field = new DropDownChoice<T>("dropDownChoiceField", model, Collections.<T>emptyList(),
+ new ChoiceRenderer<T>());
add(field.setLabel(new Model(name)).setOutputMarkupId(true));
- if (!isReadOnly()) {
+ if (enableOnBlur) {
field.add(new AjaxFormComponentUpdatingBehavior("onblur") {
private static final long serialVersionUID = -1107858522700306810L;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java?rev=1441037&r1=1441036&r2=1441037&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java Thu Jan 31 16:07:47 2013
@@ -20,7 +20,6 @@ package org.apache.syncope.console.wicke
import java.io.Serializable;
import java.util.List;
-
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.FormComponent;
@@ -165,7 +164,7 @@ public abstract class FieldPanel<T exten
public FieldPanel clone() {
final FieldPanel panel;
try {
- panel = this.getClass().getConstructor(new Class[] { String.class, String.class, IModel.class })
+ panel = this.getClass().getConstructor(new Class[]{String.class, String.class, IModel.class})
.newInstance(id, name, new Model(null));
} catch (Exception e) {
LOG.error("Error cloning field panel", e);