-1

I a building a CRM and what things I have in my CRM.

  1. I have four modules in my CRM (leads, contacts, deals, vendors).

  2. Multiple users with different roles. Roles are of dynamic type. Basically I have to build hirarchy of user roles .Users at high roles can see all the data of the role users below his role.

  3. Each user has permissions to read write update and delete data of all the four modules. If you still have any doubt please visit Zoho CRM to check how their user control works. I need to build the same.

    I am using MySQL as my database.

M--
  • 25,431
  • 8
  • 61
  • 93
Jinku
  • 1
  • 1
  • better use capabilities (eg can_read, can_write and so on..). Then each role will have specific cap[abilities. Those roles higher up in the hierarchy will have more capabilities than lower-level roles and so on. SQL schema is easy, role, capability, role_capability tables shouls suffice – Nikos M. Apr 20 '19 at 16:25

1 Answers1

0

Try this: Roles: id,rolename,role_priority,permission_id(foreign_key:id of permission table)

Permission: id,permission_name

Module:id,module_name

User: id,user_name,role_id(foreign_key:id of Roles table),module_id(foreign_key:id of Module table)

A short description for above scenerio is that: 1.Roles,Permission,Module are the master table. 2. Permissions are assigned to the roles and each user have its own role of that particular module.

stuti
  • 1
  • 2
  • how the user at higher role level will see the data of the user at lower role level? – Jinku Apr 20 '19 at 18:05
  • On basis of role_priority key from Roles table where role having low priority(minimum value) have access to see data of role having high priority (maximum value) e.g role with admin have role_priority 1 and user have role_priority 4 then it has access to see data of role_priority 4. Hope it make more understanding. – stuti Apr 22 '19 at 05:53