allow user to add record to non-owned record

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
sticcino
User
Posts: 1043

allow user to add record to non-owned record

Post by sticcino »

have master-detail:

non-admin users cannot add or modify master record, but have the need to add records to the detail table.

by reviewing the messages below, is it possible to assign the userid to master records userid or authorize the user to insert into the detail table even though doesn't own it?,

found these.... if i read this correctly
"The current user (%c) is not authorized to assign the user ID" -- is there a function then that will allow me to authorize the current

<phrase id="unauthorizeduserid" value="The current user (%c) is not authorized to assign the user ID (%u)." />
<phrase id="unauthorizedparentuserid" value="The current user (%c) is not authorized to assign the parent user ID (%p)." />
<phrase id="unauthorizedmasteruserid" value="The current user (%c) is not authorized to insert the record. Master filter: %f" />

any way to allow this scenerio ?

note:

interestingly enough, a user that doesn't own the master record can edit the detail record -- which is what I need.... but just to be able to insert...

another interesting thing is
I have one master/detail that the non-owner can edit the detail records, but on another set of master/detail the user can't edit.. it returns "no record found". and they are both setup the same in the security settings.

thanks,'


mobhar
User
Posts: 11726

Post by mobhar »

If you see the generated code, then it is related to "isValidUserID" function that belongs to the "AdvancedSecurity" class (assume you're using v2019).

So, if you see in deep that "isValidUserID" function, then it will return a boolean value based on this logic:

return in_array(trim(strval($userId)), $this->UserID);

In other words, make sure you have already added the desired user ID by using "addUserID" method that belongs to the "Security" object in "UserID_Loaded" server event, so the the current logged in user can add the record. Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info.


Post Reply