本文整理汇总了C#中ApplicationRoleManager类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationRoleManager类的具体用法?C# ApplicationRoleManager怎么用?C# ApplicationRoleManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationRoleManager类属于命名空间,在下文中一共展示了ApplicationRoleManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AccountController
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager, IAuthenticationManager authenticationManager, ApplicationRoleManager roleManager)
{
this.userManager = userManager;
this.signInManager = signInManager;
this.authenticationManager = authenticationManager;
this.roleManager = roleManager;
}
示例2: IdentityUnitOfWork
public IdentityUnitOfWork(string connectionString)
{
_db = new ApplicationContext(connectionString);
_userManager = new ApplicationUserManager(new UserStore<ApplicationUser>(_db));
_roleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(_db));
_clientManager = new ClientManager(_db);
}
示例3: AccountController
public AccountController(ApplicationUserManager userManager, ApplicationRoleManager roleManager,
ISecureDataFormat<AuthenticationTicket> accessTokenFormat)
{
RoleManager = roleManager;
UserManager = userManager;
AccessTokenFormat = accessTokenFormat;
}
示例4: IdentityModelHelper
public IdentityModelHelper(ApplicationUserManager userManager, ApplicationRoleManager roleManager)
{
Contract.Assert(null != userManager);
Contract.Assert(null != roleManager);
_userManager = userManager;
_roleManager = roleManager;
}
示例5: UsersAdminController
public UsersAdminController(
ApplicationUserManager userManager,
ApplicationRoleManager roleManager)
{
UserManager = userManager;
RoleManager = roleManager;
}
示例6: AccountController
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager,
ApplicationRoleManager roleManager)
{
UserManager = userManager;
SignInManager = signInManager;
RoleManager = roleManager;
}
示例7: ApplicationGroupManager
public ApplicationGroupManager()
{
_db = HttpContext.Current.GetOwinContext().Get<ApplicationDbContext>();
_userManager = HttpContext.Current.GetOwinContext().GetUserManager<ApplicationUserManager>();
_roleManager = HttpContext.Current.GetOwinContext().Get<ApplicationRoleManager>();
_groupStore = new ApplicationGroupStore(_db);
}
示例8: CourseTemplatesController
public CourseTemplatesController(ApplicationDbContext context, ApplicationUserManager userManager,
ApplicationRoleManager roleManager)
{
_context = context;
_userManager = userManager;
_roleManager = roleManager;
}
示例9: RolesAdminController
public RolesAdminController(ApplicationUserManager userManager,
ApplicationRoleManager roleManager,ApplicationPermissionManager perManager)
{
UserManager = userManager;
RoleManager = roleManager;
PermissionManager = perManager;
}
示例10: Application_Start
protected async void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
// ユーザーとロールの初期化
// ロールの作成
var roleManager = new ApplicationRoleManager(new UserStore());
await roleManager.CreateAsync(new ApplicationRole { Name = "admin" });
await roleManager.CreateAsync(new ApplicationRole { Name = "users" });
var userManager = new ApplicationUserManager(new UserStore());
// 一般ユーザーの作成
await userManager.CreateAsync(new ApplicationUser { UserName = "tanaka" }, "[email protected]");
await userManager.AddToRoleAsync(
(await userManager.FindByNameAsync("tanaka")).Id,
"users");
// 管理者の作成
await userManager.CreateAsync(new ApplicationUser { UserName = "super_tanaka" }, "[email protected]");
await userManager.AddToRoleAsync(
(await userManager.FindByNameAsync("super_tanaka")).Id,
"users");
await userManager.AddToRoleAsync(
(await userManager.FindByNameAsync("super_tanaka")).Id,
"admin");
Debug.WriteLine("-----------");
}
示例11: ApplicationPermissionManager
public ApplicationPermissionManager(ApplicationDbContext context)
{
_db = context;
_userManager = new ApplicationUserManager(_db);
_roleManager = new ApplicationRoleManager(_db);
_permissionStore = new ApplicationPermissionStore(_db);
}
示例12: RoleMenusController
public RoleMenusController(IRoleMenuService roleMenuService, IUnitOfWorkAsync unitOfWork, IMenuItemService menuItemService, ApplicationRoleManager roleManager)
{
_roleMenuService = roleMenuService;
_menuItemService = menuItemService;
_roleManager = roleManager;
_unitOfWork = unitOfWork;
}
示例13: IdentityUnitOfWork
public IdentityUnitOfWork(string connectionString)
{
db = new StoreContext(connectionString);
UserManager = new ApplicationUserManager(new UserStore<ApplicationUser>(db));
RoleManager = new ApplicationRoleManager(new RoleStore<ApplicationRole>(db));
ClientManager = new ClientManager(db);
}
示例14: AuthenticationRepository
public AuthenticationRepository(IOwinContext owinContext)
{
userManager = owinContext.GetUserManager<ApplicationUserManager>();
roleManager = owinContext.Get<ApplicationRoleManager>();
authenticationManager = owinContext.Authentication;
request = owinContext.Request;
}
示例15: CreateRole
public bool CreateRole(string name)
{
var rm = new ApplicationRoleManager(
new RoleStore<IdentityRole>(context));
var idResult = rm.Create(new IdentityRole(name));
return idResult.Succeeded;
}