You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by an...@apache.org on 2017/06/27 14:07:20 UTC

syncope git commit: Fixes [SYNCOPE-1110], [SYNCOPE-1123]

Repository: syncope
Updated Branches:
  refs/heads/master 636985db6 -> 11ab8cb9a


Fixes [SYNCOPE-1110], [SYNCOPE-1123]


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/11ab8cb9
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/11ab8cb9
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/11ab8cb9

Branch: refs/heads/master
Commit: 11ab8cb9a824efa48d5c98613b174ec2633dfa29
Parents: 636985d
Author: Matteo Alessandroni <ma...@tirasa.net>
Authored: Fri Jun 23 14:27:17 2017 +0200
Committer: Andrea Patricelli <an...@apache.org>
Committed: Tue Jun 27 16:07:00 2017 +0200

----------------------------------------------------------------------
 .../client/enduser/model/CustomAttribute.java   |  6 +-
 .../enduser/resources/BaseUserSelfResource.java | 99 +++++++++++++++-----
 .../resources/UserSelfCreateResource.java       |  5 +-
 .../enduser/resources/UserSelfReadResource.java | 48 ++++------
 .../resources/UserSelfUpdateResource.java       | 31 ++++--
 .../enduser/util/UserRequestValidator.java      | 34 +++----
 .../src/test/resources/protractor-conf.js       |  6 +-
 .../src/test/resources/tests/create.js          |  8 +-
 8 files changed, 144 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CustomAttribute.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CustomAttribute.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CustomAttribute.java
index 80d65f6..7d713f0 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CustomAttribute.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/model/CustomAttribute.java
@@ -26,18 +26,18 @@ public class CustomAttribute implements Serializable {
 
     private static final long serialVersionUID = 4910266842123376686L;
 
-    private Boolean readonly;
+    private boolean readonly;
 
     private List<String> defaultValues = new ArrayList<>();
 
     public CustomAttribute() {
     }
 
-    public Boolean getReadonly() {
+    public boolean isReadonly() {
         return readonly;
     }
 
-    public void setReadonly(final Boolean readonly) {
+    public void setReadonly(final boolean readonly) {
         this.readonly = readonly;
     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
index a3e73e8..670d603 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/BaseUserSelfResource.java
@@ -21,10 +21,14 @@ package org.apache.syncope.client.enduser.resources;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.HashSet;
+import org.apache.commons.collections4.Predicate;
+import java.util.Set;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Transformer;
 import org.apache.commons.lang3.time.FastDateFormat;
+import org.apache.syncope.client.enduser.model.CustomAttributesInfo;
+import org.apache.syncope.common.lib.patch.AttrPatch;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 
@@ -32,40 +36,49 @@ public abstract class BaseUserSelfResource extends BaseResource {
 
     private static final long serialVersionUID = -5892402817902884085L;
 
-    protected void dateToMillis(final Map<String, AttrTO> plainAttrMap, final PlainSchemaTO plainSchema)
+    protected void dateToMillis(final Set<AttrTO> attrs, final PlainSchemaTO plainSchema)
             throws ParseException {
-        if (plainAttrMap.containsKey(plainSchema.getKey())) {
-            FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
 
-            AttrTO dateAttr = plainAttrMap.get(plainSchema.getKey());
-            List<String> milliValues = new ArrayList<>(dateAttr.getValues().size());
-            for (String value : dateAttr.getValues()) {
-                milliValues.add(String.valueOf(fmt.parse(value).getTime()));
+        for (AttrTO attr : attrs) {
+            if (attr.getSchema().equals(plainSchema.getKey())) {
+                CollectionUtils.transform(attr.getValues(), new Transformer<String, String>() {
+
+                    @Override
+                    public String transform(final String input) {
+                        try {
+                            return String.valueOf(fmt.parse(input).getTime());
+                        } catch (ParseException ex) {
+                            LOG.error("Unable to parse date {}", input);
+                            return input;
+                        }
+                    }
+                });
             }
-            dateAttr.getValues().clear();
-            dateAttr.getValues().addAll(milliValues);
         }
     }
 
-    protected void millisToDate(final Map<String, AttrTO> plainAttrMap, final PlainSchemaTO plainSchema)
+    protected void millisToDate(final Set<AttrTO> attrs, final PlainSchemaTO plainSchema)
             throws IllegalArgumentException {
-        if (plainAttrMap.containsKey(plainSchema.getKey())) {
-            FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+        final FastDateFormat fmt = FastDateFormat.getInstance(plainSchema.getConversionPattern());
+        for (AttrTO attr : attrs) {
+            if (attr.getSchema().equals(plainSchema.getKey())) {
+                CollectionUtils.transform(attr.getValues(), new Transformer<String, String>() {
 
-            AttrTO dateAttr = plainAttrMap.get(plainSchema.getKey());
-            List<String> formattedValues = new ArrayList<>(dateAttr.getValues().size());
-            for (String value : dateAttr.getValues()) {
-                try {
-                    formattedValues.add(fmt.format(Long.valueOf(value)));
-                } catch (NumberFormatException e) {
-                    throw new IllegalArgumentException("Invalid format value for " + value);
-                }
+                    @Override
+                    public String transform(final String input) {
+                        try {
+                            return fmt.format(Long.valueOf(input));
+                        } catch (NumberFormatException ex) {
+                            LOG.error("Invalid format value for {}", input);
+                            return input;
+                        }
+                    }
+                });
             }
-            dateAttr.getValues().clear();
-            dateAttr.getValues().addAll(formattedValues);
         }
     }
-    
+
     protected void buildResponse(final ResourceResponse response, final int statusCode, final String message) {
         response.setTextEncoding(StandardCharsets.UTF_8.name());
         response.setStatusCode(statusCode);
@@ -78,4 +91,38 @@ public abstract class BaseUserSelfResource extends BaseResource {
         });
     }
 
+    protected void customizeAttrTOs(final Set<AttrTO> attrs, final CustomAttributesInfo customAttributesInfo) {
+        if (customAttributesInfo != null
+                && customAttributesInfo.getShow()
+                && !customAttributesInfo.getAttributes().isEmpty()) {
+            Set<AttrTO> attrsToAdd = new HashSet<>();
+            for (AttrTO attr : attrs) {
+                if (customAttributesInfo.getAttributes().containsKey(attr.getSchema())) {
+                    attrsToAdd.add(attr);
+                }
+            }
+            attrs.clear();
+            attrs.addAll(attrsToAdd);
+        } else if (customAttributesInfo != null && !customAttributesInfo.getShow()) {
+            attrs.clear();
+        }
+    }
+
+    protected void customizeAttrPatches(final Set<AttrPatch> attrs, final CustomAttributesInfo customAttributesInfo) {
+        if (customAttributesInfo != null
+                && customAttributesInfo.getShow()
+                && !customAttributesInfo.getAttributes().isEmpty()) {
+            CollectionUtils.filter(attrs, new Predicate<AttrPatch>() {
+
+                @Override
+                public boolean evaluate(final AttrPatch patchPlainAttr) {
+                    // if membership attribute clean schema name coming from custom form
+                    return customAttributesInfo.getAttributes().containsKey(patchPlainAttr.getAttrTO().getSchema());
+                }
+            });
+        } else if (customAttributesInfo != null && !customAttributesInfo.getShow()) {
+            attrs.clear();
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
index 66320f2..00bc356 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfCreateResource.java
@@ -31,7 +31,6 @@ import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.annotations.Resource;
 import org.apache.syncope.client.enduser.util.UserRequestValidator;
-import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.SyncopeClientException;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
@@ -116,9 +115,9 @@ public class UserSelfCreateResource extends BaseUserSelfResource {
 
                     // 2. millis -> Date conversion for PLAIN attributes of USER and its MEMBERSHIPS
                     for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
-                        millisToDate(EntityTOUtils.buildAttrMap(userTO.getPlainAttrs()), plainSchema);
+                        millisToDate(userTO.getPlainAttrs(), plainSchema);
                         for (MembershipTO membership : userTO.getMemberships()) {
-                            millisToDate(EntityTOUtils.buildAttrMap(membership.getPlainAttrs()), plainSchema);
+                            millisToDate(membership.getPlainAttrs(), plainSchema);
                         }
                     }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
index 9e6feba..924800c 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfReadResource.java
@@ -21,20 +21,15 @@ package org.apache.syncope.client.enduser.resources;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.Map;
-import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.commons.lang3.SerializationUtils;
 import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.annotations.Resource;
-import org.apache.syncope.client.enduser.model.CustomAttribute;
 import org.apache.syncope.client.enduser.model.CustomAttributesInfo;
-import org.apache.syncope.common.lib.EntityTOUtils;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
@@ -64,11 +59,10 @@ public class UserSelfReadResource extends BaseUserSelfResource {
 
             UserTO userTO = SerializationUtils.clone(SyncopeEnduserSession.get().getSelfTO());
 
-            // 1. Date -> millis conversion for PLAIN attributes of USER and its MEMBERSHIPS
+            // 1. Date -> millis conversion for PLAIN MEMBERSHIPS attributes of USER
             for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
-                dateToMillis(EntityTOUtils.buildAttrMap(userTO.getPlainAttrs()), plainSchema);
                 for (MembershipTO membership : userTO.getMemberships()) {
-                    dateToMillis(EntityTOUtils.buildAttrMap(membership.getPlainAttrs()), plainSchema);
+                    dateToMillis(membership.getPlainAttrs(), plainSchema);
                 }
             }
 
@@ -95,21 +89,11 @@ public class UserSelfReadResource extends BaseUserSelfResource {
                 membership.getVirAttrs().clear();
             }
             // USER from customization, if empty or null ignore it, use it to filter attributes otherwise
-            Map<String, CustomAttributesInfo> customForm = SyncopeEnduserApplication.get().getCustomForm();
+            applyFromCustomization(userTO, SyncopeEnduserApplication.get().getCustomForm());
 
-            if (customForm != null && !customForm.isEmpty()) {
-                if (customForm.get(SchemaType.PLAIN.name()) != null) {
-                    // filter PLAIN attributes
-                    customizeAttrs(userTO.getPlainAttrs(), customForm.get(SchemaType.PLAIN.name()).getAttributes());
-                }
-                if (customForm.get(SchemaType.DERIVED.name()) != null) {
-                    // filter DERIVED attributes
-                    customizeAttrs(userTO.getDerAttrs(), customForm.get(SchemaType.DERIVED.name()).getAttributes());
-                }
-                if (customForm.get(SchemaType.VIRTUAL.name()) != null) {
-                    // filter VIRTUAL attributes
-                    customizeAttrs(userTO.getVirAttrs(), customForm.get(SchemaType.VIRTUAL.name()).getAttributes());
-                }
+            // 1.1 Date -> millis conversion for PLAIN attributes of USER
+            for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
+                dateToMillis(userTO.getPlainAttrs(), plainSchema);
             }
             final String selfTOJson = MAPPER.writeValueAsString(userTO);
             response.setContentType(MediaType.APPLICATION_JSON);
@@ -134,15 +118,15 @@ public class UserSelfReadResource extends BaseUserSelfResource {
         return response;
     }
 
-    private void customizeAttrs(final Set<AttrTO> attrs,
-            final Map<String, CustomAttribute> customForm) {
-
-        CollectionUtils.filter(attrs, new Predicate<AttrTO>() {
-
-            @Override
-            public boolean evaluate(final AttrTO attr) {
-                return customForm.containsKey(attr.getSchema());
-            }
-        });
+    private void applyFromCustomization(final UserTO userTO, final Map<String, CustomAttributesInfo> customForm) {
+        if (customForm != null && !customForm.isEmpty()) {
+            // filter PLAIN attributes
+            customizeAttrTOs(userTO.getPlainAttrs(), customForm.get(SchemaType.PLAIN.name()));
+            // filter DERIVED attributes
+            customizeAttrTOs(userTO.getDerAttrs(), customForm.get(SchemaType.DERIVED.name()));
+            // filter VIRTUAL attributes
+            customizeAttrTOs(userTO.getVirAttrs(), customForm.get(SchemaType.VIRTUAL.name()));
+        }
     }
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
index 4aaa2f4..c72c62c 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/resources/UserSelfUpdateResource.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.client.enduser.resources;
 
 import java.util.HashSet;
+import java.util.Map;
 import java.util.Set;
 import javax.servlet.http.HttpServletRequest;
 import javax.ws.rs.core.MediaType;
@@ -30,13 +31,15 @@ import org.apache.syncope.client.enduser.SyncopeEnduserApplication;
 import org.apache.syncope.client.enduser.SyncopeEnduserConstants;
 import org.apache.syncope.client.enduser.SyncopeEnduserSession;
 import org.apache.syncope.client.enduser.annotations.Resource;
+import org.apache.syncope.client.enduser.model.CustomAttributesInfo;
 import org.apache.syncope.client.enduser.util.UserRequestValidator;
 import org.apache.syncope.common.lib.AnyOperations;
-import org.apache.syncope.common.lib.EntityTOUtils;
+import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.to.AttrTO;
 import org.apache.syncope.common.lib.to.MembershipTO;
 import org.apache.syncope.common.lib.to.PlainSchemaTO;
 import org.apache.syncope.common.lib.to.UserTO;
+import org.apache.syncope.common.lib.types.SchemaType;
 import org.apache.syncope.common.rest.api.service.UserSelfService;
 import org.apache.wicket.request.resource.AbstractResource;
 import org.apache.wicket.request.resource.IResource;
@@ -66,9 +69,10 @@ public class UserSelfUpdateResource extends BaseUserSelfResource {
             }
 
             UserTO userTO = MAPPER.readValue(request.getReader().readLine(), UserTO.class);
+            Map<String, CustomAttributesInfo> customForm = SyncopeEnduserApplication.get().getCustomForm();
 
             // check if request is compliant with customization form rules
-            if (UserRequestValidator.compliant(userTO, SyncopeEnduserApplication.get().getCustomForm(), false)) {
+            if (UserRequestValidator.compliant(userTO, customForm, false)) {
                 // 1. membership attributes management
                 Set<AttrTO> membAttrs = new HashSet<>();
                 for (AttrTO attr : userTO.getPlainAttrs()) {
@@ -97,9 +101,9 @@ public class UserSelfUpdateResource extends BaseUserSelfResource {
 
                 // 2. millis -> Date conversion for PLAIN attributes of USER and its MEMBERSHIPS
                 for (PlainSchemaTO plainSchema : SyncopeEnduserSession.get().getDatePlainSchemas()) {
-                    millisToDate(EntityTOUtils.buildAttrMap(userTO.getPlainAttrs()), plainSchema);
+                    millisToDate(userTO.getPlainAttrs(), plainSchema);
                     for (MembershipTO membership : userTO.getMemberships()) {
-                        millisToDate(EntityTOUtils.buildAttrMap(membership.getPlainAttrs()), plainSchema);
+                        millisToDate(membership.getPlainAttrs(), plainSchema);
                     }
                 }
 
@@ -154,10 +158,13 @@ public class UserSelfUpdateResource extends BaseUserSelfResource {
                 }
                 userTO.getVirAttrs().removeAll(membAttrs);
 
+                UserPatch userPatch = AnyOperations.diff(userTO, SyncopeEnduserSession.get().getSelfTO(), false);
+
+                applyFormCustomization(userPatch, customForm);
+
                 // update user by patch
                 Response res = SyncopeEnduserSession.get().
-                        getService(userTO.getETagValue(), UserSelfService.class).update(AnyOperations.diff(userTO,
-                        SyncopeEnduserSession.get().getSelfTO(), true));
+                        getService(userTO.getETagValue(), UserSelfService.class).update(userPatch);
 
                 buildResponse(response, res.getStatus(), res.getStatusInfo().getFamily().equals(
                         Response.Status.Family.SUCCESSFUL)
@@ -182,4 +189,16 @@ public class UserSelfUpdateResource extends BaseUserSelfResource {
         return response;
     }
 
+    private void applyFormCustomization(final UserPatch userPatch, final Map<String, CustomAttributesInfo> customForm) {
+        final CustomAttributesInfo customPlainAttrsInfo = customForm.get(SchemaType.PLAIN.name());
+        final CustomAttributesInfo customVirtualAttrsInfo = customForm.get(SchemaType.VIRTUAL.name());
+        // clean patch to avoid unwanted deletions of hidden schemas (custom form)
+        if (customPlainAttrsInfo != null) {
+            customizeAttrPatches(userPatch.getPlainAttrs(), customPlainAttrsInfo);
+        }
+        if (customVirtualAttrsInfo != null) {
+            customizeAttrTOs(userPatch.getVirAttrs(), customPlainAttrsInfo);
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/client/enduser/src/main/java/org/apache/syncope/client/enduser/util/UserRequestValidator.java
----------------------------------------------------------------------
diff --git a/client/enduser/src/main/java/org/apache/syncope/client/enduser/util/UserRequestValidator.java b/client/enduser/src/main/java/org/apache/syncope/client/enduser/util/UserRequestValidator.java
index 32f5551..b5253af 100644
--- a/client/enduser/src/main/java/org/apache/syncope/client/enduser/util/UserRequestValidator.java
+++ b/client/enduser/src/main/java/org/apache/syncope/client/enduser/util/UserRequestValidator.java
@@ -40,7 +40,7 @@ public final class UserRequestValidator {
     public static boolean compliant(final UserTO userTO, final Map<String, CustomAttributesInfo> customForm,
             final boolean checkDefaultValues) {
 
-        if (customForm.isEmpty()) {
+        if (customForm == null || customForm.isEmpty()) {
             return true;
         }
 
@@ -55,26 +55,28 @@ public final class UserRequestValidator {
     private static boolean validateAttributes(final Map<String, AttrTO> attrMap,
             final CustomAttributesInfo customAttrInfo, final boolean checkDefaultValues) {
 
-        return IterableUtils.matchesAll(attrMap.entrySet(), new Predicate<Map.Entry<String, AttrTO>>() {
+        return customAttrInfo == null
+                || (customAttrInfo.getAttributes().isEmpty() && customAttrInfo.getShow())
+                || IterableUtils.matchesAll(attrMap.entrySet(), new Predicate<Map.Entry<String, AttrTO>>() {
 
-            @Override
-            public boolean evaluate(final Map.Entry<String, AttrTO> entry) {
-                String schemaKey = entry.getKey();
-                AttrTO attrTO = entry.getValue();
-                CustomAttribute customAttr = customAttrInfo.getAttributes().get(schemaKey);
-                boolean compliant = customAttr != null && (!checkDefaultValues || isValid(attrTO, customAttr));
-                if (!compliant) {
-                    LOG.trace("Attribute [{}] or its values [{}] are not allowed by form customization rules",
-                            attrTO.getSchema(), attrTO.getValues());
-                }
-                return compliant;
-            }
-        });
+                    @Override
+                    public boolean evaluate(final Map.Entry<String, AttrTO> entry) {
+                        String schemaKey = entry.getKey();
+                        AttrTO attrTO = entry.getValue();
+                        CustomAttribute customAttr = customAttrInfo.getAttributes().get(schemaKey);
+                        boolean compliant = customAttr != null && (!checkDefaultValues || isValid(attrTO, customAttr));
+                        if (!compliant) {
+                            LOG.trace("Attribute [{}] or its values [{}] are not allowed by form customization rules",
+                                    attrTO.getSchema(), attrTO.getValues());
+                        }
+                        return compliant;
+                    }
+                });
 
     }
 
     private static boolean isValid(final AttrTO attrTO, final CustomAttribute customAttribute) {
-        return customAttribute.getReadonly()
+        return customAttribute.isReadonly()
                 ? IterableUtils.matchesAll(attrTO.getValues(), new Predicate<String>() {
 
                     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/fit/enduser-reference/src/test/resources/protractor-conf.js
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/test/resources/protractor-conf.js b/fit/enduser-reference/src/test/resources/protractor-conf.js
index efc31f9..5cf6532 100644
--- a/fit/enduser-reference/src/test/resources/protractor-conf.js
+++ b/fit/enduser-reference/src/test/resources/protractor-conf.js
@@ -23,13 +23,13 @@ exports.config = {
     'phantomjs.binary.path': '${phantomjs.binary}',
     'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
   },
-  
+
   allScriptsTimeout: 241000,
-  
+
   jasmineNodeOpts: {
     defaultTimeoutInterval: 2500000
   },
-  
+
   // Spec patterns are relative to the current working directly when protractor is called.
   specs: ['tests/*.js'],
   exclude: ['tests/abstract.js']

http://git-wip-us.apache.org/repos/asf/syncope/blob/11ab8cb9/fit/enduser-reference/src/test/resources/tests/create.js
----------------------------------------------------------------------
diff --git a/fit/enduser-reference/src/test/resources/tests/create.js b/fit/enduser-reference/src/test/resources/tests/create.js
index 0da74b4..b1f049f 100644
--- a/fit/enduser-reference/src/test/resources/tests/create.js
+++ b/fit/enduser-reference/src/test/resources/tests/create.js
@@ -52,10 +52,10 @@ describe('syncope enduser user create', function () {
     //plainSchemas
     abstract.waitSpinner();
     browser.wait(element(by.name('fullname')).isPresent());
-    element.all(by.name('fullname')).first().sendKeys('Gaetano Donizetti');
-    element.all(by.name('userId')).first().sendKeys('donizetti@apache.org');
-    element.all(by.name('firstname')).first().sendKeys('Gaetano');
-    element.all(by.name('surname')).first().sendKeys('Donizetti');
+    element.all(by.name('fullname')).first().clear().sendKeys('Gaetano Donizetti');
+    element.all(by.name('userId')).first().clear().sendKeys('donizetti@apache.org');
+    element.all(by.name('firstname')).first().clear().sendKeys('Gaetano');
+    element.all(by.name('surname')).first().clear().sendKeys('Donizetti');
     element.all(by.id('next')).first().click();
 
     //derivedSchemas,virtualSchemas,resources