Adapt to changes in Argeo Commons
[gpl/argeo-suite.git] / org.argeo.app.api / src / org / argeo / app / api / SuiteRole.java
index 38ce11fdd573ba3c7259bf804069b1f7d5ebda87..e8207074705895de0d15e26988bd7691f54e112a 100644 (file)
@@ -1,19 +1,47 @@
 package org.argeo.app.api;
 
+import javax.xml.namespace.QName;
+
+import org.argeo.api.acr.ArgeoNamespace;
+import org.argeo.api.acr.ContentName;
+import org.argeo.api.acr.ldap.LdapAttr;
 import org.argeo.api.cms.CmsConstants;
-import org.argeo.util.naming.Distinguished;
-import org.argeo.util.naming.LdapAttrs;
+import org.argeo.cms.SystemRole;
+
+/** 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;
 
-/** Office specific roles used in the code */
-public enum SuiteRole implements Distinguished {
-       coworker, manager;
+       SuiteRole() {
+               name = new ContentName(ArgeoNamespace.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();
+               return new StringBuilder(LdapAttr.cn.name()).append("=").append(getRolePrefix()).append(".").append(name())
+                               .append(",").append(CmsConstants.SYSTEM_ROLES_BASEDN).toString();
        }
 }