Resolution: Won't Fix
Affects Version/s: None
Fix Version/s: None
Problem: When a nuxeo-user-suggestion is pre-filled with a user (value set in the Empty Document Created event), the value saved is prefixed with user: if the current user does not change the preset value. If the dropdown i used, then the value is saved with no prefix.
Reproduce: targuillere-SANDBOX, branch feature/test-preassignment tested with 10.10HF04
- MyDoc has 2 fields, owner, type User/Group and owner_received, string
- Listener on Empty Document Created set mydoc:owner to the current user
- Listener on About to Create set the value of mydoc:owner_received to the value of mydoc:owner (this is done to quickly see the result. Same would be done with looking at the JSON)
- Run a server (10.10HF04), login as Administrator/Administrator, deploy the project, create a workspace
- Create a new MyDoc, fill only the title, let the default value for owner, save => user saved is prefixed user:Administrator
- Back to the workspace, create a new MyDoc, this time, remove the user set by default and reselect it in the dropdown, save => user saved is correct Administrator
Note: In the layout, see that the "Prefixed" property is not checked.
Workaround: In "about to create", detect the prefix is there and remove it.
======== Second test, showing the pain server side.
Other test that shows it breaks server side.
There is a "Document Created" event, MyDoc_DocCreated, that calls the MyDoc_DocCreated chain:
- Only if the title is "TestAddPermission"
- The chain calls Document.AddPermission to give "Everything" to the user set as medic:owner
- Login as Administrator
- Create a Workspace, say "ws"
- Change permissions: Add "ReadWrite" for "members"
- In a private window (or just logout) login as johni/johni (this user is in the U&G of Studio and creation policy is "Always")
- Navigate to "ws"
- Create a new MyDoc
- Do not change the default "owner"
- just set a title to "TestAddPermission "
- Click "Create"
=> Error: The following set of User or Group names do not exist: [user:johni]
2019-04-12T10:28:56,981 ERROR [http-nio-0.0.0.0-8080-exec-9] [org.nuxeo.ecm.automation.core.events.OperationEventListener] Failed to handle event documentCreated using chain: MyDoc_DocCreated org.nuxeo.ecm.webengine.model.exceptions.IllegalParameterException: Failed to invoke operation Document.AddPermission with aliases [Document.AddACL], The following set of User or Group names do not exist: [user:johni]. Please provide valid ones. at org.nuxeo.ecm.automation.core.operations.document.AddPermission.validateParameters(AddPermission.java:186) ~[nuxeo-automation-core-10.10-HF04.jar:?]
This error happens because the value set in the field by WebUI is prefixed in this case (not changing the value set by default)
- is related to
NXP-30840 Fix CurrentUser MVEL object applying "user:" prefix to name property
NXDOC-1902 Add information about the usage of user/group prefix