<%@ page import="com.imcode.imcms.api.*, java.util.*" errorPage="error.jsp" %>

Document permissions

There are three basic kinds of permissions:

In between "Full" and "Read" there can also be defined two that are modifiable:

They can be set differently for different pages (and for new pages created from them).

<% int documentId = 1189; ContentManagementSystem imcmsSystem = ContentManagementSystem.fromRequest( request ); DocumentService documentService = imcmsSystem.getDocumentService(); Document document = documentService.getTextDocument(documentId); %>

Every document has a mapping of permissions to roles.
This is a map of the format (RoleName,DocumentPermissionSet)

Permissions mappings for document <%= documentId %>:

<% Map permissionsMap = document.getAllRolesMappedToPermissions(); Set roles = permissionsMap.keySet(); Iterator roleIterator = roles.iterator(); %>

<% %>

<% if (imcmsSystem.getCurrentUser().canEdit( document )) { %> You have the following permissions for document <%= documentId %>: "<%= document.getDocumentPermissionSetForUser() %>" <% } else { %> You have no permissions for document <%= documentId %>. <% } %>

Notice: Only the roles that have some permissions are shown above. If a role has permission "None" then that role is not shown.