You should really give the Group module a try, which allows for creating arbitrary collections of your content and users on your site, and grant access control permissions on those collections.
It creates groups as entities, making them fully fieldable, extensible and exportable. Every group can have users, roles and permissions attached to it (refer to "What are the various roles supported by the Group module?" for more details about that).
Sample configuration
Below is an example of a possible configuration, which may help to get you started with possible configurations (using the Group module):
Group type ID ! Group type ! Group role ID ! Role
--------------+------------+---------------+------------
1 ! Class ! 3 ! Instructor
1 ! Class ! 4 ! Student
1 ! Class ! 5 ! Alumni
2 ! Customers ! 6 ! Lead
2 ! Customers ! 7 ! Prospect
2 ! Customers ! 8 ! Licensed Customer
2 ! Customers ! 9 ! Sales
2 ! Customers ! 10 ! Support
2 ! Customers ! 11 ! Accounting
2 ! Customers ! 12 ! R&D
3 ! Project ! 13 ! Project Manager
3 ! Project ! 14 ! Developer
3 ! Project ! 15 ! Customer
Group Types
The above example consists of 3 group types:
- Class.
- Customers.
- Project.
Group Roles
For each of the 3 group types, there are specific Roles defined, some more details about some of them:
- for the Class group, these are the 3 roles that are configured:
- Instructor.
- Student.
- Alumni.
- for the Project group, these are the 3 roles that are configured:
- Project Manager.
- Developer.
- Customer.
These roles can be configured per Group type and will only be available on groups of that group type. As an example, for group type "Class", the defined roles are Instructor, Student and Alumni (which are not available for the other group types).
On top of the group specific roles, there are also Special Global Roles: These are the special (hardcoded) roles named Outsider (= a signed in user that did not join a group) and Member (= a signed in user that did join a group). These cannot be defined by the Drupal administrator, and they are always available for any group. These roles can have different permissions sets for each group type. Special case: the role Anonymous is related to a user that is not signed.
Groups
Each of the configured group types can have any number of Groups.
Examples of groups:
- for the Class group type, there could be these Groups:
- Getting started with Drupal.
- Drupal for site builders.
- Become an expert in using the Rules module.
- for the Customers group type, there could be these Groups:
- Service Requests.
- Order Processing.
- Sales Orders.
- Relationship Management.
Permissions
For each of the configured group types, you can then also configure for each Content Type which Role has what kind of access (= none, view, create, edit, delete). Be aware: even though this looks similar to Drupal's permission configuration, these permissions are not the same permissions (they are specific to the Group module).
Addressing your specific questions
Here is a possible recipe to get you going:
You'd only need 1 group type, say labeled "Departments".
Define whatever Group Roles you'd need for this Group Type and configure the desired Group permissions for each of those roles.
Creating Groups like Department A, Department B, Etc.
Make each user a member of the appropriate group (could be 1 or more, depends on your needs).
Assign each node to the appropriate group.
Further refinements using some other modules
Additional permissions per node
Providing additional view permissions for specific nodes to "Outsiders" (not member of a group) can be provided by the Permission by terms module.
This can by achieved by creating a Taxonomy Term reference field on nodes which points to a vocabulary "Additional Permissions" with terms "public" and "intranet users". Those terms get permissions assigned to them for respectively the "Anonymous Users" and "Authenticated Users" roles. When you set the field on a node to either of those values, users of the respective roles get view permissions, irrespective of the group view permissions. Nodes that don't have a value for the term reference field just get the group permissions by default. Edit permissions are not affected by this and are just defined by the group roles/permissions.
Changing the Group page layout
If you don't like the default way the group pages look like, you can modify them by using the page manager, together with panelizer and bootstrap_kit for instance. Together with views (using the "Group content" and "Content from group content" relationships optionally) gives you tremendous flexibility over how the group page is displayed.
Comparison with the Organic groups module
Have a look at my answer to "What are the features of the Group module versus Organic Group module?" for details about:
- How both modules (Group versus Organic groups) compare to each other.
- Integration with various modules that you might want to take advantage of also.
Resources