How to implement user hierarchy with different levels of roles under different branches, groups etc I have to create a web portal, that should have a number of users from super administrator to employee. Users have single or multilevel access (either to data of one branch or to multiple) on the system.

Some can add/edit data and some can only view some data. The system has different branches, different departments etc.. How can I implement such a system using Drupal?

I had created multiple roles and given permissions to them. But how can I achieve those multi branch multi groups kind of user hierarchy?

Update:
Can I achieve it by using TAC : https://www.drupal.org/node/31601 ?
Have you looked at Organic Groups.

Im using it for a similar use-case. I would allow you to create content types that can act as 'Departments' and add different roles within those.

You can have for example:


'department' content types with following roles: admin, supervisor
'branch' content type with completely different roles: it programmer, temp


It is very flexible and access control works with views as well. Nice tutorial can be found here.

If you opt to however to write your custom access control module, make sure that you read up on that here

Hope that helps.