+ @Override
+ protected int getItemCount() {
+ roles.clear();
+ HierarchyUnit hu = (HierarchyUnit) getInput();
+ if (hu == null)
+ return 0;
+ UserDirectory ud = (UserDirectory) hu.getDirectory();
+ for (HierarchyUnit directChild : hu.getDirectHierachyUnits(false)) {
+ if (!directChild.isFunctional()) {
+ for (Role r : ud.getHierarchyUnitRoles(directChild, null, false)) {
+ Content content = ContentUtils.roleToContent(cmsUserManager, contentSession, r);
+ // if (r instanceof Person || r instanceof Organization)
+ if (content.hasContentClass(LdapObjs.inetOrgPerson.qName(), LdapObjs.organization.qName()))
+ roles.add(content);
+ }
+ }
+ }
+ // roles = hu.getHierarchyUnitRoles(null, false);
+ return roles.size();
+ }
+
+ };
+ usersView.addColumn(new Column<Content>() {
+
+ @Override
+ public String getText(Content role) {
+ if (role.isContentClass(LdapObjs.inetOrgPerson.qName()))
+ return UserAdminUtils.getUserDisplayName(role.adapt(User.class));
+ else if (role.isContentClass(LdapObjs.organization.qName()))
+ return role.attr(LdapAttrs.o.qName());
+ else if (role.isContentClass(LdapObjs.groupOfNames.qName()))
+ return role.attr(LdapAttrs.cn.qName());
+ else
+ return null;
+ }
+
+ @Override
+ public CmsIcon getIcon(Content role) {
+ if (role.isContentClass(LdapObjs.inetOrgPerson.qName()))
+ return SuiteIcon.person;
+ else if (role.isContentClass(LdapObjs.organization.qName()))
+ return SuiteIcon.organisation;
+ else if (role.isContentClass(LdapObjs.groupOfNames.qName()))
+ return SuiteIcon.group;
+ else
+ return null;
+ }
+
+ @Override
+ public int getWidth() {
+ return 300;
+ }
+
+ });
+ usersView.addColumn((Column<Content>) (role) -> role.attr(LdapAttrs.mail.qName()));
+
+ // toolbar