People change their names for all sorts of reasons, marriage being the most common, but there are plenty of other reasons, such as a change of religious belief or wanting to get rid of an unfortunate surname. Whatever the reason, the Users and Roles utility that ships with Metastorm BPM doesn’t have any support for changing user names. The FreeFlow Administrator can help out here. Just fire it up, change the user’s name and apply the changes. This will change the user name in all relevant Metastorm tables. However it can’t change every reference to that user. For instance if you’ve stored a user name in a custom variable, that won’t get updated, since there isn’t really any way of knowing that the custom variable value refers to a user.
This can also be achieved programmatically. This may be useful if your corporate standards have changed and you need to change every user’s name in the system. Or you may want to prefix the users’ names with the domain name because you’re moving to SSO. Whatever the reason, here’s some sample code to achieve this.
using System; using FreeFlow.Administration; namespace ChangeAllUsers { class Program { static void Main(string[] args) { Server server = new Server(); server.Connect("sa", "a", "Metastorm"); foreach (User user in server.Users) { Console.WriteLine("Processing " + user.Name); user.Name = "domain\\" + user.Name; user.ApplyChanges(); } } } }
No comments:
Post a Comment