public bool AddRole(string roleName) { if (_roleProvider.RoleExists(roleName)) return false; _roleProvider.CreateRole(roleName); return true; }
private void CreateTestData() { _registeredUserId = _userRegistrationService.Register("UserName", "VeryHardPassword123"); _registeredAdminId = _userRegistrationService.Register("AdminName", "VeryHardPassword123"); _registeredAdminRole = "Admin"; _registeredUserRole = "User"; _roleProvider.CreateRole(_registeredAdminRole, false); _roleProvider.CreateRole(_registeredUserRole, false); _roleProvider.AddUserToRole(_registeredAdminId, _registeredAdminRole); }
private void SetDefaultUsersAndRoles() { Guid userId = _userRegistrationService.Register(DefaultAdminName, DefaultAdminPassword, false); _roleProvider.CreateRole(AdministratorRoleName, false); _roleProvider.AddUserToRole(userId, AdministratorRoleName); }
private static void SetDefaultUsersAndRoles() { IUserRegistrationService registrationService = bootstrapper.Kernel.Get <IUserRegistrationService>(); IRoleProvider roleProvider = bootstrapper.Kernel.Get <IRoleProvider>(); Guid userId = registrationService.Register("Timur", "Admin", false); roleProvider.CreateRole("Administrator", false); roleProvider.AddUserToRole(userId, "Administrator"); }
public override void CreateRole(string roleName) { RoleProvider.CreateRole(roleName); }
public void TestCreatingRole() { _provider.CreateRole("Programmer"); CollectionAssert.AreEqual(new[] { "Administrator", "Programmer" }, _provider.GetAllRoles().OrderBy(role => role).ToArray()); }