示例#1
0
        //~RoleStore() { Dispose(false); }

        // IRoleStore
        // IRoleStore
        // IRoleStore

        public async Task <IdentityResult> CreateAsync(RoleDefinition role, CancellationToken cancellationToken)
        {
            using (RoleDefinitionDataProvider dataProvider = new RoleDefinitionDataProvider(this.CurrentSiteIdentity)) {
                await dataProvider.AddItemAsync(role);
            }
            return(IdentityResult.Success);
        }
示例#2
0
 public async Task <ActionResult> RolesAdd_Partial(AddModel model)
 {
     if (!ModelState.IsValid)
     {
         return(PartialView(model));
     }
     using (RoleDefinitionDataProvider dataProvider = new RoleDefinitionDataProvider()) {
         if (!await dataProvider.AddItemAsync(model.GetData()))
         {
             throw new Error(this.__ResStr("alreadyExists", "A role named \"{0}\" already exists."), model.Name);
         }
         return(FormProcessed(model, this.__ResStr("okSaved", "New role \"{0}\" saved", model.Name), OnPopupClose: OnPopupCloseEnum.ReloadModule));
     }
 }
示例#3
0
 public async Task AddRoleWithUrlAsync(string roleName, string description, string postLoginUrl)
 {
     using (RoleDefinitionDataProvider roleDP = new RoleDefinitionDataProvider()) {
         await roleDP.AddItemAsync(new RoleDefinition { Name = roleName, Description = description, PostLoginUrl = postLoginUrl });
     }
 }