Allow edit and delete only to the user 's rows

pgs
Bronze 1
Bronze 1

Hi everybody.

 

I 'm making an appsheet where a user:

-has to authenticate (with Google account)

-can add, edit or delete records in  a table

 

I want each user to be able to edit or delete ONLY his own records.

But to be able to view all records.

How can I do this?

0 6 1,266
6 REPLIES 6

To identify each user's record., you will need an email type column and capture the user's email in that record when the user creates that record.

Then in delete /edit action conditions you could have an expression, [Email]=USEREMAIL()

https://help.appsheet.com/en/articles/962137-limiting-users-to-particular-tables-views-and-actions

https://help.appsheet.com/en/articles/953637-actions-the-essentials#external-open-a-file

 

(must I create a  delete /edit action?)

 

CASE 1:
In Data > Tables > myTable > Are updates allowed? I have all options (Updates, Adds. Deletes) ticked and when I see the list (the table) I also
see an 'Add button' (a button with a '+').

CASE 2:
I change the Data > Tables > myTable > Are updates allowed? to:
SWITCH(email=USEREMAIL(),
"user1@mydomain.com", "ALL_CHANGES",
"user2@mydomain.com", "ALL_CHANGES",
"READ_ONLY")

 

...and the button with the '+' is gone! Dissappeared!

 

(the square brackets '[]' are not necessary in email, in fact it raises an error if inserted)

pgs
Bronze 1
Bronze 1

If you are aware of a sample AppSheet that has this functionality it would be great!

I haven't found such an app but also have not tested them all.

The "delete" complicates things. 

Do you want to have all you said in single view, or can we split them in two views (one for visualisation of all records,editing and adding new ones, and another one for viewing only user.s records, deleting etc of those records) ? 

When a record on the table is selected:

-If the record is created by the user, open edit record form.

-If the record is not created by the user, open view details form.

I would keep it simple :

 

1. Set every column to be editable only if useremail()=[CreatedByColumn]

2. Have an extra [DeleteColumn] , hidden , and an action button to change [DeletedColumn]="yes" . 

3. Have a security filter on the table to isblank([DeletedColumn])

4. Have the table set to Add and Update only 

Hope it helpes.

Top Labels in this Space