code: public List<CmsRole> getRolesOfUser(
          CmsObject cms,
          String username,
          String ouFqn,
          boolean includeChildOus,
          boolean directRolesOnly,
          boolean recursive)
      throws CmsException {
  
          List<CmsGroup> groups;
          ouFqn = CmsOrganizationalUnit.removeLeadingSeparator(ouFqn);
          if (!recursive) {
              groups = m_securityManager.getGroupsOfUser(
                  cms.getRequestContext(),
                  username,
                  ouFqn,
                  includeChildOus,
                  true,
                  directRolesOnly,
                  cms.getRequestContext().getRemoteAddress());
          } else {
              groups = new ArrayList<CmsGroup>();
              Iterator<CmsGroup> itAllGroups = m_securityManager.getGroupsOfUser(
                  cms.getRequestContext(),
                  username,
                  "",
                  true,
                  true,
                  directRolesOnly,
                  cms.getRequestContext().getRemoteAddress()).iterator();
              while (itAllGroups.hasNext()) {
                  CmsGroup role = itAllGroups.next();
                  if (!includeChildOus && role.getOuFqn().equals(ouFqn)) {
                      groups.add(role);
                  }
                  if (includeChildOus && role.getOuFqn().startsWith(ouFqn)) {
                      groups.add(role);
                  }
              }
          }
          List<CmsRole> roles = new ArrayList<CmsRole>(groups.size());
          Iterator<CmsGroup> itGroups = groups.iterator();
          while (itGroups.hasNext()) {
              CmsGroup group = itGroups.next();
              roles.add(CmsRole.valueOf(group));
          }
          return roles;
      }
docs: Returns all roles the given user belongs to, in the given organizational unit.<p>
  
  @param cms the opencms context
  @param username the name of the user to get all roles for
  @param ouFqn the fully qualified name of the organizational unit to restrict the search to
  @param includeChildOus include roles of child organizational units
  @param directRolesOnly if set only the direct assigned roles will be returned, if not also indirect roles
  @param recursive if this is set, also roles of higher organizational unit are considered
  
  @return a list of <code>{@link org.opencms.security.CmsRole}</code> objects
  
  @throws CmsException if operation was not successful