Browse Source

Merge pull request #9879 from RussWhitehead/managedBy

HPCC-17432 Pre-populate "ManagedBy" in Group Create

Reviewed-By: Rodrigo Pastrana <rodrigo.pastrana@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 8 years ago
parent
commit
0696bbbf44

+ 2 - 1
esp/scm/ws_account.ecm

@@ -40,6 +40,7 @@ ESPresponse [exceptions_inline] MyAccountResponse
     int    passwordDaysRemaining;
     [min_ver("1.01")] int passwordExpirationWarningDays;
     [min_ver("1.02")] string employeeID;
+    [min_ver("1.03")] string distinguishedName;
 };
 
 
@@ -69,7 +70,7 @@ ESPresponse [exceptions_inline] VerifyUserResponse
 };
 
 //Kevin/russ does this method need feature level check?
-ESPservice [auth_feature("NONE"), version("1.02"), default_client_version("1.02"), exceptions_inline("./smc_xslt/exceptions.xslt")] ws_account
+ESPservice [auth_feature("NONE"), version("1.03"), default_client_version("1.03"), exceptions_inline("./smc_xslt/exceptions.xslt")] ws_account
 {
     ESPmethod [client_xslt("/esp/xslt/account_myaccount.xslt")] MyAccount(MyAccountRequest, MyAccountResponse);
     ESPmethod [client_xslt("/esp/xslt/account_input.xslt")] UpdateUserInput(UpdateUserInputRequest, UpdateUserInputResponse);

+ 3 - 0
esp/services/ws_account/ws_accountService.cpp

@@ -175,6 +175,9 @@ bool Cws_accountEx::onMyAccount(IEspContext &context, IEspMyAccountRequest &req,
 
             if (version >= 1.02)
                 resp.setEmployeeID(user->getEmployeeID());
+
+            if (version >= 1.03)
+                resp.setDistinguishedName(user->getDistinguishedName());
         }
     }
     catch(IException* e)

+ 7 - 1
system/security/LdapSecurity/ldapconnection.cpp

@@ -1493,7 +1493,7 @@ public:
                 filter.append("uid=");
             filter.append(username);
 
-            char* attrs[] = {"cn", "userAccountControl", "pwdLastSet", "givenName", "sn", "employeeNumber", NULL};
+            char* attrs[] = {"cn", "userAccountControl", "pwdLastSet", "givenName", "sn", "employeeNumber", "distinguishedName",NULL};
 
             Owned<ILdapConnection> lconn = m_connections->getConnection();
             LDAP* sys_ld = ((CLdapConnection*)lconn.get())->getLd();
@@ -1609,6 +1609,12 @@ public:
                     if (vals.hasValues())
                         user.setEmployeeID(vals.queryCharValue(0));
                 }
+                else if(stricmp(attribute, "distinguishedName") == 0)
+                {
+                    CLDAPGetValuesLenWrapper vals(sys_ld, entry, attribute);
+                    if (vals.hasValues())
+                        user.setDistinguishedName(vals.queryCharValue(0));
+                }
             }
 
             char *userdn = ldap_get_dn(sys_ld, entry);

+ 11 - 0
system/security/LdapSecurity/ldapsecurity.cpp

@@ -129,6 +129,17 @@ bool CLdapSecUser::setEmployeeID(const char * emplID)
     return true;
 }
 
+const char * CLdapSecUser::getDistinguishedName()
+{
+    return m_distinguishedName.get();
+}
+
+bool CLdapSecUser::setDistinguishedName(const char * dn)
+{
+    m_distinguishedName.set(dn);
+    return true;
+}
+
 const char * CLdapSecUser::getRealm()
 {
     return m_realm.get();

+ 3 - 0
system/security/LdapSecurity/ldapsecurity.ipp

@@ -47,6 +47,7 @@ private:
     StringAttr   m_lastname;
     StringAttr   m_pw;
     StringAttr   m_employeeID;
+    StringAttr   m_distinguishedName;
     StringAttr   m_Fqdn;
     StringAttr   m_Peer;
     authStatus   m_authenticateStatus;
@@ -88,6 +89,8 @@ public:
     virtual bool setLastName(const char * lname);
     virtual const char * getEmployeeID();
     virtual bool setEmployeeID(const char * emplID);
+    virtual const char * getDistinguishedName();
+    virtual bool setDistinguishedName(const char * dn);
     const char * getRealm();
     bool setRealm(const char * name);
     ISecCredentials & credentials();

+ 12 - 0
system/security/shared/SecureUser.hpp

@@ -34,6 +34,7 @@ private:
     StringBuffer    m_firstname;
     StringBuffer    m_lastname;
     StringBuffer    m_employeeID;
+    StringBuffer    m_distinguishedName;
     unsigned        m_userID;
     StringBuffer    m_Fqdn;
     StringBuffer    m_Peer;
@@ -114,6 +115,17 @@ public:
         return true;
     }
 
+    const char * getDistinguishedName()
+    {
+        return m_distinguishedName.str();
+    }
+
+    bool setDistinguishedName(const char * dn)
+    {
+        m_distinguishedName.set(dn);
+        return true;
+    }
+
     const char * getRealm()
     {
         return m_realm.str();

+ 2 - 0
system/security/shared/seclib.hpp

@@ -172,6 +172,8 @@ interface ISecUser : extends IInterface
     virtual bool setLastName(const char * lname) = 0;
     virtual const char * getEmployeeID() = 0;
     virtual bool setEmployeeID(const char * emplID) = 0;
+    virtual const char * getDistinguishedName() = 0;
+    virtual bool setDistinguishedName(const char * dn) = 0;
     virtual const char * getRealm() = 0;
     virtual bool setRealm(const char * realm) = 0;
     virtual const char * getFqdn() = 0;