While registering the new user, I'd like to be able to save additional data. 
In the default installation, there was a 'plainAttrs' schema entry for
'email', which I replaced by lastname and firstname, both defined as String
types, not required, no validation, no integrity checks.

When I try to add user with these values set as "plainAttrs": [], the user
saves just fine.  When I add data there, as: 

  "plainAttrs": [
      {
          "schema":"firstname", 
          "values":["Test"]
      },
      {
          "schema":"lastname", 
          "values":["Last"]
      }
  ] 

it fails to save, the following error found in core-persistence.log:

14:16:39.348 WARN 
org.apache.syncope.core.persistence.jpa.validation.entity.EntityValidationListener
- Bean validation errors found:
[ConstraintViolationImpl{rootBean=JPAUser[null], propertyPath='plainAttrs',
message='InvalidPlainAttr;lastname not allowed for this instance',
leafBean=JPAUser[null], value=JPAUser[null]}]

and core-rest.log contains more details:

15:35:35.729 ERROR
org.apache.syncope.core.rest.cxf.RestServiceExceptionMapper - Exception
thrown
org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException:
JPAUser [InvalidPlainAttr]
        at
org.apache.syncope.core.persistence.jpa.validation.entity.EntityValidationListener.validate(EntityValidationListener.java:71)
~[syncope-core-persistence-jpa-2.0.2.jar:2.0.2]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[?:1.8.0_66]
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[?:1.8.0_66]
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[?:1.8.0_66]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_66]
        at
org.apache.openjpa.event.BeanLifecycleCallbacks.makeCallback(BeanLifecycleCallbacks.java:85)
~[openjpa-kernel-2.4.2.jar:2.4.2]


Then configuration for Plain Attrs looks like this:

(select id, `mandatoryCondition`, multivalue, readonly, type,
uniqueConstraint, validatorClass from PlainSchema where id like '%name')

id      mandatoryCondition      multivalue      readonly        type    
uniqueConstraint
validatorClass
firstname       false   0       0       String  0       NULL
lastname        false   0       0       String  0       NULL

Why am I not able to save these 2 attributes during self-registration?

--
View this message in context: 
http://syncope-user.1051894.n5.nabble.com/Custom-Attributes-tp5709084.html
Sent from the syncope-user mailing list archive at Nabble.com.

Reply via email to