Issue
- We're looking into giving a user the ability to remove their own form records; however we found that the owner of a forminstancerecord cannot remove the forminstancerecord unless they get the permission to remove the parent form.
-
create a new form 'test'
add one text field
configure form and click require authentication
publish form
Configure the permissions of the form and allow role User 'Add Form Instance Record' permission
Click the share button and open the link (something like http://localhost:8080/web/forms/shared/-/form/37115)
Fill in the text field and submit the formcreate a regular user testuser
open another browser and login with the testuser
go to the form url from the share link (something like http://localhost:8080/web/forms/shared/-/form/37115)
Fill in the text field and submit the formAs admin
(1) go to http://localhost:8080/api/jsonws?contextName=ddm&signature=%2Fddm.ddmforminstance%2Fget-form-instance-1-long#serviceResults
Fill in the ddmFormInstanceId using the id from the url (in my case 37115); click Invoke
Note that you get the form definition for the test form(2) Go to http://localhost:8080/api/jsonws?contextName=ddm&signature=%2Fddm.ddmforminstancerecord%2Fget-form-instance-records-1-long#serviceResults
Fill in the ddmFormInstanceId using the id from the url (in my case 37115); click Invoke
Note that you get the form records for both users
Record the formInstanceRecordId for both records; in my case the id is 37140 for the record for the regular user, 37149 for the record for the adminRepeat the 2 steps as the regular user; note that both requests give empty results (since we dont have 'view' permission on the form definition)
As the regular user:
(3) Go to http://localhost:8080/api/jsonws?contextName=ddm&signature=%2Fddm.ddmforminstancerecord%2Fdelete-form-instance-record-1-long and try to remove both records; both will return {} but will not remove anything, because you dont have the appropriate permission (even though this user is owner for his own record)As the admin
Add the 'delete' permission to the form for the User roleAs the regular user:
(3) Go to http://localhost:8080/api/jsonws?contextName=ddm&signature=%2Fddm.ddmforminstancerecord%2Fdelete-form-instance-record-1-long and try again to remove both records; both records can now be removedAs the admin
Remove 'delete' permission to the form for the User role and add the 'view' permission
Fill in the form againAs the regular user
Fill in the form again
Note that the regular user can now request the form definition (request 1) as well as all records (request 2); the user cannot remove either of the recordsSo to summarize...
1. Liferay forces inheritance between the form definition and the underlying records
2. It's not possible to let the user 'remove' and 'see' _only_ their own records
3. There is no way in the UI to do anything with permissions on the records (other then in role definitions); my guess is that this is why this inheritance existsWhat we want:
We want the owner of the form records to be able to see and remove only their own records without having to get any additional permissions on the form. -
Currently, it is possible to define permissions at the form level that apply to both the form and its entries.
It would be interesting to be able to define permissions on form entries, separately from the permissions on the form.
This would allow users, for example, to delete form entries without being able to delete the form itself.
Environment
- QR
Resolution
- This is a limitation of how Forms permission are designed and this will not change (especially since there is no more development done related to this component, the focus is rather on the mentioned Objects component). We are not planning to add this type of permission management at entry level in Forms. In the other hand, today, with Liferay Objects, it is already possible to create applications that require entry permission management out of the box.