Skip to main content

Hi,


I've added a role to a process using the managment console... but I used a wrong role 😥 and now I want to delete this one but I can't find any delete button?


How can I do this?

Thanks for your reply... but nope.


We can right click on the role name in the managment tree on the role part... but actually I need the same under "Workflow Server>>Processes>>MYPROJECT>>MYPROCESS>>roles".


If I try your solution, to clean up my server and after recreate a new role for example... I've the following error message "Role has dependancies. Cannot delete." So, while my role is referenced directly under "MYPROCESS", I can't delete it... but I've no way to unreference it. 😥


Any idea?


I'd like to remove a role from a process too... Is there a way to do so, now, except editing the database?


There is a great article on the accessing roles programmatically using the UserRoleManager over at Pitchblack http://www.k2underground.com/blogs/pitchblack/archive/2008/04/15/k2-role-manipulation-using-the-sourcecode-security-userrolemanager-management-namespace.aspx


You should be able to delete a role using the following code. 


using SourceCode.Security.UserRoleManager.Management;
using SourceCode.Hosting.Client.BaseAPI;


......


string K2HostServer = "BLACKPEARL";


userRoleManager = new UserRoleManager();
userRoleManager.CreateConnection();
userRoleManager.Connection.Open(string.Format("Integrated=True;IsPrimaryLogin=True;Authenticate=True;EncryptedPassword=False;Host={0};Port=5555", K2HostServer));


Role role = userRoleManager.GetRole("ROLENAME");
userRoleManager.DeleteRole(role.Guid, role.Name);


You will need to add reference SourceCode.Security.UserRoleManager.Management.dll and SourceCode.HostClientAPI.dll.


Is it really necessary to write own code to delete a role form a process? I have the same problem - and I am really wondering about the K2 ManagerConsole, that it is not possible to delete a role from a process.

Reply