BExISMigration.UserMigration.bexisUserGroup C# (CSharp) Method

bexisUserGroup() public method

public bexisUserGroup ( ) : long
return long
        public long bexisUserGroup()
        {
            SubjectManager subjectManager = new SubjectManager();

            string groupName = "bexisUser";
            string groupDescription = "user of old BExIS";

            Group group = subjectManager.GroupsRepo.Get(g => groupName.Equals(g.Name)).FirstOrDefault();

            if (group == null)
            {
                group = subjectManager.CreateGroup(groupName, groupDescription);
            }

            return group.Id;
        }

Usage Example

Example #1
0
        public void UserMigration()
        {
            // data base of bexis1 user query
            string filePath = AppConfiguration.GetModuleWorkspacePath("BMM");
            // names of the features witch set to the group "bexisUser"
            string[] featureNames = { "Search", "Data Collection", "Research Plan", "Data Dissemination" };

            UserMigration userMigration = new UserMigration();

            // create or get a group named "bexisUser"
            long groupId = userMigration.bexisUserGroup();

            // set feature permission of the group "bexisUser"
            userMigration.SetFeaturePermissions(groupId, featureNames);

            // query bexis1 user from provider.users and generate a random password
            List<UserProperties> BExISUsers = userMigration.GetFromBExIS(DataBase);

            // transfer users to bpp; not all user data are provided in bpp
            // save usernames and passwords in file "passwords.txt"
            userMigration.CreateOnBPP(BExISUsers, filePath, groupId);
        }