This topic is locked
[SOLVED]

 User rights on a record

7/22/2019 11:45:50 PM
PHPRunner General questions
W
WilliamB authorDevClub member

I am using the calendar template. I have an admin that adds calendar events for first sessions of the staff. The problem is that the admin now has ownership of the event and the staff can't edit that event. I am wondering if anyone has put something in place for a situation like this. I am using dynamic permissions. I have the advanced security setting "Users can see other users data, can edit their own data only" and this is what I need to override via code if possible.
I have another field on the event that is the therapist for that event. Maybe I can use that in this case.



if($_SESSION["User"]==$values["Therapist"]){

//Override default setting

};


Basically I need to have two owners of these records.
Thanks All,

Billy

admin 7/23/2019

Do not use Advanced Security for this table/view but implement IsRecordEditable event:

https://xlinesoft.com/phprunner/docs/isrecordeditable.htm

W
WilliamB authorDevClub member 7/23/2019

Thanks for the quick answer! I have tried to use this with no luck. It seems that the calendar v3 template uses it's own security on "List page: Before processed" I changed it to the below code and it works perfectly now. No need to change edit page code.



if($_SESSION["User"]==$val["Therapist"])

$elem["editable"] = true;

elseif($val["OwnerID"]==$_SESSION["EMPID"])

$elem["editable"] = true;

elseif($val["OwnerID"]!=$_SESSION["EMPID"] && $_SESSION["UserGroup"]=="Admin")

$elem["editable"] = true;

else

$elem["editable"] = false;


Billy