Oleg
Oleg

Reputation: 2821

to provide access from one account to the data of another

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.

Upvotes: 0

Views: 73

Answers (1)

Brendan Bullen
Brendan Bullen

Reputation: 11809

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.

Upvotes: 2

Related Questions