Reputation: 3447
I'm currently developing a Windows 8 app which uses Azure for its database. In this database I have 4 tables:
PlaceGroup
Places
PlaceComments
PlaceEvents
I want to make some sort of account system, where the user is permitted to update/delete only his place, i.e. only the records with his id. Example:
I have a place with id=5
The PlaceComments table has these records table structure: id PlaceID CommentBody
first record:
1 5 "Some text here"
second record
2 12 "Some text here"
I should be ONLY able to update/delete the second record. I really don't have an idea how to do it, so I'm asking for some help.
Upvotes: 0
Views: 188
Reputation: 23774
Take a look at the Get started with authentication in Mobile Services tutorial and the follow-on: Use scripts to authorize users in Mobile Services.
In a nutshell, you'll need to include authentication in your application, which you can also do via Mobile Services. With authentication in place, you'll set the various scripts on your table to support "Only Authenticated Users"
As a result of the authentication, you'll get a 'userid' identifying the authenticated user, that user info is then passed into the various scripts, so you could use that identifier to match only rows that have a column indicating the 'owner' of the various row of data (essentially adding a WHERE user = to all of your queries). Essentially creating a multi-tenanted implementation.
Upvotes: 1