示例#1
0
 private void AddRoles(TeduDbContext context)
 {
     context.Roles.Add(new IdentityRole()
     {
         Id   = "Admin",
         Name = "Global Access"
     });
     context.Roles.Add(new IdentityRole()
     {
         Id   = "CanEditUser",
         Name = "Add, modify, and delete Users"
     });
     context.Roles.Add(new IdentityRole()
     {
         Id   = "CanEditGroup",
         Name = "Global Access"
     });
     context.Roles.Add(new IdentityRole()
     {
         Id   = "CanEditRole",
         Name = "Add, modify, and delete roles"
     });
     context.Roles.Add(new IdentityRole()
     {
         Id   = "User",
         Name = "Restricted to business domain activity"
     });
     // Some example initial roles. These COULD BE much more granular:
     context.SaveChanges();
 }
示例#2
0
 public void AddGroups(TeduDbContext context)
 {
     foreach (var groupName in _initialGroupNames)
     {
         context.AppGroups.Add(new Model.Models.AppGroup()
         {
             Name = groupName
         });
         context.SaveChanges();
     }
 }