public async Task <IDSScopePageRecord> PageScopsesAsync(int pageSize, string pagingState) { var adminStore = new IdentityServer3AdminStore(); var page = await adminStore.PageScopesAsync(pageSize, null); var state = HttpUtility.UrlEncode(page.PagingState); var record = new IDSScopePageRecord() { CurrentPagingState = HttpUtility.UrlEncode(page.CurrentPagingState), PageSize = pageSize, PagingState = HttpUtility.UrlEncode(page.PagingState), Scopes = page }; return(record); }
// GET: Admin/Home/Manage/5 public async Task <ActionResult> Scopes(string id, string email) { // note this is POC. We need a dynamic ajax page that does paging var usm = new UserScopeModel { AllowedScopes = new List <UserScopeRecord>(), UserScopeRecords = new List <UserScopeRecord>(), Email = email, UserId = id }; var fullUserStore = UserManager.FullUserStore; var adminStore = new IdentityServer3AdminStore(); var userScopes = await adminStore.FindScopesByUserAsync(id); foreach (var scope in userScopes) { usm.UserScopeRecords.Add(new UserScopeRecord() { Enabled = true, Name = scope }); } int pageSize = 100; var page = await adminStore.PageScopesAsync(100, null); var state = HttpUtility.UrlEncode(page.PagingState); var record = new IDSScopePageRecord() { CurrentPagingState = HttpUtility.UrlEncode(page.CurrentPagingState), PageSize = pageSize, PagingState = HttpUtility.UrlEncode(page.PagingState), Scopes = page }; foreach (var scope in page) { usm.AllowedScopes.Add(new UserScopeRecord() { Enabled = false, Name = scope.Name }); } return(View(usm)); }
// GET: Admin/Scope public async Task <ActionResult> Index() { var adminStore = new IdentityServer3AdminStore(); int pageSize = 100; var page = await adminStore.PageScopesAsync(100, null); var state = HttpUtility.UrlEncode(page.PagingState); var record = new IDSScopePageRecord() { CurrentPagingState = HttpUtility.UrlEncode(page.CurrentPagingState), PageSize = pageSize, PagingState = HttpUtility.UrlEncode(page.PagingState), Scopes = page }; return(View(record)); }