Page 1 of 1

every employee can only see his paycheck

Posted: 2018-05-17 21:11
by facos79
Good morning, I need advice on how to solve a problem:
I'm making a program with appgini that allows you to upload documents (salary paycheck).
I created a user for each employee.
How can I make sure that every employee can only see his paycheck?
There are more than 60 employees and the payer in the table is the holder.

Thank you for the advice
Greetings

--------------------------------

Buongiorno, avrei bisgono di un consiglio su come risolvere un problema:
Sto realizzando un programma con appgini che permetta di caricare dei documenti ( busta paga dello stipendio ) .
Ho creato un utente per ogni lavoratore dipendente.
Come faccio a fare in modo che ogni lavoratore dipendente possa vedere solo la propria busta paga ?
Sono più di 60 dipendenti e chi carica la nusta paga nella tabella è il titolare.

Vi ringrazio per i consigli.
Saluti

Re: every employee can only see his paycheck

Posted: 2018-05-18 05:57
by pbottcher
Hi,

you can change the owner of each record (=salary paycheck) to the employee. In the permission setting you allow each employee to only see his records.

Re: every employee can only see his paycheck

Posted: 2018-05-18 20:38
by facos79
Hello,
thank you.
The problem is that this procedure is very inconvenient if I have to load over 100 paychecks. For each paycheck must give permission to the record to make it visible to the employee only.

Is not there a way to assign it directly, perhaps by selecting the user during data entry?

Re: every employee can only see his paycheck

Posted: 2018-05-18 22:00
by pbottcher
Hi,

if you have a field in your table which will identify the owner of the paycheck (i assume it is called owner) and you would set this during your data entry you could use the
<tablename>.php file and use the <tablename>_after_insert function to change the ownership of the record after the insert.
To do so you could use

Code: Select all

$pkValue = sqlValue("select pkValue from membership_userrecords where tableName='<tablename>' and pkValue='".$data['selectedID']."'");
set_record_owner('<tablename>', $pkValue, $data['owner']);