X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=swt%2Forg.argeo.app.ui%2Fsrc%2Forg%2Fargeo%2Fapp%2Fui%2Fpeople%2FPersonUiProvider.java;h=6930b4e2a8cdcc5d0ad0eea2eac7ddc74b8a2cb4;hb=932dbdce11c1a862b6a7babcb91bfec8e491e0b8;hp=c0adcf5582373f3765d6479293d43ee85f3e8fe5;hpb=3197ec58385951957c237fd6c147670cca89123c;p=gpl%2Fargeo-suite.git diff --git a/swt/org.argeo.app.ui/src/org/argeo/app/ui/people/PersonUiProvider.java b/swt/org.argeo.app.ui/src/org/argeo/app/ui/people/PersonUiProvider.java index c0adcf5..6930b4e 100644 --- a/swt/org.argeo.app.ui/src/org/argeo/app/ui/people/PersonUiProvider.java +++ b/swt/org.argeo.app.ui/src/org/argeo/app/ui/people/PersonUiProvider.java @@ -6,8 +6,9 @@ import java.util.Map; import org.argeo.api.acr.Content; import org.argeo.api.acr.QNamed; -import org.argeo.api.acr.ldap.LdapAttrs; -import org.argeo.api.acr.ldap.LdapObjs; +import org.argeo.api.acr.ldap.LdapAttr; +import org.argeo.api.acr.ldap.LdapObj; +import org.argeo.api.cms.directory.CmsUser; import org.argeo.api.cms.directory.CmsUserManager; import org.argeo.app.api.SuiteRole; import org.argeo.app.ui.SuiteMsg; @@ -37,7 +38,6 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; -import org.osgi.service.useradmin.User; /** Edit a suite user. */ public class PersonUiProvider implements SwtUiProvider { @@ -50,27 +50,29 @@ public class PersonUiProvider implements SwtUiProvider { main.setLayout(new GridLayout(2, false)); - User user = context.adapt(User.class); + CmsUser user = context.adapt(CmsUser.class); + + Content hierarchyUnitContent = context.getParent().getParent(); String roleContext = RoleNameUtils.getContext(user.getName()); - if (context.hasContentClass(LdapObjs.person.qName())) { + if (context.hasContentClass(LdapObj.person.qName())) { - addFormLine(main, SuiteMsg.firstName, context, LdapAttrs.givenName); - addFormLine(main, SuiteMsg.lastName, context, LdapAttrs.sn); - addFormLine(main, SuiteMsg.email, context, LdapAttrs.mail); + addFormLine(main, SuiteMsg.firstName, context, LdapAttr.givenName); + addFormLine(main, SuiteMsg.lastName, context, LdapAttr.sn); + addFormLine(main, SuiteMsg.email, context, LdapAttr.mail); } - if (context.hasContentClass(LdapObjs.posixAccount.qName())) { - - SwtSection rolesSection = new SwtSection(main, SWT.NONE); - rolesSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); - rolesSection.setLayout(new GridLayout(2, false)); - List roles = Arrays.asList(cmsUserManager.getUserRoles(user.getName())); - addRoleCheckBox(rolesSection, SuiteMsg.coworkerRole, SuiteRole.coworker, roleContext, roles); - addRoleCheckBox(rolesSection, SuiteMsg.publisherRole, SuiteRole.publisher, roleContext, roles); - addRoleCheckBox(rolesSection, SuiteMsg.userAdminRole, CmsRole.userAdmin, roleContext, roles); - + if (context.hasContentClass(LdapObj.posixAccount.qName())) { + if (hierarchyUnitContent.hasContentClass(LdapObj.organization)) { + SwtSection rolesSection = new SwtSection(main, SWT.NONE); + rolesSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); + rolesSection.setLayout(new GridLayout(2, false)); + List roles = Arrays.asList(cmsUserManager.getUserRoles(user.getName())); + addRoleCheckBox(rolesSection, SuiteMsg.coworkerRole, SuiteRole.coworker, roleContext, roles); + addRoleCheckBox(rolesSection, SuiteMsg.publisherRole, SuiteRole.publisher, roleContext, roles); + addRoleCheckBox(rolesSection, SuiteMsg.userAdminRole, CmsRole.userAdmin, roleContext, roles); + } // Composite facetsSection = new Composite(main, SWT.NONE); // facetsSection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); // facetsSection.setLayout(new GridLayout());