cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

User profiles design

Hi, here another new user in the rabbit hole of Neo4j.

My model is based on differents roles: user, admin, root. After login proccess, the account will be redirected to its own module.

My question is here? which is the best way to model that case:

  • -Have in the node role property
  • -Have a another label (user, admin, root) on top of profile node
  • -Create a relationship between profile -[:ROLE_OF]-> (admin | root | user)

The only queries that we would like to do to get the related data will be getRootAdminProfiles or getAdminUserProfiles

2 REPLIES 2

clem
Graph Steward

The nice thing about Neo4J is you can change your mind relatively easily later.

Before you can come up with an answer to your question, I think you need to decide whether a "user" (a single Node), can have multiple roles or if a user can only be one at a time, or multiple roles at the same time.

Possibly, each role has properties specific the role as well.

And if an admin or root role gets removed from a person, how do you expect the extra properties to be removed. Maybe a lot of other considerations too.

If there are no extra properties, then adding and removing labels is easy.

The accounts node will have the same properties and the only property that it would make different to the accounts will be the label. After depending on the label, the accounts will have different relationships which would define the rights of each.
As you say, I might go with labels design but still thinking which would be the best approach,

thanks!