code: public boolean hasRole(CmsObject cms, String userName, CmsRole role) {
  
          CmsUser user;
          try {
              user = cms.readUser(userName);
          } catch (CmsException e) {
              // ignore
              return false;
          }
          return m_securityManager.hasRole(cms.getRequestContext(), user, role);
      }
docs: Checks if the given user has the given role in the given organizational unit.<p>
  
  @param cms the opencms context
  @param userName the name of the user to check the role for
  @param role the role to check
  
  @return <code>true</code> if the given user has the given role in the given organizational unit