Skip to main content
Nintex Community Menu Bar

Custom Blackpearl User/Role Manager

  • January 14, 2008
  • 4 replies
  • 11 views

Forum|alt.badge.img+9

Has anyone attempted to use the API to create a custom user/role manager, kind of like this guy did for K2 2003: http://k2underground.com/forums/thread/14599.aspx?


Is there any documentation out there for using the SecurityManagementAPI for blackpearl?  There is no reference to it in the SDK documentation...


On the surface, it seems simple enough - it provides Add, Delete and Get methods for users and roles but I have a number of questions on how to actually use those methods.  For example, you need to provide either an 'Application' or 'Object' when getting a list of users or roles... what is an application or object in this context?

4 replies

Forum|alt.badge.img+9
  • Author
  • January 14, 2008

Well, I never found any documentation on the API, but once I found the CORRECT API, it became pretty straight-forward.  Here is a sample of some code for anyone else out there that may need to do something similar:


// Instantiate the manager API


UserRoleManager sm = new UserRoleManager();


 


// Connect to environment


sm.Connection = sm.CreateConnection();


sm.Connection.Open(

"[host server connection string here, can get it from object browser]");


// END connect to environment


// List all roles


Role[] roles = sm.GetRoles();


foreach (Role role in roles)


{


System.Diagnostics.

Debug.WriteLine(role.Name);


System.Diagnostics.

Debug.WriteLine(" " + role.GetData());


}


// END list all roles


// Add a new role


Role newRole = new Role("Test");


newRole.LoadData(

"<role name="Test" guid="" + newRole.Guid + "" description="" isdynamic="false"><include><users><user name="K2:BSDv-tbyrne" /></users><groups /><smartobjects /></include><exclude><users /><groups /><smartobjects /></exclude></role>");


sm.CreateRole(newRole);


// END add new role


// Append a '7' to the first role's description (update test)


Role updateRole = roles[0];


updateRole.Description +=

"7";


sm.UpdateRole(updateRole);


// END Append a '7' to the first role's description (update test)


 


sm.Connection.Close();


Forum|alt.badge.img+9
  • Nintex Partner
  • January 15, 2008
Thanks for posting this Tim.  This should be helpful to many.

Forum|alt.badge.img+3
  • February 5, 2008
What was the correct API?

Forum|alt.badge.img+9
  • Author
  • February 5, 2008

SourceCode.Security.UserRoleManager.Management