/// <summary> /// Returns a perfectly boring NetAsyncDownloader. /// </summary> public NetAsyncDownloader(IUser user) { User = user; downloads = new List<NetAsyncDownloaderDownloadPart>(); modules = new List<CkanModule>(); complete_or_canceled = new ManualResetEvent(false); }
public void SetUp() { _mock = new Mockery(); _site = _mock.NewMock<ISite>(); Stub.On(_site).GetProperty("DefaultSkin").Will(Return.Value(SITE_DEFAULT_SKIN)); Stub.On(_site).Method("DoesSkinExist").With(SITE_DEFAULT_SKIN).Will(Return.Value(true)); Stub.On(_site).Method("DoesSkinExist").With(INVALID_SKIN).Will(Return.Value(false)); Stub.On(_site).Method("DoesSkinExist").With(USER_PREFERRED_SKIN).Will(Return.Value(true)); Stub.On(_site).Method("DoesSkinExist").With(Is.Null).Will(Return.Value(false)); Stub.On(_site).Method("DoesSkinExist").With(REQUESTED_SKIN).Will(Return.Value(true)); Stub.On(_site).Method("DoesSkinExist").With(FILTER_DERIVED_SKIN).Will(Return.Value(true)); Stub.On(_site).Method("DoesSkinExist").With("xml").Will(Return.Value(true)); Stub.On(_site).GetProperty("SkinSet").Will(Return.Value("vanilla")); _user = _mock.NewMock<IUser>(); _inputContext = _mock.NewMock<IInputContext>(); Stub.On(_inputContext).GetProperty("CurrentSite").Will(Return.Value(_site)); _outputContext = _mock.NewMock<IOutputContext>(); Stub.On(_outputContext).Method("VerifySkinFileExists").Will(Return.Value(true)); _skinSelector = new SkinSelector(); _request = _mock.NewMock<IRequest>(); }
public async Task<bool> CreateAndSignInExternalUser( HttpContextBase context, string logOnProvider, IUser user, string role, bool persist) { if (user == null) { throw new ArgumentNullException("user"); } var identity = await GetExternalIdentity(context); if (!VerifyExternalIdentity(identity, logOnProvider)) { return false; } var providerKey = identity.FindFirstValue( "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"); if (!(await storeManager.CreateExternalUser( user, logOnProvider, providerKey, role))) { return false; } await SignIn(context, user.Id, identity.Claims, persist); return true; }
/// /// </summary> /// <param name="article"></param> public static void AddUser(IUser user,DateTime subscriptionStartDate, DateTime subscriptionEndDate) { // Create the Database object, using the default database service. The // default database service is determined through configuration. Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "InsertUser"; DbCommand commentaryCommand = db.GetStoredProcCommand(sqlCommand); // GlobalFunctions.GetCurrentTimeInEST() db.AddInParameter(commentaryCommand, "UserId", DbType.String, user.UserId); db.AddInParameter(commentaryCommand, "Password", DbType.String, user.Password); db.AddInParameter(commentaryCommand, "FirstName", DbType.String, user.FirstName); db.AddInParameter(commentaryCommand, "LastName", DbType.String, user.LastName); db.AddInParameter(commentaryCommand, "PhoneNumber", DbType.String, user.PhoneNumber); db.AddInParameter(commentaryCommand, "RegistrationDate", DbType.DateTime, user.RegistrationDate); db.AddInParameter(commentaryCommand, "IsPaidSubscriber", DbType.Boolean, user.IsPaidSubscriber); db.AddInParameter(commentaryCommand, "IsAutoRenewal", DbType.Boolean, user.IsAutoRenewal); db.AddInParameter(commentaryCommand, "State", DbType.String, user.State); db.AddInParameter(commentaryCommand, "Address", DbType.String, user.Address); db.AddInParameter(commentaryCommand, "Country", DbType.String, user.Country); db.AddInParameter(commentaryCommand, "ZipCode", DbType.Int32, user.ZipCode); db.AddInParameter(commentaryCommand, "SubscriptionStartDate", DbType.DateTime, subscriptionStartDate); db.AddInParameter(commentaryCommand, "SubscriptionEndDate", DbType.DateTime, subscriptionEndDate); using (DbConnection connection = db.CreateConnection()) { connection.Open(); db.ExecuteNonQuery(commentaryCommand); connection.Close(); } }
/// <summary> /// Logs the specified <see cref="System.Exception"/> and the user information. /// </summary> /// <param name="exception">The <see cref="System.Exception"/> to log.</param> /// <param name="user">The user information to log.</param> public void Log(Exception exception, IUser user) { if (!(exception is ThreadAbortException)) { Log(LogLevel.Error, exception.ToString(), user); } }
public override bool HasTriggered(IUser user, IDocumentSession session) { var number = session.Query<Praise>() .Count(praise => praise.EventDate >= DateTime.Today.AddDays(0 - Config.PeriodDays) && praise.SubjectUser.UserId == user.Id); return Config.NumberInPeriod <= number; }
private static void UpdateChannelStateUser(IUser user, ChannelState chState, int channelId) { ChannelState currentChState; bool stateExists = user.ChannelStates.TryGetValue(channelId, out currentChState); if (stateExists) { if (chState == ChannelState.nottunable) { return; } bool recording = (currentChState == ChannelState.recording); if (!recording) { user.ChannelStates[channelId] = chState; //add key if does not exist, or update existing one. } } else { user.ChannelStates[channelId] = chState; //add key if does not exist, or update existing one. } }
public static void AssertThatUserIsCarlPhilipBernadotte( IUser user ) { Assert.That( user.FirstName, Is.EqualTo( "Carl-Philip" ) ); Assert.That( user.LastName, Is.EqualTo( "Bernadotte" ) ); Assert.That( user.EmailAddress, Is.EqualTo( "*****@*****.**" ) ); Assert.That( user.BirthDate.HasValue, Is.EqualTo( false ) ); }
public void UpdateNotificationsForUser(IUser user, int maxNotificationBatchCountToCheck) { var notificationsUserPart = GetNotificationsUserPartOrThrow(user); var uncheckedNotificationsQuery = _contentManager .Query(VersionOptions.Published, Constants.NotificationBatchContentType) .Where<CommonPartRecord>(record => record.Id > notificationsUserPart.LastProcessedNotificationId); var uncheckedNotificationCount = uncheckedNotificationsQuery.Count(); var notifications = _notificationService.FetchNotifications(user, Math.Min(uncheckedNotificationCount, maxNotificationBatchCountToCheck)); var existingUserNotificationEntriesLookup = notificationsUserPart.RecentNotificationEntries.ToDictionary(entry => entry.NotificationId); var existingUserNotificationEntries = new Stack<NotificationUserEntry>(notificationsUserPart.RecentNotificationEntries.Reverse()); foreach (var notification in notifications) { var notificationId = notification.ContentItem.Id; if (!existingUserNotificationEntriesLookup.ContainsKey(notificationId)) { existingUserNotificationEntries.Push(new NotificationUserEntry { NotificationId = notificationId }); } } notificationsUserPart.RecentNotificationEntries = existingUserNotificationEntries.Take(maxNotificationBatchCountToCheck); var topNotification = uncheckedNotificationsQuery .OrderByDescending<CommonPartRecord>(record => record.Id) .Slice(1) .SingleOrDefault(); if (topNotification != null) { notificationsUserPart.LastProcessedNotificationId = topNotification.Id; } }
public static void AssertThatUserIsNilsPetterSundgren( IUser user ) { Assert.That( user.FirstName, Is.EqualTo( "Nils-Petter" ) ); Assert.That( user.LastName, Is.EqualTo( "Sundgren" ) ); Assert.That( user.EmailAddress, Is.EqualTo( "*****@*****.**" ) ); Assert.That( user.BirthDate.HasValue, Is.EqualTo( false ) ); }
public static void AssertThatUserIsRolfGöranBengtsson( IUser user ) { Assert.That( user.FirstName, Is.EqualTo( "Rolf-Göran" ) ); Assert.That( user.LastName, Is.EqualTo( "Bengtsson" ) ); Assert.That( user.EmailAddress, Is.EqualTo( "*****@*****.**" ) ); Assert.That( user.BirthDate, Is.EqualTo( new DateTime( 1948, 5, 1 ) ) ); }
public static void AssertThatUserIsCarlJahnGranqvist( IUser user ) { Assert.That( user.FirstName, Is.EqualTo( "Carl Jan" ) ); Assert.That( user.LastName, Is.EqualTo( "Granqvist" ) ); Assert.That( user.EmailAddress, Is.EqualTo( "*****@*****.**" ) ); Assert.That( user.BirthDate.HasValue, Is.EqualTo( false ) ); }
/// <summary> /// Gets all groups for a given user /// </summary> /// <param name="azureClient">An authenticated ActiveDirectoryClient</param> /// <param name="user">A resolved User object</param> private static void GetAllGroupsForUser(ActiveDirectoryClient azureClient, IUser user) { Console.WriteLine(""); Console.WriteLine("Listing groups for " + user.DisplayName); IUserFetcher retrievedUserFetcher = (User)user; //access through the MemberOf collection IPagedCollection<IDirectoryObject> pagedCollection = retrievedUserFetcher.MemberOf.ExecuteAsync().Result; do { List<IDirectoryObject> directoryObjects = pagedCollection.CurrentPage.ToList(); foreach (IDirectoryObject directoryObject in directoryObjects) { if (directoryObject is Group) { Group group = directoryObject as Group; Console.WriteLine(" Group: {0}", group.DisplayName); //add to parent collection if you need to extract them } //removed to simplify //if (directoryObject is DirectoryRole) //{ // DirectoryRole role = directoryObject as DirectoryRole; // Console.WriteLine(" Role: {0} Description: {1}", role.DisplayName, role.Description); //} } pagedCollection = pagedCollection.GetNextPageAsync().Result; } while (pagedCollection != null && pagedCollection.MorePagesAvailable); }
public Edit_Incident_Handler(IUser user) { APF = Australian_Parachute_Federation.Instance; //user = APF.Searcher.Find_User("13E98653-675F-44E6-A0A2-E2E40261F8FE"); //role = APF.Searcher.Find_Role("70CAAFBC-B595-4D98-85CF-FCDC913FDB9D"); _userInRole = (IUserInRole)APF.Searcher.Find_User_In_Role(user.User_ID); }
public ContextWrapper(HttpContext context) { _context = context; _request = new RequestWrapper(context.Request); _response = new ResponseWrapper(context.Response); _user = new User(context.User); }
public SerfidCore(IListener listener, IFilter filter, IStorage storage, IUser user) { _listener = listener; _filter = filter; _storage = storage; _user = user; }
/// <summary> /// Get the user's photo. /// </summary> /// <param name="user">The target user.</param> /// <returns></returns> public async Task<BitmapImage> GetUserThumbnailPhotoAsync(IUser user) { BitmapImage bitmap = null; try { // The using statement ensures that Dispose is called even if an // exception occurs while you are calling methods on the object. using (var dssr = await user.ThumbnailPhoto.DownloadAsync()) using (var stream = dssr.Stream) using (var memStream = new MemoryStream()) { await stream.CopyToAsync(memStream); memStream.Seek(0, SeekOrigin.Begin); bitmap = new BitmapImage(); await bitmap.SetSourceAsync(memStream.AsRandomAccessStream()); } } catch(ODataException) { // Something went wrong retrieving the thumbnail photo, so set the bitmap to a default image bitmap = new BitmapImage(new Uri("ms-appx:///assets/UserDefaultSignedIn.png", UriKind.RelativeOrAbsolute)); } return bitmap; }
/// <summary> /// 更改用户积分 /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> void ChangePointsEventModule_After(IUser sender, ChangePointsEventArgs eventArgs) { if (eventArgs.ExperiencePoints <= 0 && eventArgs.ReputationPoints <= 0) return; IUserService userService = DIContainer.Resolve<IUserService>(); //自动升级 UserRankService userRankService = new UserRankService(); SortedList<int, UserRank> userRanks = userRankService.GetAll(); UserRank maxUserRank = null; if (userRanks != null && userRanks.Count > 0) maxUserRank = userRanks.ElementAt(0).Value; PointSettings pointSettings = DIContainer.Resolve<ISettingsManager<PointSettings>>().Get(); int totalPoints = pointSettings.CalculateIntegratedPoint(sender.ExperiencePoints, sender.ReputationPoints); foreach (KeyValuePair<int, UserRank> userRank in userRanks) if (totalPoints > userRank.Value.PointLower && userRank.Value.PointLower > maxUserRank.PointLower) maxUserRank = userRank.Value; if (maxUserRank.Rank > sender.Rank) userService.UpdateRank(sender.UserId, maxUserRank.Rank); //自动解除管制 var user = userService.GetFullUser(sender.UserId); if (user.IsModerated && !user.IsForceModerated) { UserSettings userSettings = DIContainer.Resolve<ISettingsManager<UserSettings>>().Get(); if (totalPoints > userSettings.NoModeratedUserPoint) { userService.NoModeratedUser(user.UserId); } } }
public ISession CreateSession(IUser user) { return new RavenDbSession { User = user }; }
public AccountController(IUser userRepository, ISettings settingsRepository, IRole roleRepository) : base(settingsRepository) { _userRepository = userRepository; _roleRepository = roleRepository; ExpectedMasterName = string.Empty; }
public MessageInfo(string text, IUser author, IEnumerable<ICategory> categories, DateTimeOffset created) { _authorId = author.Id; _categoryIds = categories.Select(f => f.Id).ToArray(); _text = text; _created = created; }
public Matcher(IUser firstUser, IUser secondUser) { _secondUser = secondUser; _firstUser = firstUser; PeformMatch(); }
public GetBossBattleFloorService(IUser user, ILogger logger, string floorId, string target) : base(user, logger) { this.floorId = floorId; this.target = target; this.apiActionPath = "tower/battle.php"; }
private void RegisterRemoting() { { try { BinaryServerFormatterSinkProvider server_provider = new BinaryServerFormatterSinkProvider(); server_provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider client_provider = new BinaryClientFormatterSinkProvider(); IDictionary properties = new Hashtable(); properties["port"] = "0"; TcpChannel channel = new TcpChannel(properties, client_provider, server_provider); ChannelServices.RegisterChannel(channel, false); user = (IUser)Activator.GetObject(typeof(IUser), "tcp://localhost:9998/UserHandeling"); portal = (IPortal)Activator.GetObject(typeof(IPortal), "tcp://localhost:9998/PortalHandeling"); ftserver = (IFTserver)Activator.GetObject(typeof(IFTserver), "tcp://localhost:9998/TransferHandeling"); } catch (RemotingException e) { MessageBox.Show("Connection Error"); } } }
public static UserEntity UserEntity(IUser user) { DeactivateValidations(); UserEntity entity = new UserEntity() { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, Password = user.Password, EmailAddress = user.EmailAddress, DateOfBirth = user.DateOfBirth }; //foreach (ITask createdTask in user.CreatedTasks) //{ // entity.CreatedTasks.Add(TaskEntity(createdTask)); //} //foreach (ITask assignedTask in user.AssignedTasks) //{ // entity.AssignedTasks.Add(TaskEntity(assignedTask)); //} ActivateValidations(); return entity; }
public void PrintCommonReceipt(bool isVoidedTransaction, string Type, string Treasury, IUser autherizedUser) { CommonUtilities CommonUtilitiesObject = new CommonUtilities(); CommonUtilitiesObject.currentUser = autherizedUser; try { switch (Type.ToUpper()) { case "PROG": Type = "Progressive"; break; case "REFILL": Type = "Refills"; break; case "REFUND": Type = "Refunds"; break; default: break; } BMC.Common.LogManagement.LogManager.WriteLog("Called PrintCommonReceipt type:treasury" + Type.ToString() + " : " + Treasury.ToString() , BMC.Common.LogManagement.LogManager.enumLogLevel.Debug); CommonUtilitiesObject.GetCommonValues(isVoidedTransaction, Type, Treasury); } catch (Exception Ex) { ExceptionManager.Publish(Ex); } }
public ConnectStorageStage(IUser user, string ipaddress, int port) { // TODO: Complete member initialization this._User = user; this._IpAddress = ipaddress; this._Port = port; }
private void CreateOrUpdateOpenAuthUser(IUser user) { var current = _httpContextAccessor.Current(); if (current == null) return; var request = current.Request; if (request == null) return; var userName = request.QueryString["UserName"]; var externalLoginData = request.QueryString["ExternalLoginData"]; if (string.IsNullOrWhiteSpace(userName) || string.IsNullOrWhiteSpace(externalLoginData)) return; string providerName; string providerUserId; if ( !_orchardOpenAuthWebSecurity.TryDeserializeProviderUserId(HttpUtility.UrlDecode(externalLoginData), out providerName, out providerUserId)) return; _orchardOpenAuthWebSecurity.CreateOrUpdateAccount(providerName, providerUserId, user); }
public IUser Save(IUser user) { using (MiniProfiler.Current.Step("UserRepository.Save")) { using (var dc = DataContextFactory.GetDataContext()) { User modelAsUser = null; if (String.IsNullOrEmpty(user.UniqueKey)) modelAsUser = new User(); else modelAsUser = dc.Repository<User>() .Where(u => u.PkID == user.UniqueKey) .FirstOrDefault(); if (modelAsUser == null) throw new ArgumentException("Attempted to Update nonexisting User"); modelAsUser.Username = user.Username; modelAsUser.LastName = user.LastName; modelAsUser.FirstName = user.FirstName; modelAsUser.Birthdate = user.Birthdate; if (String.IsNullOrEmpty(modelAsUser.UniqueKey)) dc.Insert(modelAsUser); dc.Commit(); return user; } } }
public void Compute(IUser user) { var infos = new DatabaseAccess.DatabaseManager() .GetDatabase() .GetCollection<SVNInfo>(typeof(SVNInfo).Name) .FindAll() .OrderBy(o => o.Date) .ToList(); var count = 0; DateTime initialTime = infos[0].Date.ToUniversalTime(); for (int i = 1; i < infos.Count; i++) { var ts = infos[i + 1].Date - initialTime; if (ts.Days >= 1 && ts.Days < 2) { count++; } else if (!(ts.Days < 1)) { count = 0; } else { continue; } initialTime = infos[i].Date; if (count >= 5) { Gained = true; break; } } }
public void SendMessage(IUser sender, IPlayer receiver, string message, Color?color = null, params object[] arguments) { throw new NotImplementedException(); }
private int MetaWeblogNewPost( string blogId, string userName, string password, XRpcStruct content, bool publish, IEnumerable <IXmlRpcDriver> drivers) { IUser user = ValidateUser(userName, password); // User needs permission to edit or publish its own blog posts _authorizationService.CheckAccess(publish ? Permissions.PublishBlogPost : Permissions.EditBlogPost, user, null); BlogPart blog = _contentManager.Get <BlogPart>(Convert.ToInt32(blogId)); if (blog == null) { throw new ArgumentException(); } var title = content.Optional <string>("title"); var description = content.Optional <string>("description"); var slug = content.Optional <string>("wp_slug"); var blogPost = _contentManager.New <BlogPostPart>("BlogPost"); // BodyPart if (blogPost.Is <BodyPart>()) { blogPost.As <BodyPart>().Text = description; } //CommonPart if (blogPost.Is <ICommonPart>()) { blogPost.As <ICommonPart>().Owner = user; blogPost.As <ICommonPart>().Container = blog; } //RoutePart if (blogPost.Is <RoutePart>()) { blogPost.As <RoutePart>().Title = title; blogPost.As <RoutePart>().Slug = slug; _routableService.FillSlugFromTitle(blogPost.As <RoutePart>()); blogPost.As <RoutePart>().Path = blogPost.As <RoutePart>().GetPathWithSlug(blogPost.As <RoutePart>().Slug); } _contentManager.Create(blogPost, VersionOptions.Draft); var publishedUtc = content.Optional <DateTime?>("dateCreated"); if (publish && (publishedUtc == null || publishedUtc <= DateTime.UtcNow)) { _blogPostService.Publish(blogPost); } foreach (var driver in drivers) { driver.Process(blogPost.Id); } return(blogPost.Id); }
public UserManController(IUser userMan) { _userMan = userMan; }
public IToken GetToken(IConsumer consumer, IUser user) { return(null); }
public bool IsStandardUser(IUser user) { return(System.Threading.Thread.CurrentPrincipal.IsInRole(UserGroup.User.ToString())); }
public void DeleteUser(IUser user) { _dal.DeleteUser(user); }
public void AddUser(IUser user) { _dal.AddUser(user); }
public Task EnsureDefaultWorkspaceIsOnPlan(IUser user, PricingPlans plan) => EnsureWorkspaceIsOnPlan(user, user.DefaultWorkspaceId.Value, plan);
public TesteController(INotificador notificador, IUser appUser, ILogger <TesteController> logger) : base(notificador, appUser) { _logger = logger; }
public UserController(IUser repo, IMapper mapper, MyContext context) { _context = context; _mapper = mapper; _repo = repo; }
/// <inheritdoc/> async Task <IBan> IGuild.GetBanAsync(IUser user, RequestOptions options) => await GetBanAsync(user, options).ConfigureAwait(false);
public TweetFavouritedEventArgs(ITweet tweet, IUser favoritingUser) : base(tweet) { FavouritingUser = favoritingUser; }
/// <inheritdoc /> public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null) => GuildHelper.AddBanAsync(this, Discord, user.Id, pruneDays, reason, options);
/// <inheritdoc /> public Task RemoveBanAsync(IUser user, RequestOptions options = null) => GuildHelper.RemoveBanAsync(this, Discord, user.Id, options);
public HomeController(IUser u, IProduct p) { user = u; prod = p; }
/// <summary> /// Gets a ban object for a banned user. /// </summary> /// <param name="user">The banned user.</param> /// <param name="options">The options to be used when sending the request.</param> /// <returns> /// A task that represents the asynchronous get operation. The task result contains a ban object, which /// contains the user information and the reason for the ban; <c>null</c> if the ban entry cannot be found. /// </returns> public Task <RestBan> GetBanAsync(IUser user, RequestOptions options = null) => GuildHelper.GetBanAsync(this, Discord, user.Id, options);
public async Task Huguser(IUser user) { await ReplyAsync($"Hey {user.Mention}, {Context.User.Mention} sent you a big warm hug :heart:"); }
public async Task Date(IUser user, [Remainder] string input) { await ReplyAsync( $"Hey Cutie {user.Mention}, {Context.User.Mention} really likes you and would \nlove to go on a date with you, do you accept? :heart:\n" + $"Heres a cute love message from them ```\n{input}\n```"); }
public void Broadcast(IUser sender, IEnumerable <IPlayer> receivers, string message, Color?color = null, params object[] arguments) { throw new NotImplementedException(); }
public IEncoder GetEncoder(IUser user) { return(implementations.SingleOrDefault(q => q.IsCompatible(user))); }
public void Add(IUser item) { _dataSource.AddUser(item); }
public void Broadcast(IUser sender, string message, Color?color = null, params object[] arguments) { throw new NotImplementedException(); }
public LoginController(IUser userService) { _userService = userService; }
public bool Ban(IUser user, IUser bannedBy = null, string reason = null, TimeSpan?timeSpan = null) => false;
protected override ITag MakeUniqueModel(ITogglApi api, IUser user) => new Tag { Name = Guid.NewGuid().ToString(), WorkspaceId = user.DefaultWorkspaceId.Value };
public bool Unban(IUser user, IUser unbannedBy = null) => false;
public async Task Delete(IUser user) { _logger.LogInformation($"start {nameof(Delete)}"); await _db.Diagnosis.DeleteItemAsync <DiagnosisModel>(user.GetId(), PartitionKey.None); }
public bool Kick(IPlayer user, IUser kickedBy = null, string reason = null) => false;
private string Logout() { this.loggedUser = null; return(UserLoggedOut); }
public Manager(IUser user) { _user = user; }