Add records ownership to supervisors

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
arcanebits
Veteran Member
Posts: 71
Joined: 2018-12-10 21:52

Add records ownership to supervisors

Post by arcanebits » 2022-04-25 22:47

Hi,
I have an app that sends a json to a php mysql appgini server via post, lets say is employees data.
They have a supervisor asigned. I used appgini to model all and data coming from employees is viewable and supervisor table is also there.

Now i need to supervisors only view data asigned to them. The data posted from employees may cone with the field data.supervisorid that may match supervisor.supervisorid.
How do i add ownership to the data inyected via post to respective fields when a x supervisor enters to appgini app?

Any help is welcome!
A3

arcanebits
Veteran Member
Posts: 71
Joined: 2018-12-10 21:52

Re: Add records ownership to supervisors

Post by arcanebits » 2022-04-25 23:31

Another thing that comes to my mind can be
1- Keep posting to the mysql the same way as today, i mean with no supervisorID (as I planned on previous post)
2- When appgini app start, seeks the eployee table top to boton to get supervisorsIDassigned field in each record of employee
3- Use gotten supervisorsIDassigned from employee and update data from POST/App and paste supervisorsIDassigned on its according records
4- Use the same way (I DONT KNOW HOT TO DO) to make when user(supervisor) logs in and navigate, just view record from POST/App that has its supervisorsIDassigned in thesupervisorsIDassigned field.

I suggest this since its easier in a way, cause this way doesnt need to update the C#/Unity app then the AppGini Code.

Really need that help, Im sure some one will come with an easy answer and im here just overthinking it...
Thanks in advance

arcanebits
Veteran Member
Posts: 71
Joined: 2018-12-10 21:52

Re: Add records ownership to supervisors

Post by arcanebits » 2022-04-26 14:44

Any advice?

arcanebits
Veteran Member
Posts: 71
Joined: 2018-12-10 21:52

Re: Add records ownership to supervisors -->SOLVED<--

Post by arcanebits » 2022-04-29 12:19

SOLVED! Heres HOW I worked for me:
01 Have a field with the supervisor in the data table, and obviously also in the “employees”
02 Used table_INIT to get $memberInfo['username'] of logged in user
03 Used the table_INIT hoock to get where that username was on the main list of “empoyees” and make an array of it
04 Used that lovely array to navigate the “employees” table and post the name of the supervisor
05 On the data table just ad a filter based on that field to be the $memberInfo['username']
Hope it helps someone some day

Post Reply