/// <summary> /// Set up the view. /// </summary> void SetupView() { // If the folder is bogus... if (!Directory.Exists(_root)) { Label label = new Label(); label.Text = string.Format( CultureInfo.InvariantCulture, Resource.FolderNotFound, _root); phDisplay.Controls.Add(label); return; } Folder folder = AccessManager.GetFolderKey(_root); ProfileCommon profile = HttpContext.Current.Profile as ProfileCommon; if (folder != null) { if (!SecurityHelper.CanUserView(HttpContext.Current.User.Identity.Name, folder.Id)) { Label label = new Label(); label.Text = string.Format( CultureInfo.InvariantCulture, "Access Denied", _root); phDisplay.Controls.Add(label); btnNewFile.Visible = btnNewFolder.Visible = btnUpload.Visible = false; return; } } // Get a new table of files and folders. Table table = new TableEx(this, _root).Create(); // Display the table. if (table != null) { phDisplay.Controls.Add(table); } else { // Table wasn't created. Label label = new Label(); label.Text = Resource.CantCreateTable; phDisplay.Controls.Add(label); } // Finally, if a file link was clicked, open it. OpenFile(); }
public async Task <IActionResult> DeleteConfirmed(string id, int id2) { int arcId = (int)HttpContext.Session.GetInt32("ArchiveID"); NoteAccess noteAccess = await AccessManager.GetOneAccess(_db, id, id2, arcId); _db.NoteAccess.Remove(noteAccess); await _db.SaveChangesAsync(); return(RedirectToAction("Index", new { id = noteAccess.NoteFileId })); }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.EarnPaidToPromoteEnabled); if (!IsPostBack) { Button1.Text = L1.MANAGE; GetLinkButton.Text = U6009.GETYOURLINK; SetContent(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.PublishersRoleEnabled && AppSettings.TitanFeatures.PublishInTextAdsEnabled && Member.CurrentInCache.IsPublisher); ShowHideContent(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.PublishersRoleEnabled && AppSettings.TitanFeatures.PublishGlobalPostbackEnabled && Member.CurrentInCache.IsPublisher); AddLang(); UrlRegularExpressionValidator.ValidationExpression = RegexExpressions.AdWebsiteUrl; } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.ReferralsLeadershipEnabled); if (!IsPostBack) { user = Member.Current; AddTexts(); } }
public async Task TestAccessManagerLoginSuccess() { var accessManager = new AccessManager(_signingConfigurations, _tokenConfigurations, _loginValidator); _loginValidator.GetUserById(Arg.Any <string>()).Returns(new ApplicationUser()); _loginValidator.CheckPasswordUserAsync(Arg.Any <ApplicationUser>(), Arg.Any <string>()).Returns(true); _loginValidator.ValidateRoleAsync(Arg.Any <ApplicationUser>(), Arg.Any <string>()).Returns(true); var valid = await accessManager.ValidateCredentials(SetupTests.GetCliente()); Assert.True(valid); }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.ICOHistoryEnabled); TokenCryptocurrency = CryptocurrencyFactory.Get(CryptocurrencyType.ERC20Token); if (!IsPostBack) { MainDescriptionLiteral.Text = String.Format(U6012.PURCHASEHISTORY, TokenCryptocurrency.Code); PurchasesGridView.EmptyDataText = L1.NODATA; PurchasesGridView.DataBind(); } }
private void LoadNews() { //if (BusiBlocks.SecurityHelper.CanRead(Page.User, category, null) == false) // throw new BusiBlocks.InvalidPermissionException("read category"); var news = new List <Item>(); IList <Access> accessibleList = AccessManager.GetUsersAccessibleItems(Page.User.Identity.Name, BusiBlocks.ItemType.NewsItem, BusiBlocks.AccessType.View); foreach (Access access in accessibleList) { Category category = NewsManager.GetCategory(access.ItemId); news.AddRange(NewsManager.GetPublishedItems(category, false)); } List <KeyValuePair <Item, TrafficLightStatus> > newsWithTLList = new List <KeyValuePair <Item, TrafficLightStatus> >(); if (accessibleList != null) { foreach (Item newsItem in news) { if (!newsWithTLList.Exists(i => i.Key.Id == newsItem.Id)) { if (newsItem != null) { TrafficLightStatus tflStatus = NewsManager.GetTrafficLight(Page.User.Identity.Name, newsItem); if (tflStatus.RequiresAck) { if (tflStatus.Acknowledged) { continue; } } else { if (tflStatus.Viewed) { continue; } } if (newsWithTLList.Count < 5) { newsWithTLList.Add(new KeyValuePair <Item, TrafficLightStatus>(newsItem, tflStatus)); } } } } } lblNoResults.Visible = newsWithTLList.Count == 0; listRepeater.DataSource = newsWithTLList; listRepeater.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.TestimonialsEnabled || !Member.IsLogged); if (!Page.IsPostBack) { this.DataBind(); } LangAdder.Add(PasswordRequired, L1.TEXT + " " + U3900.FIELDISREQUIRED, true); LangAdder.Add(RequiredFieldValidator1, U5008.SIGNATURE + " " + U3900.FIELDISREQUIRED, true); }
public async Task <DiscountListResponse> Get(DiscountListRequest request) { var discounts = AccessManager.Filter(_discountDataService.Query).FilterByQuery(request.Query); return(new DiscountListResponse { Access = ResponseAccess.Granted, Items = (await discounts.OrderByDescending(x => x.Id).Paginate(request.Query).ToListAsync()) .MapToViewModel(), Count = await discounts.LongCountAsync() }); }
public override bool CanExecuteSubCommand(string uniqueId, string command, List <string> parameters) { if (parameters.Count > 0 && parameters[0] == "list" && AccessManager.UserHasAccessToSubCommand(uniqueId, "command:commands_list")) { return(true); } if (command != CommandPrefix) { return(true); } return(false); }
public static async Task <bool> OpenOutput(string outputDeviceName) { var outputInfo = AvailableOutputDevices.SingleOrDefault(o => o.Name.ToLower() == outputDeviceName.ToLower()); if (outputInfo == default) { return(false); } ActiveOutputDevices[outputDeviceName] = new MidiOutputDevice(await AccessManager.OpenOutputAsync(outputInfo.Id)); Logger.WriteLine("Successfully opened output device {0}", outputDeviceName); return(true); }
public static async Task <bool> OpenInput(string inputDeviceName) { var inputInfo = AvailableInputDevices.SingleOrDefault(i => i.Name.ToLower() == inputDeviceName.ToLower()); if (inputInfo == default) { return(false); } ActiveInputDevices[inputDeviceName] = new MidiInputDevice(await AccessManager.OpenInputAsync(inputInfo.Id)); Logger.WriteLine("Successfully opened input device {0}", inputDeviceName); return(true); }
private void LoadMessages() { List <Access> accessibleList = AccessManager.GetUsersAccessibleItems(Page.User.Identity.Name, BusiBlocks.ItemType.ForumTopic, BusiBlocks.AccessType.View); //IList<PersonType> personTypes = PersonManager.GetPersonTypesByUser(Page.User.Identity.Name); var itemsToList = new List <BusiBlocks.CommsBlock.Forums.Topic>(); // todo MASSIVE problem here. When we create a forum topic, we store the permissions for it as the forum Category. // Then we retrieve all 'topics' by looking at the categories in the access table. // Then we are expected to display those 'topics', even though we have now lost that information (since we // stored them as categories. // We should have stored them as topicIds not categoryIds in the access table, then retrieved those topics // For the moment, filter the duplicate category items in the accessible list. var cleanAccessList = new List <Access>(); foreach (Access access in accessibleList) { if (!cleanAccessList.Exists(delegate(Access a) { return(a.ItemId == access.ItemId); })) { cleanAccessList.Add(access); } } foreach (Access access in cleanAccessList) { BusiBlocks.CommsBlock.Forums.Category category = BusiBlocks.CommsBlock.Forums.ForumsManager.GetCategory(access.ItemId); IList <BusiBlocks.CommsBlock.Forums.Topic> items = BusiBlocks.CommsBlock.Forums.ForumsManager.GetTopics(category, new BusiBlocks.PagingInfo(0, 1)); foreach (BusiBlocks.CommsBlock.Forums.Topic item in items) { if (!itemsToList.Exists(delegate(BusiBlocks.CommsBlock.Forums.Topic i) { return(i.Id == item.Id); })) { //if (item.RequiresAck) //{ // if (item.Acknowledged) // continue; //} //else //{ // if (item.Viewed) // continue; //} itemsToList.Add(item); } } } lblNoResults.Visible = itemsToList.Count == 0; listRepeater.DataSource = itemsToList; listRepeater.DataBind(); }
public override void HandleCommand(NotifyTextMessageEvent evt, string command, List <string> parameters, Action <string> messageCallback) { string action = parameters[0]; string targetUser = parameters[1]; Client target = Parent.Client.GetClientByNamePart(targetUser); Group group = null; if (action == "add" || action == "remove") { group = AccessManager.GetGroupByName(parameters[2]); if (group == null) { messageCallback.Invoke(ColorCoder.ErrorBright($"The group named '{ColorCoder.Bold(parameters[2])}' was not found")); return; } } if (action == "add") { bool success = AccessManager.AddUserGroup(target.UniqueId, group); if (success) { messageCallback.Invoke(ColorCoder.Success($"{ColorCoder.Username(target.Nickname)} was added to the group '{ColorCoder.Bold(group.DisplayName)}'")); } else { messageCallback.Invoke(ColorCoder.ErrorBright($"{ColorCoder.Username(target.Nickname)} is already in the group '{ColorCoder.Bold(group.DisplayName)}'")); } } else if (action == "remove") { bool success = AccessManager.RemoveUserGroup(target.UniqueId, group); if (success) { messageCallback.Invoke(ColorCoder.Success($"{ColorCoder.Username(target.Nickname)} was removed from the group '{ColorCoder.Bold(group.DisplayName)}'")); } else { messageCallback.Invoke(ColorCoder.ErrorBright($"{ColorCoder.Username(target.Nickname)} was not in the group '{ColorCoder.Bold(group.DisplayName)}'")); } } else if (action == "list") { List <Group> groups = AccessManager.GetUserGroups(target.UniqueId); string toPrint = $"{ColorCoder.Username(target.Nickname)} has the following groups:"; foreach (Group printGroup in groups) { toPrint += $"\n\t- {printGroup.DisplayName}"; } messageCallback.Invoke(toPrint); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ActivePacksTab.Text = "List"; User = Member.CurrentInCache; AccessManager.RedirectIfDisabled(TitanFeatures.IsEpadilla); Form.Action = Request.RawUrl; bool hasAvailableAdverts = AdPackManager.HasAvailableAdverts(User.Id); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.StatisticsPointsEarnedEnabled); user = Member.CurrentInCache; if (!IsPostBack) { Button1.Text = U5001.TOTAL; Button2.Text = L1.REFERRALS; TotalLiteral.Text = user.TotalPointsEarned.ToString(); TotalRefLiteral.Text = user.TotalDirectReferralsPointsEarned.ToString(); UserStats.StatTitle = DRStats.StatTitle = U5001.TOTALPOINTSCREDITEDTOYOU.Replace("%n%", AppSettings.PointsName); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.InternalExchangeTradingHistoryEnabled); if (!IsPostBack) { SignOfStock = InternalExchangeManager.GetBalanceSign(true); SignOfPurchaseBalance = InternalExchangeManager.GetBalanceSign(false); LangAdders(); DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.AdvertisersRoleEnabled && AppSettings.TitanFeatures.AdvertPtcOfferWallEnabled && Member.CurrentInCache.IsAdvertiser); if (!IsPostBack) { AddLang(); BindDataCountriesToDDL(); GeolocationCheckBox.Attributes.Add("onclick", "ManageGeoEvent();"); } ErrorMessagePanel.Visible = false; }
public void GenerateToken() { _tokenConfigurations.Audience = "ExemploAudience"; _tokenConfigurations.Issuer = "ExemploIssuer"; _tokenConfigurations.Seconds = 90; var accessManager = new AccessManager(_signingConfigurations, _tokenConfigurations, _loginValidator); var token = accessManager.GenerateToken(SetupTests.GetLogin()); Assert.True(token.Authenticated); Assert.IsType <string>(token.AccessToken); Assert.IsType <Token>(token); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.AdvertisersRoleEnabled && AppSettings.TitanFeatures.AdvertInTextAdsEnabled && Member.CurrentInCache.IsAdvertiser); AddLang(); } ErrorMessagePanel.Visible = false; TagsTextBox.Attributes.Add("data-max", maxNumberOfTags.ToString()); TagsTextBox.Attributes.Add("data-message", string.Format(U6002.TOOMANYTAGS, maxNumberOfTags)); }
private IQueryable <DomainClasses.Entities.Page> GetFilteredQueryByReqParamsAndUserAccess(PageListRequest request) { var pageQuery = AccessManager.Filter(_dataSrv.Query.Where(x => x.LanguageName == request.Query.LanguageName)); var searchText = request.Query?.SearchText; if (!string.IsNullOrEmpty(searchText)) { pageQuery = pageQuery.Where(x => x.Title.Contains(searchText)); } pageQuery = pageQuery.OrderByDescending(x => x.Id); return(pageQuery); }
public async Task <IActionResult> Access(int?id) { if (id == null) { return(NotFound()); } List <NoteAccess> access = await _context.NoteAccess.Where(m => m.NoteFileId == id).ToListAsync(); await AccessManager.Audit(_context, "Access", User.Identity.Name, User.Identity.Name, "View NoteAccess of NotesFileID " + id); return(View(access)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.PublishersRoleEnabled && AppSettings.TitanFeatures.PublishWebsitesEnabled && Member.CurrentInCache.IsPublisher); ErrorMessagePanel.Visible = SuccessMessagePanel.Visible = false; AddLang(); } UrlRegularExpressionValidator.ValidationExpression = RegexExpressions.AdWebsiteUrl; Form.Action = Request.RawUrl; }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.EarnCaptchaClaim); CheckCaptcha(); if (!IsPostBack) { SetupMessagges(); LangAdder.Add(MainTab, "Coinhive " + U4200.CLAIM.ToLower()); } }
protected void Page_Load(object sender, EventArgs e) { AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.InternalExchangeCurrentOrdersEnabled); if (!IsPostBack) { HideMessagges(); LangAdders(); ViewState[tradeDetailIndexString] = -1; ViewState[tradeDetailGridString] = string.Empty; } }
public async Task <bool> CheckIfTokenIsActivatedAsync() { if (MODEL.IsTokenActivated) { return(true); } MODEL.IsCheckingTokenActivation = true; MODEL.IsTokenActivated = await AccessManager.IsTokenActivated(MODEL.Token); MODEL.IsCheckingTokenActivation = false; return(MODEL.IsTokenActivated); }
public FacebookSignInService( UserManager <ApplicationUser> userManager, AccessManager accessManager, FacebookConfigurations facebookConfigurations, IdentityDbContext identityDbContext, ApplicationDbContext applicationDbContext) { _accessToken = facebookConfigurations.AcessToken; _appId = facebookConfigurations.AppId; _userManager = userManager; _accessManager = accessManager; _identityDbContext = identityDbContext; _applicationDbContext = applicationDbContext; }
protected void Page_Load(object sender, EventArgs e) { User = Member.Current; AccessManager.RedirectIfDisabled(AppSettings.TitanFeatures.AdvertisersRoleEnabled && AppSettings.TitanFeatures.AdvertLoginAdsEnabled && User.IsAdvertiser); RegularExpressionValidator2.ValidationExpression = RegexExpressions.AdWebsiteUrl; SubLiteral.Text = L1.ADVADSINFO; LangAdder.Add(CreateAdButton, L1.SEND); //Lang & Hint LangAdder.Add(Button1, L1.MANAGE); LangAdder.Add(Button2, L1.NEWCAMPAIGN); LangAdder.Add(RegularExpressionValidator2, L1.ER_BADURL, true); LangAdder.Add(UrlRequired, L1.ER_BADURL, true); HintAdder.Add(URL, L1.H_URL); HintAdder.Add(lblGeolocation, L1.GEOHINT); //JS changes URL.Attributes.Add("onfocus", "if (getElementById('" + URL.ClientID + "').value == 'http://') getElementById('" + URL.ClientID + "').value = ''"); chbGeolocation.Attributes.Add("onclick", "ManageGeoEvent();"); if (!Page.IsPostBack) { BindDataCountriesToDDL(); if (AppSettings.LoginAds.IsGeolocationEnabled) { GeolocationPlaceholder.Visible = true; } var loginAdsCreditsEnabled = AppSettings.LoginAds.LoginAdsCreditsEnabled; LoginAdsCreditsPlaceHolder.Visible = loginAdsCreditsEnabled; string extraViews = string.Format(@"({0} {1})", User.LoginAdsCredits, U4200.AVAILABLE); AvailableLoginAdsCreditsLiteral.Text = extraViews; if (loginAdsCreditsEnabled) { PriceLiteral.Text = string.Format("{0} / {1} {2}", AppSettings.LoginAds.Price.ToString(), LoginAdCreditsPrice, U5008.LOGINADSCREDITS); } else { PriceLiteral.Text = AppSettings.LoginAds.Price.ToString(); } } LoginAdsCreditsCheckBox_CheckedChanged(null, null); }