jcc
Member
J! 2.5.9; Fabrik (github pull from master yesterday)
I have a list on a table which joins 3 additional tables; each repeatable. On this list, I want to allow users to edit their own records, so I have the Edit records Access "or use field" set to a column in one of the joined tables; prospect.user_id. This worked in earlier versions of 3.0.6.3(+github), but at some point my menu link to this form started reporting that the user did not have the ability to update the row and was redirected to the detail view instead of the form.
I have finally had some time to investigate this and this is what I found. The FabrikWorker function canUserDo would fail to find the prospect.user_id column. I found that the function failed to find the column in the $row array because the $row array representing the data from the database has the joined tables as subarrays and the array_key_exists does not do a recursive search through subarrays.
To solve this problem, I have added a function FArrayHelper::getNestedKeyExists which does the recursive search and modified the FabrikWorker::canUserDo function to use it instead of array_key_exists and FArrayHelper::getNestedValue instead of $row[$usercol].
I have the changes committed in github and can make a pull request, if interested.
I have a list on a table which joins 3 additional tables; each repeatable. On this list, I want to allow users to edit their own records, so I have the Edit records Access "or use field" set to a column in one of the joined tables; prospect.user_id. This worked in earlier versions of 3.0.6.3(+github), but at some point my menu link to this form started reporting that the user did not have the ability to update the row and was redirected to the detail view instead of the form.
I have finally had some time to investigate this and this is what I found. The FabrikWorker function canUserDo would fail to find the prospect.user_id column. I found that the function failed to find the column in the $row array because the $row array representing the data from the database has the joined tables as subarrays and the array_key_exists does not do a recursive search through subarrays.
To solve this problem, I have added a function FArrayHelper::getNestedKeyExists which does the recursive search and modified the FabrikWorker::canUserDo function to use it instead of array_key_exists and FArrayHelper::getNestedValue instead of $row[$usercol].
I have the changes committed in github and can make a pull request, if interested.