public ActionResult <CollectionConfiguration> GetConfiguration() { //TODO: Consider extracting to a annotation or an action filter if (_userProvider.IsCurrentUserInRole("Administrator") == false) { return(Forbid()); } return(_configurationProvider.GetModel()); }
public async Task <IActionResult> LockUser(string userId) { if (_userContextProvider.IsCurrentUserInRole("Administrator") == false) { return(Forbid()); } var user = _dbContext.ApplicationUser .Include(u => u.Collections) .SingleOrDefault(u => u.Id == userId); if (user == null) { return(NotFound()); } foreach (var collection in user.Collections) { collection.IsPublic = false; } _dbContext.SaveChanges(); await _userManager.SetLockoutEnabledAsync(user, true); await _userManager.SetLockoutEndDateAsync(user, DateTimeOffset.Now.AddMonths(1)); return(Ok()); }