public string TransferRoles()
{
SecurityMigration securityMigration = new SecurityMigration();
List<string> roles = securityMigration.GetBexisRoles(DataBase);
SubjectManager subjectManager = new SubjectManager();
int newGroups = 0;
foreach (string role in roles)
{
string roleName = role;
if (role.IndexOf('_') == 0)
roleName = role.Substring(1, role.Length - 1);
if (subjectManager.GetGroupByName(roleName) == null)
{
newGroups++;
subjectManager.CreateGroup(roleName, roleName);
List<string> usersInRole = securityMigration.GetBexisUsersInRole(DataBase, roleName);
foreach (string userName in usersInRole)
{
if (subjectManager.GetUserByName(userName) != null)
subjectManager.AddUserToGroup(userName, roleName);
}
}
}
return "Groups was successfully transfered and old bexis users added to them";
}