views:

35

answers:

1

Hello. I'm going to develop a multiuser system, where people can register an account, log in, store and manage the data of the account. For example, email address idetifiers a user. Could you tell, please, how to provide the user of one account access to the data of another account. For example, by providing a link in the account that gives access to another account. It looks like Google Analytics uses a mechanism similar to this one to give access of one user access to the account of another user. Thanky you very much, Oleg.

+2  A: 

Providing code will be impossible here but, I'm going to guess at your setup and we'll see what happens.

So, you perhaps have a users table and a data table.

One option, is to allow Private and Public options on the data table. Public can data can be accessed by anyone.

The other option is to have another table dataPermissions where you associate data ids to user ids. When listing data, if the data item isn't owned by the current user, they must have a corresponding entry in the dataPermissions table.

Remember though, providing code and examples of you database structure is the best way to get a good answer.

Update Okay, so we know that users are identified by email and can have one or many links to data. Those links can be shared to other users. Therefore, you are going to have a table for users, identified by email, and a table for data which is identified by its link.

Therefore, a user can choose to add more users to a link. For this, you would need a new table that associated users and links, i.e. a userLinks table.

Brendan Bullen
I was just typing almost the exact same response. +1
Ryan Kinal
The data looks like this.There users (identied by email). There are accounts that stores user's data. Every user has at list one account (which is created during registration). How to let grant the user access to other account of the site. For example, after logging in the user has links that gives access to other accounts.
Added update. Hope it helps
Brendan Bullen