public async Task <OrganizationDto> Get(int organizationId) { var org = await _organizationRetrievalService .GetOrganizationByIdAsync(organizationId); return(new OrganizationDto(org)); }
public async Task <IActionResult> Put(int organizationId, string userId) { var user = await _userRetrievalService.GetUserByIdAsync(userId); var org = await _orgRetrievalService.GetOrganizationByIdAsync(organizationId); await _orgMemberService.AddToOrganizationAsync(user, org); return(Ok()); }
public async Task <string[]> List(int organizationId, string userId, CancellationToken token) { var user = await _userRetrievalService.GetUserByIdAsync(userId, new UserRetrievalOptions { IncludeOrgMembership = true }, token); await _organizationRetrievalService.GetOrganizationByIdAsync(organizationId); // just to check its existence return(user.OrganizationMembership .FirstOrDefault(m => m.OrganizationId == organizationId) ?.Roles.Select(r => r.Role) .OrderBy(r => r) .ToArray() ?? Array.Empty <string>()); }
public async Task <IActionResult> OnGetAsync(int id) { Organization = await _organizationRetrievalService.GetOrganizationByIdAsync(id, new OrganizationRetrievalOptions { LoadHostnames = true }); return(Page()); }
public async Task <OrganizationSettingDto[]> List(int organizationId, CancellationToken cancellationToken) { await _organizationRetrievalService .GetOrganizationByIdAsync(organizationId, cancellationToken : cancellationToken); // to check for org existence var settings = await _organizationSettingsCache .GetAllSettingsForOrganizationAsync(organizationId); var values = settings.ToDictionary( s => s.Name, s => s.Value); return(_organizationSettingsRegistry.GetEntries() .OrderBy(e => e.Section) .ThenBy(e => e.Name) .Select(e => new OrganizationSettingDto(e) { Value = values.ContainsKey(e.Name) ? values[e.Name] : null }).ToArray()); }
private async Task <IActionResult> PageAsync(int id) { var org = await _organizationRetrievalService.GetOrganizationByIdAsync(id, new OrganizationRetrievalOptions { LoadHostnames = true }); Organization ??= org; if (Organization == null) { return(NotFound()); } Hostnames ??= org.CommaSeparatedHostnames; return(Page()); }