MicroFocus / alm-octane-csharp-rest-sdk

Other
4 stars 6 forks source link

SDK should support creating users with LDAP connection string #45

Open W92205 opened 4 years ago

W92205 commented 4 years ago

Currently, the WorkspaceUser does not have entries for ldap. This prevents creating users in a system using AD (Active Directory) and LDAP for user verification.

radislavB commented 4 years ago

Hi. SDK allows to set fields also by "SetValue" method Below, you can find example of adding LDAP user with Viewer role to default workspace. After adding user by API, user can do login and all fields will be updated by real values from LDAP server.

SharedspaceUser user = new SharedspaceUser(); user.UID = Guid.NewGuid().ToString();//required value, should be mapped value of uid field, for example ,entryUUID. If unknown, use random GUID and it will be updated on user login user.Name = "mail16@nga"; user.LastName = "a";//no matter , will be updated on login user.FirstName = "a";//no matter, will be updated on login user.Email = user.Name; user.Phone1 = "";//no matter, will be updated on login user.SetValue("ldap_dn", "cn=uid16@nga,ou=dummy_users,dc=maxcrc,dc=com");//user dn

var returnFields = new string[] { "name" }; SharedspaceUser createdUser = entityService.Create(sharedSpaceContext, user, returnFields);