Beispiel #1
0
        public async Task <bool> HasCurrentUserAccessToRegion(int regionId)
        {
            var nationalSocietyId = await _nyssContext.Regions
                                    .Where(r => r.Id == regionId)
                                    .Select(r => r.NationalSociety.Id)
                                    .FirstOrDefaultAsync();

            return(await _nationalSocietyAccessService.HasCurrentUserAccessToNationalSocieties(new[] { nationalSocietyId }));
        }
        public async Task <bool> HasCurrentUserAccessToSmsGateway(int smsGatewayId)
        {
            var nationalSocietyId = await _nyssContext.GatewaySettings
                                    .Where(g => g.Id == smsGatewayId)
                                    .Select(s => s.NationalSociety.Id)
                                    .SingleAsync();

            return(await _nationalSocietyAccessService.HasCurrentUserAccessToNationalSocieties(new[] { nationalSocietyId }));
        }
Beispiel #3
0
        public async Task <bool> HasCurrentUserAccessToProject(int projectId)
        {
            if (_authorizationService.IsCurrentUserInRole(Role.Supervisor))
            {
                return(await HasSupervisorAccessToProject(_authorizationService.GetCurrentUserName(), projectId));
            }

            var nationalSocietyId = await _nyssContext.Projects
                                    .Where(p => p.Id == projectId)
                                    .Select(p => p.NationalSocietyId)
                                    .SingleAsync();

            return(await _nationalSocietyAccessService.HasCurrentUserAccessToNationalSocieties(new[] { nationalSocietyId }));
        }
Beispiel #4
0
 protected override Task <bool> HasAccess(int nationalSocietyId) =>
 _nationalSocietyAccessService.HasCurrentUserAccessToNationalSocieties(new[] { nationalSocietyId });