Compartment Security provides additional security control to specify that a user must have all of the right roles to interact with a document rather than just one of the right roles using AND semantics or OR semantics.
In MarkLogic, a compartment is a name associated with a role. When a role is compartmented, the compartment name is used as an additional check when determining a user’s authority to access or create documents in a database. Without compartment security, permissions are checked using OR semantics.
For example, if a document has read permission for role1 and read permission for role2, a user who possesses either role1 or role2 can read that document. If those roles have different compartments associated with them (for example, compartment1 and compartment2, respectively), then the permissions are checked using AND semantics for each compartment, as well as OR semantics for each non-compartmented role. To access the document, if role1 and role2 are in different compartments, a user must possess both role1 and role2 to access the document, as well as a non-compartmented role that has a corresponding permission on the document.