code: public void checkRoleForResource(CmsRequestContext context, CmsRole role, CmsResource resource)
      throws CmsRoleViolationException {
  
          CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
          try {
              checkRoleForResource(dbc, role, resource);
          } finally {
              dbc.clear();
          }
      }
docs: Checks if the user of the current context has permissions to impersonate the given role
  for the given resource.<p>
  
  @param context the current request context
  @param role the role to check
  @param resource the resource to check the role for
  
  @throws CmsRoleViolationException if the user does not have the required role permissions