GetBexisUsersInRole() private method

private GetBexisUsersInRole ( string dataBase, string roleName ) : List
dataBase string
roleName string
return List
Example #1
0
        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";
        }