X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.ui%2Fsrc%2Forg%2Fargeo%2Fapp%2Fui%2Fpeople%2FPeopleEntryArea.java;h=789698bcf21f4904a5217244478be393cf432a86;hb=f1b87af2e0de38f1f49ab8fe68f9988018914811;hp=8ee656a6ffebe0bdff5842da25cd5d19e1c50f91;hpb=e43d6397b40323e6d23ac52500d022cc2dc622f1;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.ui/src/org/argeo/app/ui/people/PeopleEntryArea.java b/org.argeo.app.ui/src/org/argeo/app/ui/people/PeopleEntryArea.java index 8ee656a..789698b 100644 --- a/org.argeo.app.ui/src/org/argeo/app/ui/people/PeopleEntryArea.java +++ b/org.argeo.app.ui/src/org/argeo/app/ui/people/PeopleEntryArea.java @@ -13,14 +13,12 @@ import org.argeo.api.cms.ux.CmsIcon; import org.argeo.api.cms.ux.CmsView; import org.argeo.app.ui.SuiteEvent; import org.argeo.app.ui.SuiteIcon; -import org.argeo.app.ui.dialogs.NewUserWizard; import org.argeo.cms.CmsUserManager; import org.argeo.cms.acr.ContentUtils; import org.argeo.cms.auth.CmsRole; import org.argeo.cms.auth.CurrentUser; import org.argeo.cms.auth.UserAdminUtils; import org.argeo.cms.jcr.acr.JcrContent; -import org.argeo.cms.jface.dialog.CmsWizardDialog; import org.argeo.cms.swt.CmsSwtTheme; import org.argeo.cms.swt.CmsSwtUtils; import org.argeo.cms.swt.Selected; @@ -40,7 +38,6 @@ import org.argeo.util.directory.ldap.IpaUtils; import org.argeo.util.naming.LdapAttrs; import org.argeo.util.naming.LdapObjs; import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.Wizard; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.layout.GridData; @@ -87,11 +84,14 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { List visible = new ArrayList<>(); if (parent != null) { for (HierarchyUnit hu : parent.getDirectHierarchyUnits(true)) { - if (CurrentUser.implies(CmsRole.userAdmin, hu.getBase()) // - ) // IPA - { - visible.add(hu); - } + // 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()) { @@ -99,8 +99,10 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { || CurrentUser.implies(CmsRole.userAdmin, IpaUtils.IPA_ACCOUNTS_RDN + "," + directory.getBase())) // IPA { - // we do not show the base level - for (HierarchyUnit hu : directory.getDirectHierarchyUnits(true)) { + // TODO show base level + } + for (HierarchyUnit hu : directory.getDirectHierarchyUnits(true)) { + if (CurrentUser.implies(CmsRole.userAdmin, hu.getBase())) { visible.add(hu); } } @@ -112,7 +114,7 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { @Override public String getText(HierarchyUnit model) { - return model.getHierarchyUnitName(); + return model.getHierarchyUnitLabel(CurrentUser.locale()); } @Override @@ -121,9 +123,9 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { if (content.hasContentClass(LdapObjs.organization.qName())) return SuiteIcon.organisation; else if (content.hasContentClass(LdapObjs.posixGroup.qName())) - return SuiteIcon.group; + return SuiteIcon.users; else - return SuiteIcon.people; + return SuiteIcon.addressBook; } }; @@ -180,7 +182,7 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { else if (role.isContentClass(LdapObjs.inetOrgPerson.qName())) return SuiteIcon.person; else if (role.isContentClass(LdapObjs.organization.qName())) - return SuiteIcon.organisation; + return SuiteIcon.organisationContact; else if (role.isContentClass(LdapObjs.groupOfNames.qName())) return SuiteIcon.group; else @@ -240,8 +242,9 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider { }); addItem.addSelectionListener((Selected) (e) -> { - // SuiteUtils.getOrCreateUserNode(adminSession, userDn); - GuidedForm wizard = new NewUserWizard(null); + HierarchyUnit hierarchyUnit = usersPart.getInput(); + Content huContent = ContentUtils.hierarchyUnitToContent(contentSession, hierarchyUnit); + GuidedForm wizard = new NewUserForm(cmsUserManager, huContent); SwtGuidedFormDialog dialog = new SwtGuidedFormDialog(parent.getShell(), wizard); // WizardDialog dialog = new WizardDialog(shell, wizard); if (dialog.open() == Window.OK) {