private void CreateSomeDummyData() { MongoClient mongoClient = new MongoClient(MongoDatabaseOptions.ConnectionString); IMongoDatabase mongoDatabase = mongoClient.GetDatabase(MongoDatabaseOptions.Datasource); IMongoCollection <Role> roleCollection = mongoDatabase.GetCollection <Role>("roles"); IMongoCollection <User> userCollection = mongoDatabase.GetCollection <User>("users"); Role superAdminRole = new Role { Id = "5c06a15e4cc9a850bca44488", Name = "SuperAdmin", NormalizedName = "SUPERADMIN", DisplayName = "Super Admin", Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp("5c162e9005924c1c741bfdc2") } }; // Pass: @Dm1n! User adminAccount = new User { Id = "5ce287ee569d6f23e8504cef", Username = "******", NormalizedUserName = "******", Domain = string.Empty, PasswordHash = "AQAAAAEAACcQAAAAEBhhMYTL5kwYqXheHSdarA/+vleSI07yGkTKNw1bb1jrTlYnBZK1CZ+zdHnqWwLLDA==", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", IsConfirmedEmail = true, SecurityStamp = "7YHYVBYWLTYC4EAPVRS2SWX2IIUOZ3XM", AccessFailedCount = 0, IsLockoutEnabled = false, LockoutEndDate = DateTime.UtcNow, Roles = new List <string> { "SuperAdmin" }, Claims = new List <BaseClaim> { StandardClaims.AccessAppSelectorPage, StandardClaims.Sub("5ce287ee569d6f23e8504cef"), StandardClaims.UserId("5ce287ee569d6f23e8504cef"), StandardClaims.Name("admin") } }; roleCollection.InsertOne(superAdminRole); userCollection.InsertOne(adminAccount); }
public Role GenerateRole() { string roleName = GenerateUniqueRoleName(); return(new Role { Id = DataUtil.GenerateUniqueId(), Name = roleName, NormalizedName = roleName.ToUpper(), DisplayName = roleName, Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp("5c162e9005924c1c741bfdc2") } }); }
public Task Upgrade(IVersionContext versionContext) { var superAdminRole = new Role { Id = "5c06a15e4cc9a850bca44488", Name = Roles.SuperAdmin, NormalizedName = Roles.SuperAdmin.ToUpper(System.Globalization.CultureInfo.CurrentCulture), DisplayName = "Super Admin", Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp(Constants.CoreAppId) } }; // Pass: @Dm1n! var adminAccount = new User { Id = "5ce287ee569d6f23e8504cef", Username = "******", NormalizedUserName = "******", Domain = string.Empty, PasswordHash = "AQAAAAEAACcQAAAAEBhhMYTL5kwYqXheHSdarA/+vleSI07yGkTKNw1bb1jrTlYnBZK1CZ+zdHnqWwLLDA==", Email = "*****@*****.**", NormalizedEmail = "*****@*****.**", IsConfirmedEmail = true, SecurityStamp = "7YHYVBYWLTYC4EAPVRS2SWX2IIUOZ3XM", AccessFailedCount = 0, IsLockoutEnabled = false, LockoutEndDate = DateTime.UtcNow, Roles = new List <string> { Roles.SuperAdmin }, Claims = new List <BaseClaim> { StandardClaims.AccessAppSelectorPage, StandardClaims.Sub("admin"), StandardClaims.UserId("5ce287ee569d6f23e8504cef"), StandardClaims.FullName("Super Admin") } }; versionContext.InsertData(adminAccount); versionContext.InsertData(superAdminRole); return(Task.CompletedTask); }
public async Task Upgrade(IVersionContext versionContext) { var siteAdminRole = new Role { Id = "5f6074fbf7a6d360d8a908e7", Name = Roles.SiteAdmin, DisplayName = "Site Admin", NormalizedName = "SITEADMIN", Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp(Constants.CMS_APP_ID) } }; var superAdmin = await _userRepository.FindByNormalizedUsername("admin".ToUpper()); superAdmin.Roles.Add(Roles.SiteAdmin); await _userRepository.UpdateAsync(superAdmin.Id, superAdmin); versionContext.InsertData(siteAdminRole); }
public Task Upgrade(IVersionContext versionContext) { var adminRole = new Role { Id = "5e6b506e52605e513cd02265", Name = Roles.Admin, NormalizedName = Roles.Admin.ToUpper(System.Globalization.CultureInfo.CurrentCulture), DisplayName = Roles.Admin, Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp(Constants.CoreAppId) } }; adminRole.Claims.AddRange(StandardClaims .GenerateClaimsByPages(new string[] { "apps-management", "databases-management", "pages-management", "page-builder", "menus", "role-claims", "dynamic-list-builder", "roles-management", "users-management", "database-form", "app-form", "dynamic-list-management", "standard-list-management", "role-form", "add-user-form", "user-form", "charts-management", "services-monitor", "service-logs", "service-dashboard", "backup-management", "chart-builder", "backup-builder", "backup-upload", "backup-restore", "user-info", "localization-builder", "localization-management" })); var developerRole = new Role { Id = "5e6b506e52605e513cd02266", Name = Roles.Developer, NormalizedName = Roles.Developer.ToUpper(System.Globalization.CultureInfo.CurrentCulture), DisplayName = Roles.Developer, Claims = new List <BaseClaim> { StandardClaims.AccessCoreApp(Constants.CoreAppId) } }; developerRole.Claims.AddRange(StandardClaims .GenerateClaimsByPages(new string[] { "pages-management", "page-builder", "dynamic-list-builder", "dynamic-list-management", "standard-list-management", "charts-management", "services-monitor", "service-logs", "service-dashboard", "chart-builder", "user-info", "localization-builder", "localization-management" })); var userRole = new Role { Id = "5e6b506e52605e513cd02267", Name = Roles.User, NormalizedName = Roles.User.ToUpper(System.Globalization.CultureInfo.CurrentCulture), DisplayName = Roles.User, Claims = new List <BaseClaim> { } }; userRole.Claims.AddRange(StandardClaims .GenerateClaimsByPages(new string[] { "user-info" })); versionContext.InsertData(adminRole); versionContext.InsertData(developerRole); versionContext.InsertData(userRole); return(Task.CompletedTask); }