/// <summary> /// Initializes a new instance of the <see cref="IndexController" /> class. /// </summary> /// <param name="session">The session.</param> /// <param name="authenticatedUser">The authenticated user.</param> /// <param name="timezoneHydration">The timezone hydration.</param> /// <param name="service"></param> public IndexController(ISession session, IAuthenticatedUser authenticatedUser, ITimezoneHydration timezoneHydration, ITwillioService service) { _session = session; _authenticatedUser = authenticatedUser; _timezoneHydration = timezoneHydration; _service = service; }
private void InitData() { _authenticatedUserCredentials = A.Fake <ITwitterCredentials>(); _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_authenticatedUserCredentials); _authenticatedUser = CreateAuthenticatedUser(); _currentCredentials = A.Fake <ITwitterCredentials>(); _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_currentCredentials); }
public bool UnSubscribeAuthenticatedUserFromList(IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return(authenticatedUser.UnSubscribeFromList(this)); } return(_twitterListController.UnSubscribeAuthenticatedUserFromList(this)); }
public bool SubscribeAuthenticatedUserToList(IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return(authenticatedUser.SubscribeToList(this)); } return(_twitterListController.SubscribeAuthenticatedUserToList(this)); }
protected override Command CreateInsertCommand(PersonEntity2 entity, IAuthenticatedUser user, string selector) { Expression <Func <PersonEntity2, object> >[] excludedProperties; if (Dependencies().Any()) { excludedProperties = new Expression <Func <PersonEntity2, object> >[] { m => m.Id, m => m.SpouseId }; } else { excludedProperties = new Expression <Func <PersonEntity2, object> >[] { m => m.Id }; } var command = Query <PersonEntity2> .Single() .Connection(ConnectionName) .StoredProcedure("p_Person_Create") .RecordInstance(entity) .AutoGenerateParameters( excludedProperties: excludedProperties ) .RecordInstance(entity) .MapProperties( pm => pm.Map <PersonEntity2>(m => m.Id) //.Index(0), ); command.OnBeforeCommandExecuted(cmd => { if (Dependencies().Any()) // It is a self reference for Spouse { var e = (PersonEntity2)Dependencies().Single().Entity; entity.SpouseId = e.Id; cmd.Parameters( // Map the extra parameters for the foreign key(s) p => p.Name("SpouseId").Value(entity.SpouseId) ); } }); command.OnAfterCommandExecuted(cmd => // Handle symmetric relationship { if (Dependencies().Any()) // It is a self reference for Spouse { var e = (PersonEntity2)Dependencies().Single().Entity; e.SpouseId = entity.Id; // Update the parent entity with the id of the created child one } }); return(command); }
public async Task ExecuteAsync(IRepositoryContext repositoryContext, IAuthenticatedUser user, IUnitOfWork unitOfWork) { await CommandAggregate.SaveAsync(user, unitOfWork); repositoryContext.Dependencies.Add(new EntityDependency { Entity = CommandAggregate.RootEntity }); }
public void Execute(IRepositoryContext repositoryContext, IAuthenticatedUser user, IUnitOfWork unitOfWork) { CommandAggregate.Save(user, unitOfWork); repositoryContext.Dependencies.Add(new EntityDependency { Entity = CommandAggregate.RootEntity }); }
public Task <string> CreateUser(IAuthenticatedUser user) { var applicationUser = new Models.ZeroDayTwitterUser { Name = user.Name, ScreenName = user.ScreenName, TwitterId = user.IdStr }; return(CreateUser(applicationUser)); }
protected override Command CreateUpdateCommand(ClassEntity entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(ConnectionName) .StoredProcedure("p_Class_Update") .RecordInstance(entity) .AutoGenerateParameters()); }
private static void SetBio(IReadOnlyCollection <WorldEntry> worlds, IAuthenticatedUser user) { var parameters = new AccountUpdateProfileParameters { Description = $"Bot that posts updates to changes to FFXIV world servers.\nAt the moment: {worlds.Count} Worlds, {worlds.Count(e => e.Status.HasFlag(WorldStatus.Congested))} congested, {worlds.Count(e => e.Status.HasFlag(WorldStatus.Preferred))} preferred.\nCharacter creation allowed on {worlds.Count(e => e.Status.HasFlag(WorldStatus.CharCreationAllowed))} of {worlds.Count}." }; Account.UpdateAccountProfile(parameters); }
// Remove Subscription /// <summary> /// Unubscribe the authenticated user to a specific list /// </summary> public static bool UnSubscribeAuthenticatedUserToList(long listId, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return(authenticatedUser.UnSubscribeFromList(listId)); } return(TwitterListController.UnSubscribeAuthenticatedUserFromList(listId)); }
private TwitterHandler() { Auth.SetUserCredentials( "SpbJ3zlg5dkJBSOw9ot9rvSI9", "U3V7bLEk6fIgBF1tjBMj2921tybenunbM0924uFI60OPUtpLzA", "1036320108229128192-M5D5delv6UUrND9Lxb86sQRPnxd3rB", "Y35S1HzckYmxcq4UWcw9byNnHzIcF8hnWwJ0Dh3r1rAhc"); user = User.GetAuthenticatedUser(); }
public IEnumerable <Forum> FindAll() { this.loggingService.Application.DebugWrite("FindAll called on ForumService"); IAuthenticatedUser currentUser = this.userProvider.CurrentUser; // TODO: Permissions!! return(this.dataStore.FindAllForums()); }
internal async Task LoadLiveTimeline(TwitterClient userClient, IAuthenticatedUser user) { try { internalHelpers.DisplayLogo(user); Console.WriteLine(); Console.WriteLine("Retrieving timeline.."); var homeTimelineTweets = await userClient.Timelines.GetHomeTimelineAsync(new GetHomeTimelineParameters() { PageSize = initialPageSize }); Console.WriteLine(); Console.WriteLine("---------------------------------------------------------".Pastel(colors.seperatorColor)); ITweet finalTweet = null; if (homeTimelineTweets.Length > 0) { homeTimelineTweets = homeTimelineTweets.OrderBy(t => t.CreatedAt.UtcDateTime).ToArray(); foreach (var tweet in homeTimelineTweets) { internalHelpers.DisplayTweet(tweet); finalTweet = tweet; Thread.Sleep(TimeSpan.FromSeconds(scanDelay)); } } while (true) { Thread.Sleep(TimeSpan.FromSeconds(searchDelay)); var parameters = new GetHomeTimelineParameters() { SinceId = finalTweet.Id, PageSize = 1, }; var latestTweet = await userClient.Timelines.GetHomeTimelineAsync(parameters); if (latestTweet.Length > 0) { if (latestTweet[0] != finalTweet) { internalHelpers.DisplayTweet(latestTweet.Last()); finalTweet = latestTweet.Last(); } } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } }
protected override Command CreateDeleteCommand(IdentityProvider entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(AuthorizationConnectionClass.GetConnectionName()) .StoredProcedure("[AccessControl].[pIdentityProvider_Delete]") .Parameters( p => p.Name("identityProviderId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Car entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(MechanicServicesSingleVehicleConnectionClass.GetConnectionName()) .StoredProcedure("[GarageBoundedContext].[pCar_Delete]") .Parameters( p => p.Name("carId").Value(entity.Id) )); }
/// <summary> /// Return current user from session /// </summary> public static IAuthenticatedUser GetCurrentUser(HttpSessionStateBase session) { IAuthenticatedUser user = session["User"] as IAuthenticatedUser; if (user == null) { return(null); } return(user); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { IAuthenticatedUser user = null; if (controllerContext.HttpContext.Session != null) { user = controllerContext.HttpContext.Session[sessionKey] as IAuthenticatedUser; } return(user); }
protected override Command CreateDeleteCommand(Executive entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(ExecutiveEmployeePersonConnectionClass.GetConnectionName()) .StoredProcedure("[ExecutiveBoundedContext].[pExecutive_Delete]") .Parameters( p => p.Name("executiveId").Value(entity.Id) )); }
public UpdateMemberInfoCommand(IAuthenticatedUser authenticatedUser, string?briefDescription, string?lookingFor, string?interests, string?city, string?country) { AuthenticatedUser = authenticatedUser; BriefDescription = briefDescription; LookingFor = lookingFor; Interests = interests; City = city; Country = country; }
protected override Command CreateDeleteLinksCommand(Role entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(AuthorizationConnectionClass.GetConnectionName()) .StoredProcedure("[AccessControl].[pRole_UnlinkUsers]") .Parameters( p => p.Name("roleId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Manager entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(ManagerWithEmployeesConnectionClass.GetConnectionName()) .StoredProcedure("[ManagerBoundedContext].[pManager_Delete]") .Parameters( p => p.Name("managerId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(UserEntity entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(ConnectionName) .StoredProcedure("p_User_Delete") .Parameters( p => p.Name("userId").Value(entity.Id.Value) )); }
/// <summary> /// Retrieves the latest / top 'n' tweets from the authenticated user's timeline. /// </summary> /// <param name="maximumNumberOfTweets">The number of tweets to retrieve</param> /// <returns></returns> public IList <ITweet> GetLastestNTweetsFromTimeLine(int maximumNumberOfTweets) { System.Console.WriteLine($"[GetLastestNTweetsFromTimeLine]: Attempting retrieval of '{maximumNumberOfTweets}' tweets from the timeline."); IAuthenticatedUser user = User.GetAuthenticatedUser(); List <ITweet> timelineTweets = new List <ITweet>(user.GetUserTimeline(maximumNumberOfTweets: maximumNumberOfTweets)); System.Console.WriteLine($"[GetLastestNTweetsFromTimeLine]: Retrieved '{timelineTweets.Count}' tweets from the timeline."); return(timelineTweets); }
protected override Command CreateDeleteLinksCommand(Country entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(CountryWithCapitalCityConnectionClass.GetConnectionName()) .StoredProcedure("[CountryBoundedContext].[pCountry_UnlinkCapitalCity]") .Parameters( p => p.Name("countryCode").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Organization entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(SchoolRoleOrganizationAddressConnectionClass.GetConnectionName()) .StoredProcedure("[SchoolBoundedContext].[pOrganization_Delete]") .Parameters( p => p.Name("organizationId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Address entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(OrganizationPersonWithCommonEntitiesConnectionClass.GetConnectionName()) .StoredProcedure("[OrganizationPersonBoundedContext].[pAddress_Delete]") .Parameters( p => p.Name("addressId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Person entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(PersonWithSpouseConnectionClass.GetConnectionName()) .StoredProcedure("[PersonBoundedContext].[pPerson_Delete]") .Parameters( p => p.Name("personId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Page entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(BookWithPagesConnectionClass.GetConnectionName()) .StoredProcedure("[BookBoundedContext].[pPage_Delete]") .Parameters( p => p.Name("pageId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(TestEntity entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(EntityWithMultiValuedValueObjectConnectionClass.GetConnectionName()) .StoredProcedure("[pTestEntity_Delete]") .Parameters( p => p.Name("testEntityId").Value(entity.Id) )); }
protected override Command CreateDeleteCommand(Student entity, IAuthenticatedUser user, string selector) { return(Command .NonQuery() .Connection(ClassesWithStudentsConnectionClass.GetConnectionName()) .StoredProcedure("[ClassBoundedContext].[pStudent_Delete]") .Parameters( p => p.Name("studentId").Value(entity.Id) )); }
public bool authenticateUser(string userAccessToken, string userAccessTokenSecret) { if (this.userCredentials == null) { var userCredentials = new TwitterCredentials(this.ConsumerKey, this.ConsumerSecret, userAccessToken, userAccessTokenSecret); this.User = Tweetinvi.User.GetAuthenticatedUser(userCredentials); if(this.user != null) { storeUserCredentials(userCredentials.AccessToken, userCredentials.AccessTokenSecret); this.twitterUser = new TwitterUser(this.user); return true; } } else throw new Exception("User credensials cannot be null"); return false; }
//Sign in to Twitter. private static bool PrepareTwitterClient() { if (s_config.TwitterConsumerToken.IsNullOrEmpty() || s_config.TwitterConsumerSecret.IsNullOrEmpty() || s_config.TwitterAccessToken.IsNullOrEmpty() || s_config.TwitterConsumerSecret.IsNullOrEmpty()) { Log("[-]Must supply Twitter OAuth strings."); return false; } Log("[!]Signing in to Twitter."); var userCredentials = Auth.CreateCredentials(s_config.TwitterConsumerToken, s_config.TwitterConsumerSecret, s_config.TwitterAccessToken, s_config.TwitterAccessSecret); ExceptionHandler.SwallowWebExceptions = false; try { s_twitterClient = User.GetAuthenticatedUser(userCredentials); } catch { Log("[-]Unable to authenticate Twitter account. Check your internet connection, verify your OAuth credential strings. If your bot is new, Twitter may still be validating your application."); return false; } return true; }
public TwitterUser(IAuthenticatedUser authenticatedUser) { this.twitter = new MainTwitter(); this.authenticatedUser = authenticatedUser; }
/// <summary> /// Subscribe the authenticated user to a specific list /// </summary> public static bool SubscribeAuthenticatedUserToList(string slug, string ownerScreenName, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(slug, ownerScreenName); } return TwitterListController.SubscribeAuthenticatedUserToList(slug, ownerScreenName); }
/// <summary> /// Subscribe the authenticated user to a specific list /// </summary> public static bool SubscribeAuthenticatedUserToList(string slug, IUserIdentifier owner, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(slug, owner); } return TwitterListController.SubscribeAuthenticatedUserToList(slug, owner); }
//Will run in GUI, waits for input. public void authenticateUser(string pin) { // With this pin code it is now possible to get the credentials back from Twitter this.userCredentials = AuthFlow.CreateCredentialsFromVerifierCode(pin, authenticationContext); // Use the user credentials in your application Auth.SetCredentials(this.userCredentials); // Get the AuthenticatedUser from the current thread credentials this.User = Tweetinvi.User.GetAuthenticatedUser(); // Stores the usercredentials for later use this.storeUserCredentials(this.userCredentials.AccessToken, this.userCredentials.AccessTokenSecret); this.twitterUser = new TwitterUser(this.user); }
// Unsubscribe public static async Task<bool> UnSubscribeAuthenticatedUserFromList(ITwitterListIdentifier listIdentifier, IAuthenticatedUser authenticatedUser = null) { return await Sync.ExecuteTaskAsync(() => TwitterList.UnSubscribeAuthenticatedUserFromList(listIdentifier, authenticatedUser)); }
// Remove Subscription /// <summary> /// Unubscribe the authenticated user to a specific list /// </summary> public static bool UnSubscribeAuthenticatedUserToList(long listId, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(listId); } return TwitterListController.UnSubscribeAuthenticatedUserFromList(listId); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsController" /> class. /// </summary> /// <param name="session">The session.</param> /// <param name="hydration">The hydration.</param> /// <param name="authenticatedUser">The authenticated user.</param> public SettingsController(ISession session, ITimezoneHydration hydration, IAuthenticatedUser authenticatedUser) { _session = session; _hydration = hydration; _authenticatedUser = authenticatedUser; }
/// <summary> /// Unubscribe the authenticated user to a specific list /// </summary> public static bool UnSubscribeAuthenticatedUserFromList(string slug, long ownerId, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(slug, ownerId); } return TwitterListController.UnSubscribeAuthenticatedUserFromList(slug, ownerId); }
public bool SubscribeAuthenticatedUserToList(IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.SubsribeToList(this); } return _twitterListController.SubscribeAuthenticatedUserToList(this); }
private void InitData() { _authenticatedUserCredentials = A.Fake<ITwitterCredentials>(); _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_authenticatedUserCredentials); _authenticatedUser = CreateAuthenticatedUser(); _currentCredentials = A.Fake<ITwitterCredentials>(); _fakeCredentialsAccessor.CallsTo(x => x.CurrentThreadCredentials).Returns(_currentCredentials); }
public async Task<bool> UnSubscribeAuthenticatedUserFromListAsync(IAuthenticatedUser authenticatedUser = null) { return await _taskFactory.ExecuteTaskAsync(() => UnSubscribeAuthenticatedUserFromList(authenticatedUser)); }
/// <summary> /// Unubscribe the authenticated user to a specific list /// </summary> public static bool UnSubscribeAuthenticatedUserFromList(ITwitterListIdentifier listIdentifier, IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(listIdentifier); } return TwitterListController.UnSubscribeAuthenticatedUserFromList(listIdentifier); }
/// <summary> /// Initializes a new instance of the <see cref="IndexController" /> class. /// </summary> /// <param name="session">The session.</param> public LoginController(ISession session, IAuthenticatedUser authenticatedUser) { _session = session; _authenticatedUser = authenticatedUser; }
public bool UnSubscribeAuthenticatedUserFromList(IAuthenticatedUser authenticatedUser = null) { if (authenticatedUser != null) { return authenticatedUser.UnSubscribeFromList(this); } return _twitterListController.UnSubscribeAuthenticatedUserFromList(this); }
//Sign in to Twitter. private static bool PrepareTwitterClient() { if (s_config.TwitterConsumerToken.IsNullOrEmpty() || s_config.TwitterConsumerSecret.IsNullOrEmpty() || s_config.TwitterAccessToken.IsNullOrEmpty() || s_config.TwitterConsumerSecret.IsNullOrEmpty()) { Log("[-]Must supply Twitter OAuth strings."); return false; } Log("[!]Signing in to Twitter."); var userCredentials = Auth.CreateCredentials(s_config.TwitterConsumerToken, s_config.TwitterConsumerSecret, s_config.TwitterAccessToken, s_config.TwitterAccessSecret); ExceptionHandler.SwallowWebExceptions = false; try { s_twitterClient = User.GetAuthenticatedUser(userCredentials); } catch { Log("[-]Unable to authenticate Twitter account."); return false; } return true; }
public AuthenticatedUserUpdatedEventArgs(IAuthenticatedUser authenticatedUser) { AuthenticatedUser = authenticatedUser; }
public async Task StartStreamAsync() { _authenticatedUser = await _taskFactory.ExecuteTaskAsync(() => _userFactory.GetAuthenticatedUser(Credentials)); if (_authenticatedUser == null) { StopStream(new UserStreamFailedToInitialize("Could not receive information related with currently authenticated user.")); return; } Func<ITwitterQuery> generateTwitterQuery = delegate { var queryBuilder = new StringBuilder(Resources.Stream_UserStream); AddBaseParametersToQuery(queryBuilder); return _twitterQueryFactory.Create(queryBuilder.ToString(), HttpMethod.GET, Credentials); }; Action<string> eventReceived = json => { RaiseJsonObjectReceived(json); // We analyze the different types of message from the stream if (TryGetEvent(json)) return; if (TryGetTweet(json)) return; if (TryGetMessage(json)) return; if (TryGetWarning(json)) return; if (TryGetFriends(json)) return; TryInvokeGlobalStreamMessages(json); }; await _streamResultGenerator.StartStreamAsync(eventReceived, generateTwitterQuery); }