示例#1
0
 private async Task StoreToken(string accessToken, string emailAddress)
 {
     using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
     {
         await awayStatusRepository.SetGoogleTokenAsync(emailAddress, accessToken);
     }
 }
示例#2
0
 private string LookupEmailFromToken(string accessToken)
 {
     using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
     {
         var awayStatus = awayStatusRepository.LookupGoogleToken(accessToken);
         return awayStatus != null ? awayStatus.UserName : null;
     }
 }
示例#3
0
        private void SendInitialUserInOut()
        {
            using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
            {
                var status = awayStatusRepository.GetStatus(_userEmail);
                var away = status != null && status.Away;

                SendMessage(new UserCheckInOut { UserName = _userEmail, CurrentUser = true, Away = away });
            }
        }
        private SnapshotArchiver(string hubId)
        {
            _hubId = hubId;
            _executionTask = null;

            using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
            {
                var users = awayStatusRepository.GetAllForHub(hubId);
                emailAddresses = users.Select(u => u.UserName).ToArray();
            }
        }
示例#5
0
 public string GetHomeHubIdFromEmail(string emailAddress)
 {
     if (emailAddress != null)
     {
         using (var awayStatusRepository = new AwayStatusRepository())
         {
             var awayStatus = awayStatusRepository.GetStatus(emailAddress);
             if (awayStatus != null)
             {
                 return awayStatus.HomeHubId;
             }
         }
     }
     return null;
 }
示例#6
0
        public async Task RemoveExpiredSnapshots()
        {
            Services.Log.Info("Running Job: Remove Expired snapshots");
            using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
            {
                var allWithToken = awayStatusRepository.GetAll()
                    .Where(s => s.DriveRefreshToken != null && s.DriveRefreshToken != "")
                    .Select(s => s.UserName)
                    .ToList();

                foreach (var user in allWithToken)
                {
                    await RemoveExpiredForUser(user);
                }
            }
        }
        private async Task<string[]> UsersForHub()
        {
            var hubId = await _lookupToken.GetHomeHubId(this.User);
            if (string.IsNullOrEmpty(hubId))
            {
                return null;
            }

            using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
            {
                var users = awayStatusRepository.GetAllForHub(hubId);
                return users.Select(u => u.UserName).ToArray();
            }
        }
 private async Task StoreDriveTokens(string emailAddress, string accessToken, string refreshToken)
 {
     using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
     {
         await awayStatusRepository.SetDriveTokensAsync(emailAddress, accessToken, refreshToken);
     }
 }
 private bool CheckUserExists(string emailAddress)
 {
     using (IAwayStatusRepository awayStatusRepository = new AwayStatusRepository())
     {
         return awayStatusRepository.GetStatus(emailAddress) != null;
     }
 }