Lost ability for user to edit their own data

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 some sort of block when it comes to git...anyways, I think I have the CRLF issues in hand...now I just need to figure-out how to do a pull request for just the 3 files I modified instead of all the CRLF fixes that. I can't seem to figure-out how to just request a pull for 1 commit instead of every one I've every made...
 
I don't think you can, but I'm still struggling to get to grips with git, and as I never do pull requests (I work directly on the master) I have no experience of how to do them.

A quick google says that 'git cherry-pick' may be what you need, though.

-- hugh
 
Thanks Hugh. Your googling skills certainly exceed my own.

I'm struggling through how to use the cherry-pick. So far, I see how to grab a commit from someone else, but not yet how to create a pull based on my own commit. I'll keep digging...no, I see "dig" is another git command...I'll keep struggling.
 
LOL!

One way is to simply to make use of branches, which are very easy to create.

I *think* one way of doing it is to branch your fork. Make your changes on that branch, and make the pull request from there. Then you can merge those changes into your branch that has those other changes and commits in it. What I'm not sure of is if / how you can make the pull request from the branch direct to the master, rather than your fork.

Another useful feature when juggling multiple changes on a branch is stashing, which you might want to read up on.

-- hugh
 
BTW, how I use stashing is ...

If I'm working on some changes, but haven't finished them, and find I then need to commit a fix for some other issue to the same file(s) right now, I'll 'git stash', which saves the changes and reverts the file(s) from the HEAD. Make the "other issue" changes to the files, and commit them. Then 'git stash apply' to merge my saved stash back in to my files.

You can optionally "name" your stashes, so you can selectively stash / apply different change sets.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top