code: public static IndexedContainer getRoleContainerForUser(CmsObject cms, CmsUser user, String captionPropertyName) {
  
          IndexedContainer result = new IndexedContainer();
          result.addContainerProperty(captionPropertyName, String.class, "");
          try {
              List<CmsRole> roles = OpenCms.getRoleManager().getRoles(cms, user.getOuFqn(), false);
              CmsRole.applySystemRoleOrder(roles);
              for (CmsRole role : roles) {
                  Item item = result.addItem(role);
                  item.getItemProperty(captionPropertyName).setValue(role.getDisplayName(cms, A_CmsUI.get().getLocale()));
              }
          } catch (CmsException e) {
              LOG.error("Unabel to read roles for user", e);
          }
          return result;
      }
docs: Returns the roles available for a given user.<p>
  
  @param cms CmsObject
  @param user to get available roles for
  @param captionPropertyName name of caption property
  @return indexed container