Exemplo n.º 1
0
 public SiteLibraryBrowser(IFolderManager <FileDocument> folderManager,
                           IContextAccessor <AdminContext> adminContextAccessor)
 {
     _folderManager = folderManager;
     _adminContext  = adminContextAccessor.GetContext();
     ownerId        = _adminContext?.SiteId;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UrlHelper"/> class using the specified action context and action selector.
 /// </summary>
 /// <param name="contextAccessor">The <see cref="IContextAccessor{TContext}"/> to access the action context
 /// of the current request.</param>
 /// <param name="actionSelector">The <see cref="IActionSelector"/> to be used for verifying the correctness of
 /// supplied parameters for a route.
 /// </param>
 public UrlHelper(IContextAccessor <ActionContext> contextAccessor, IActionSelector actionSelector)
 {
     _httpContext    = contextAccessor.Value.HttpContext;
     _router         = contextAccessor.Value.RouteData.Routers[0];
     _ambientValues  = contextAccessor.Value.RouteData.Values;
     _actionSelector = actionSelector;
 }
Exemplo n.º 3
0
        private ContextAccessor(IConfiguration config)
        {
            log = Log.Logger.ForContext <ContextAccessor>();

            string persistanceType = config.GetSection("PersistanceType").Value;

            log.Here().Information("PersistanceType is " + persistanceType);

            if (persistanceType == "File")
            {
                FilePathConfig filePaths   = config.GetSection("FileDataPath").Get <FilePathConfig>();
                string         contextPath = filePaths.ContextFilePath;

                this.accessor = new ContextFileAccessor(contextPath);

                this.accessor.CleanContext();
            }
            else
            {
                string connectionString = config.GetConnectionString("MongoDbConnection");
                string dbName           = config.GetConnectionString("ContextDatabaseName");

                this.accessor = new ContextDBAccessor(connectionString, dbName);

                this.accessor.CleanContext();
            }
        }
Exemplo n.º 4
0
 public LibraryDataController(
     IFolderManager <FileDocument> folderManager,
     IDocumentService <FileDocument> documentService,
     IOptions <DriveOptions> driveOptions,
     TagManager tagManager,
     DbLoggerProvider log,
     DbLogService logFetcher,
     ILogger <LibraryDataController> logger,
     ResourceManager resourceManager,
     FileFolderBrowser fileFolderBrowser,
     IAuthorizationService authorizationService,
     IContextAccessor <AdminContext> adminContextAccessor,
     IContextAccessor <SiteContext> siteContextAccessor) : base(logger)
 {
     _folderManager        = folderManager;
     _documentService      = documentService;
     _driveOptions         = driveOptions.Value;
     _tagManager           = tagManager;
     _log                  = log;
     _logFetcher           = logFetcher;
     _resourceManager      = resourceManager;
     _fileFolderBrowser    = fileFolderBrowser;
     _authorizationService = authorizationService;
     _adminContext         = adminContextAccessor.GetContext();
     _siteContext          = siteContextAccessor.GetContext();
 }
Exemplo n.º 5
0
 public UrlHelper(IContextAccessor<ActionContext> contextAccessor, IActionSelector actionSelector)
 {
     _httpContext = contextAccessor.Value.HttpContext;
     _router = contextAccessor.Value.RouteData.Routers[0];
     _ambientValues = contextAccessor.Value.RouteData.Values;
     _actionSelector = actionSelector;
 }
Exemplo n.º 6
0
 public LibraryOwnerHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppLibraryOwner,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 7
0
 public BlogQueryService(SiteContext siteContext, BlogSecurityService blogSecurity, ConnectDbContext connectDbContext, BlogDbContext blogDbContext, IContextAccessor <UserContext> userContextAccessor)
 {
     _siteContext         = siteContext;
     _connectDbContext    = connectDbContext;
     _blogDbContext       = blogDbContext;
     _blogSecurity        = blogSecurity;
     _userContextAccessor = userContextAccessor;
 }
Exemplo n.º 8
0
 public ProductsReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpProductsRead,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
Exemplo n.º 9
0
 public RolesEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppRolesEdit,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 10
0
        internal static Step InstanceFor(IContextAccessor test, Type stepClass, KeyValuePair <string, object>[] parameters, IExceptionHandler exceptionHandler)
        {
            var instance = (Step)Activator.CreateInstance(stepClass, parameters.Select(p => p.Value).ToArray());

            instance.SetScenario(test, exceptionHandler);

            return(instance);
        }
Exemplo n.º 11
0
 public LibraryEditFilesHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpLibraryEditFiles,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
Exemplo n.º 12
0
 public TestResponseGenerator(IContextAccessor<ActionContext> contextAccessor)
 {
     _actionContext = contextAccessor.Value;
     if (_actionContext == null)
     {
         throw new InvalidOperationException("ActionContext should not be null here.");
     }
 }
 public LibraryManageSecurityHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpLibraryManageSecurity,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
Exemplo n.º 14
0
 public ClientsEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpCustomersEdit,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
Exemplo n.º 15
0
 public AnnouncementQueryService(SiteContext siteContext, AnnouncementSecurityService announcementSecurity, ConnectDbContext connectDbContext, AnnouncementDbContext announcementDbContext, IContextAccessor <UserContext> userContextAccessor)
 {
     _siteContext           = siteContext;
     _connectDbContext      = connectDbContext;
     _announcementDbContext = announcementDbContext;
     _announcementSecurity  = announcementSecurity;
     _userContextAccessor   = userContextAccessor;
 }
Exemplo n.º 16
0
 public TestResponseGenerator(IContextAccessor <ActionContext> contextAccessor)
 {
     _actionContext = contextAccessor.Value;
     if (_actionContext == null)
     {
         throw new InvalidOperationException("ActionContext should not be null here.");
     }
 }
 public NotificationGroupsDeleteHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppNotifyGroupsDelete,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 18
0
 public UserProfileEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.UsersEdit,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 19
0
 public DirectoriesReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.UserDirectoryRead,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 20
0
 public SitesReadHandler(IContextAccessor<AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.SitesRead,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 21
0
 public GroupsCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppGroupsCreate,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 22
0
 public NettyServerBootstrap(IServerMessageHandler <TMessage> handler, IMessageCodecs <TMessage> msgCodecs, ILoggerFactory factory, IContextAccessor <TMessage> contextAccessor)
 {
     this._msgCodecs       = msgCodecs;
     this._handler         = handler;
     this._contextAccessor = contextAccessor;
     this.Logger           = factory.CreateLogger(this.GetType());
     this._factory         = factory;
 }
Exemplo n.º 23
0
 public AnnouncementSecurityService
 (
     IContextAccessor <SiteContext> siteContextAccessor,
     IContextAccessor <UserContext> userContextAccessor
 )
 {
     _siteContextAccessor = siteContextAccessor;
     _userContextAccessor = userContextAccessor;
 }
Exemplo n.º 24
0
 public EnquiriesBusinessService(IEnquiriesDataService enquiriesDataService, IContextAccessor contextAccessor, IServiceBusMessageSender serviceBusMessageSender, IMapper mapper)
 {
     _enquiriesDataService    = enquiriesDataService;
     _contextAccessor         = contextAccessor;
     _serviceBusMessageSender = serviceBusMessageSender;
     _mapper      = mapper;
     _browserName = _contextAccessor.BrowserName;
     _timestamp   = _contextAccessor.TimeStamp;
 }
Exemplo n.º 25
0
 public UserProfileReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteUsersRead,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 26
0
 public GroupsDeleteHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SitePrimaryAdmin,
         SiteClaimTypes.SiteGroupsDelete,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 27
0
        public UserContentMenu(IContextAccessor <SiteContext> siteContextAccessor, Routes routes,
                               IHttpContextAccessor httpContextAccessor)
        {
            var siteContext = siteContextAccessor.GetContext();

            if (siteContext != null)
            {
                _siteId   = siteContext.SiteId;
                _tenant   = siteContext.TenantKey;
                _clientId = siteContext.Client.Id;
                _corpId   = ConnectCoreConstants.CorporateId;

                var isSiteAlertsFeatureEnabled =
                    siteContext.ProductContext.Features.Get(FeatureId.Alerts)?.GetSettingValue <bool>("enabled") ?? false;
                var isNotificationFeatureEnabled =
                    siteContext.ProductContext.Features.Get(FeatureId.Notifications)?.GetSettingValue <bool>("enabled") ?? false;

                var httpContext = httpContextAccessor.HttpContext;
                var returnUrl   = httpContext.Request.GetRelativeUrlEncoded();

                MenuItems = new List <IMenuItem>()
                {
                    // NOTE: This menu provider is part of core, thus only "known" core types of content should be listed here
                    //       So far, we have none. "Create Blog Link" moved to Blog.UserContentMenu
                    new MenuItemSecureCustom()
                    {
                        Title             = "Add Notifications",
                        Url               = routes.Account("notifications") + "?ru=" + returnUrl,
                        Icon              = IconType.Message,
                        AuthorizeCallback = user =>
                        {
                            return(user.SecurityClaims.Any(x =>
                                                           (((x.Type == SiteClaimTypes.SiteNotificationsSend) && ((x.Value == _siteId) || (x.Value == _clientId) || (x.Value == _corpId)) ||
                                                             (x.Type == SiteClaimTypes.SitePrimaryAdmin) && ((x.Value == _siteId) || (x.Value == _clientId) || (x.Value == _corpId))) ||
                                                            (x.Type.StartsWith("corp-") && x.Value == ConnectCoreConstants.CorporateId)) &&
                                                           isNotificationFeatureEnabled));
                        }
                    },


                    new MenuItemSecureCustom()
                    {
                        Title             = "Create Alert",
                        Url               = "javascript: void $.console('alerts', '/sys/console/sitealerts/create')",
                        Icon              = IconType.Alert,
                        AuthorizeCallback = user =>
                        {
                            return(user.SecurityClaims.Any(x =>
                                                           ((x.Type == ClientClaimTypes.PrimaryAdmin) ||
                                                            (x.Type == SiteClaimTypes.SitePrimaryAdmin) ||
                                                            (x.Type.StartsWith("corp-") && x.Value == ConnectCoreConstants.CorporateId)) &&
                                                           isSiteAlertsFeatureEnabled));
                        }
                    }
                };
            }
        }
Exemplo n.º 28
0
            public RequireFeatureActionFilter(IContextAccessor <ClientAdminContext> clientAccessor, string id)
            {
                Ensure.NotNull(clientAccessor, "Null ClientAdminContextAccessor passed into constructor of " + GetType().Name);

                _product = clientAccessor.GetContext()?.Product;
                Ensure.NotNull(_product, "Null ProductContext derived from ClientAdminContext passed into constructor of " + GetType().Name);

                _featureId = id;
            }
Exemplo n.º 29
0
 public SiteSettingsEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteSettingsEdit,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 30
0
 public NotificationGroupsCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteNotifyGroupsCreate,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 31
0
 public NavMenusCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteNavMenusCreate,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
Exemplo n.º 32
0
 public PagesDesignHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SitePagesDesign,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
 public ContactFormSubmissionWriter(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 34
0
 public TestimonialReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 35
0
 public ClientReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 36
0
 public HttpAuthenticationManager(IContextAccessor<HttpContext> contextAccessor)
 {
     Context = contextAccessor.Value;
 }
Exemplo n.º 37
0
 public ContractReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 38
0
 public ProjectReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 39
0
 public HistoryReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 40
0
 public SkillReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 41
0
 public CurriculumVitaeReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
Exemplo n.º 42
0
 private static UrlHelper CreateUrlHelper(IContextAccessor<ActionContext> contextAccessor)
 {
     var actionSelector = new Mock<IActionSelector>(MockBehavior.Strict);
     return new UrlHelper(contextAccessor, actionSelector.Object);
 }