Adapt to changes in Argeo Commons
authorMathieu Baudier <mbaudier@argeo.org>
Fri, 19 Aug 2022 04:51:31 +0000 (06:51 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Fri, 19 Aug 2022 04:51:31 +0000 (06:51 +0200)
org.argeo.app.api/src/org/argeo/app/api/SuiteRole.java
org.argeo.app.core/src/org/argeo/app/core/SuiteUtils.java
org.argeo.app.ui/src/org/argeo/app/ui/people/PeopleEntryArea.java

index 38ce11fdd573ba3c7259bf804069b1f7d5ebda87..42202ce7dfc654498137bdab807507e47fba7ab6 100644 (file)
@@ -1,17 +1,45 @@
 package org.argeo.app.api;
 
+import javax.xml.namespace.QName;
+
+import org.argeo.api.acr.ContentName;
+import org.argeo.api.acr.CrName;
 import org.argeo.api.cms.CmsConstants;
-import org.argeo.util.naming.Distinguished;
+import org.argeo.cms.auth.SystemRole;
 import org.argeo.util.naming.LdapAttrs;
 
-/** Office specific roles used in the code */
-public enum SuiteRole implements Distinguished {
-       coworker, manager;
+/** Standard suite system roles. */
+public enum SuiteRole implements SystemRole {
+       /** An external person who has read access to part of the information. */
+       observer,
+       /** An active coworker. */
+       coworker,
+       /** Someone who is allowed validate and publish information. */
+       publisher,
+       /** Someone with manager status within an organisation. Does not necessarily give more rights. */
+       manager,
+       //
+       ;
+
+       private final static String QUALIFIER = "app.";
+
+       private final ContentName name;
+
+       SuiteRole() {
+               name = new ContentName(CrName.ROLE_NAMESPACE_URI, QUALIFIER + name());
+       }
+
+       @Override
+       public QName getName() {
+               return name;
+       }
 
-       public String getRolePrefix() {
+       @Deprecated
+       private String getRolePrefix() {
                return "org.argeo.suite";
        }
 
+       @Deprecated
        public String dn() {
                return new StringBuilder(LdapAttrs.cn.name()).append("=").append(getRolePrefix()).append(".").append(name())
                                .append(",").append(CmsConstants.ROLES_BASEDN).toString();
index 46cb5de43698b08cebac9364569fd29043f22332..3c103e6f3f91573f3a00bf5634c4fb8c72e39963 100644 (file)
@@ -41,8 +41,8 @@ public class SuiteUtils {
                                userNode.setProperty(LdapAttrs.distinguishedName.property(), userDn.toString());
                                userNode.setProperty(LdapAttrs.uid.property(), uid);
                                adminSession.save();
-                               JackrabbitSecurityUtils.denyPrivilege(adminSession, userNode.getPath(), SuiteRole.coworker.dn(),
-                                               Privilege.JCR_READ);
+//                             JackrabbitSecurityUtils.denyPrivilege(adminSession, userNode.getPath(), SuiteRole.coworker.dn(),
+//                                             Privilege.JCR_READ);
                                JcrUtils.addPrivilege(adminSession, userNode.getPath(), new X500Principal(userDn.toString()).getName(),
                                                Privilege.JCR_READ);
                                JcrUtils.addPrivilege(adminSession, userNode.getPath(), CmsConstants.ROLE_USER_ADMIN,
index a0decc04affe791b268666ea4b40cc1aaa2556cc..ab06bcaa1ea9118a7b0f387b9e57eb8f5ebd182f 100644 (file)
@@ -85,7 +85,7 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider {
                                List<HierarchyUnit> visible = new ArrayList<>();
                                if (parent != null) {
                                        for (HierarchyUnit hu : parent.getDirectHierarchyUnits(true)) {
-                                               if (CurrentUser.implies(CmsRole.userAdmin, hu.getContext()) //
+                                               if (CurrentUser.implies(CmsRole.userAdmin, hu.getBase()) //
                                                ) // IPA
                                                {
                                                        visible.add(hu);
@@ -93,9 +93,9 @@ public class PeopleEntryArea implements SwtUiProvider, CmsUiProvider {
                                        }
                                } else {
                                        for (UserDirectory directory : cmsUserManager.getUserDirectories()) {
-                                               if (CurrentUser.implies(CmsRole.userAdmin, directory.getContext()) //
+                                               if (CurrentUser.implies(CmsRole.userAdmin, directory.getBase()) //
                                                                || CurrentUser.implies(CmsRole.userAdmin,
-                                                                               IpaUtils.IPA_ACCOUNTS_RDN + "," + directory.getContext())) // IPA
+                                                                               IpaUtils.IPA_ACCOUNTS_RDN + "," + directory.getBase())) // IPA
                                                {
                                                        visible.add(directory);
                                                }