示例#1
0
 public SiteLibraryBrowser(IFolderManager <FileDocument> folderManager,
                           IContextAccessor <AdminContext> adminContextAccessor)
 {
     _folderManager = folderManager;
     _adminContext  = adminContextAccessor.GetContext();
     ownerId        = _adminContext?.SiteId;
 }
示例#2
0
文件: UrlHelper.cs 项目: zinoviev/Mvc
 /// <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;
 }
示例#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();
            }
        }
示例#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();
 }
示例#5
0
文件: UrlHelper.cs 项目: Nakro/Mvc
 public UrlHelper(IContextAccessor<ActionContext> contextAccessor, IActionSelector actionSelector)
 {
     _httpContext = contextAccessor.Value.HttpContext;
     _router = contextAccessor.Value.RouteData.Routers[0];
     _ambientValues = contextAccessor.Value.RouteData.Values;
     _actionSelector = actionSelector;
 }
示例#6
0
 public LibraryOwnerHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppLibraryOwner,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#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;
 }
 public ProductsReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpProductsRead,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
示例#9
0
 public RolesEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppRolesEdit,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#10
0
文件: Step.cs 项目: windhandel/Kekiri
        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);
        }
示例#11
0
 public LibraryEditFilesHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpLibraryEditFiles,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
示例#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
     };
 }
 public ClientsEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         CorpClaimTypes.CorpCustomersEdit,
         CorpClaimTypes.CorpPrimaryAdmin
     };
 }
示例#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;
 }
示例#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
     };
 }
 public UserProfileEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.UsersEdit,
         ClientClaimTypes.PrimaryAdmin
     };
 }
 public DirectoriesReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.UserDirectoryRead,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#20
0
 public SitesReadHandler(IContextAccessor<AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.SitesRead,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#21
0
 public GroupsCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         ClientClaimTypes.AppGroupsCreate,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#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;
 }
示例#23
0
 public AnnouncementSecurityService
 (
     IContextAccessor <SiteContext> siteContextAccessor,
     IContextAccessor <UserContext> userContextAccessor
 )
 {
     _siteContextAccessor = siteContextAccessor;
     _userContextAccessor = userContextAccessor;
 }
示例#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;
 }
示例#25
0
 public UserProfileReadHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteUsersRead,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#26
0
 public GroupsDeleteHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SitePrimaryAdmin,
         SiteClaimTypes.SiteGroupsDelete,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#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));
                        }
                    }
                };
            }
        }
示例#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;
            }
示例#29
0
 public SiteSettingsEditHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteSettingsEdit,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#30
0
 public NotificationGroupsCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteNotifyGroupsCreate,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#31
0
 public NavMenusCreateHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SiteNavMenusCreate,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
示例#32
0
 public PagesDesignHandler(IContextAccessor <AdminContext> adminContextAccessor) : base(adminContextAccessor)
 {
     ValidClaimTypes = new string[]
     {
         SiteClaimTypes.SitePagesDesign,
         SiteClaimTypes.SitePrimaryAdmin,
         ClientClaimTypes.PrimaryAdmin
     };
 }
 public ContactFormSubmissionWriter(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#34
0
 public TestimonialReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#35
0
 public ClientReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#36
0
 public HttpAuthenticationManager(IContextAccessor<HttpContext> contextAccessor)
 {
     Context = contextAccessor.Value;
 }
示例#37
0
 public ContractReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#38
0
 public ProjectReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#39
0
 public HistoryReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#40
0
 public SkillReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
 public CurriculumVitaeReader(IContextAccessor accessor)
 {
     _accessor = accessor;
 }
示例#42
0
 private static UrlHelper CreateUrlHelper(IContextAccessor<ActionContext> contextAccessor)
 {
     var actionSelector = new Mock<IActionSelector>(MockBehavior.Strict);
     return new UrlHelper(contextAccessor, actionSelector.Object);
 }