code: public void checkRoleForResource(CmsObject cms, CmsRole role, String resourceName)
      throws CmsException, CmsRoleViolationException {
  
          CmsResource resource = cms.readResource(resourceName, CmsResourceFilter.ALL);
          m_securityManager.checkRoleForResource(cms.getRequestContext(), role, resource);
      }
docs: Checks if the user of this OpenCms context is a member of the given role
  for the given resource.<p>
  
  The user must have the given role in at least one organizational unit to which this resource belongs.<p>
  
  @param cms the opencms context
  @param role the role to check
  @param resourceName the name of the resource to check the role for
  
  @throws CmsRoleViolationException if the user does not have the required role permissions
  @throws CmsException if something goes wrong, while reading the resource