Exemplo n.º 1
0
        private static void InitializeData(string setupPassword)
        {
            // node group with ID=0 mandatory, so it's the very first object to create
            NodeGroup defaultNG = new NodeGroup();

            defaultNG.Description = "Default group";
            defaultNG.Name        = "Default";
            new DAL.NodeGroupDAO().Save(defaultNG);

            Password adminP = new Password();

            adminP.Value = setupPassword;
            adminP       = PasswordManager.Add(adminP);

            User admin = new User();

            admin.Login = "******";
            admin.Name  = "Superadmin user";
            admin.Email = "*****@*****.**";
            //admin.Roles.Add(new UserRole{Role = RoleEnum.SuperAdmin});
            admin.IsEnabled = true;
            var adminRole = new UserRole();

            adminRole.Role         = RoleEnum.SuperAdmin;
            adminRole.GroupsInRole = new List <int> {
                0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };
            admin.PasswordId = adminP.Id;
            admin.Roles      = new List <UserRole>();
            admin.Roles.Add(adminRole);

            admin = new DAL.UserDAO().Save(admin);

            BackupSet dummy = new BackupSet();

            dummy.IsTemplate  = true;
            dummy.Name        = "Default BackupSet";
            dummy.Operation   = TaskOperation.Backup;
            dummy.Parallelism = new Parallelism()
            {
                Kind = ParallelismLevel.Disk, Value = 2
            };
            dummy.RetentionDays = 7;
            BasePath dp = new BasePath();

            dp.Path      = "*";
            dp.Recursive = true;
            dp.Type      = "FS:local";
            dummy.BasePaths.Add(dp);
            dummy = new DAL.BackupSetDAO().Save(dummy);
        }
Exemplo n.º 2
0
 public Password CreatePassword(Password p)
 {
     //if(sessionUser.IsSuperAdmin() || p.Id == sessionUser.PasswordId){
     return(PasswordManager.Add(p));
     //}
 }