- @Override
- public List<HierarchyUnit> getChildren(HierarchyUnit parent) {
- List<HierarchyUnit> visible = new ArrayList<>();
- if (parent != null) {
- for (HierarchyUnit hu : parent.getDirectHierarchyUnits(true)) {
- // if parent was visible, it is visible
- // TODO restrict more?
-
-// if (CurrentUser.implies(CmsRole.userAdmin, hu.getBase()) //
-// ) // IPA
-// {
- visible.add(hu);
-// }
- }
- } else {
- for (UserDirectory directory : cmsUserManager.getUserDirectories()) {
- if (CurrentUser.implies(CmsRole.userAdmin, directory.getBase()) //
- || CurrentUser.implies(CmsRole.userAdmin,
- IpaUtils.IPA_ACCOUNTS_RDN + "," + directory.getBase())) // IPA
- {
- // TODO show base level
- }
- for (HierarchyUnit hu : directory.getDirectHierarchyUnits(true)) {
- if (CurrentUser.implies(CmsRole.userAdmin, hu.getBase())) {
- visible.add(hu);
- }
- }
-
- }
- }
- return visible;
- }
-
- @Override
- public String getText(HierarchyUnit model) {
- return model.getHierarchyUnitLabel(CurrentUser.locale());
- }
-
- @Override
- public CmsIcon getIcon(HierarchyUnit model) {
- Content content = ContentUtils.hierarchyUnitToContent(contentSession, model);
- if (content.hasContentClass(LdapObjs.organization.qName()))
- return SuiteIcon.organisation;
- else if (content.hasContentClass(LdapObjs.posixGroup.qName()))
- return SuiteIcon.users;
- else
- return SuiteIcon.addressBook;
- }
-
- };
- SwtTreeView<HierarchyUnit> directoriesView = new SwtTreeView<>(sashForm, SWT.NONE, hierarchyPart);
-
- DefaultTabularPart<HierarchyUnit, Content> usersPart = new DefaultTabularPart<>() {
-
- @Override
- protected List<Content> asList(HierarchyUnit hu) {
- List<Content> roles = new ArrayList<>();
- UserDirectory ud = (UserDirectory) hu.getDirectory();
- if (ud.getRealm().isPresent()) {
- for (Role r : ud.getHierarchyUnitRoles(ud, null, true)) {
- 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);
- }
-
- } else {
- for (HierarchyUnit directChild : hu.getDirectHierarchyUnits(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(), LdapObjs.groupOfNames.qName()))
- roles.add(content);
- }
- }
- }
- }
- return roles;
- }
- };