StrataFrame Forum

How To programmically add/edit a user f

http://forum.strataframe.net/Topic28817.aspx

By Jeff Pagley - 10/25/2010

Hi SF,

I have a need to add/edit users to RBS SFSUsers table without using the SF RBS interface.  How do I do this?

Thanks,

Jeff
By Greg McGuffey - 10/25/2010

Use the RBS BOs. They are under the Security.BusinessObjects namespace.
By Jeff Pagley - 10/26/2010

Hi Greg,

The following code is failing to add a new user.  What am I missing?



MicroFour.StrataFrame.Security.BusinessObjects.
SFSUsersBO users = new MicroFour.StrataFrame.Security.BusinessObjects.SFSUsersBO();

users.Add();

users.us_FirstName =
"New";

users.us_LastName =
"User";

users.us_PasswordNeverExpires =
true;

users.us_Username =
"NewUser";

users.us_Data =
"nu"; //password

if (users.Save() != MicroFour.StrataFrame.Data.SaveUndoResult.Success)

{

MessageBox.Show("Add user failed.");

return;

}

By Greg McGuffey - 10/26/2010

Jeff,

Very close. Set the us_PassWordPlaintext property instead of the us_data property. The data property is loaded with a bunch of other properties that are encrypted and stored as a single field in the database. The plain text password never leaves the machine. It is encrypted and placed in the data field and the data field is sent over the wire and saved.
By Jeff Pagley - 10/27/2010

It failed again.  So I debugged the SF assembly and found out I needed to set the us_ConfirmPassword property as well.  It works fine now.

Thanks, Jeff
By Greg McGuffey - 10/27/2010

Excellent! Sorry I missed that, but I'm glad you getting competent at using source to figure out things like this.  It can seem a bit daunting at first, but it's really nice to be able to figure this sort of stuff out quickly yourself!