/// <summary>
        /// Initializes a new instance of the <see cref="UserAccessControlHandler"/> class.
        /// </summary>
        public UserAccessControlHandler(IConfiguration configuration, IHttpContextAccessor httpContextAccessor, JosekiDbContext db)
        {
            this.configuration = configuration;
            var authEnabledConfiguration = this.configuration["DEV_JOSEKI_AUTH_ENABLED"];

            this.authEnabled         = authEnabledConfiguration != null && bool.Parse(authEnabledConfiguration) == true;
            this.httpContextAccessor = httpContextAccessor;
            this.db = db;
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ExtractOwnershipProcessor"/> class.
 /// </summary>
 /// <param name="db">Joseki database implementation.</param>
 /// <param name="cache">Ownership in memory cache.</param>
 public ExtractOwnershipProcessor(JosekiDbContext db, IOwnershipCache cache)
 {
     this.db    = db;
     this.cache = cache;
     this.jsonSerializerSettings = new JsonSerializerSettings
     {
         NullValueHandling     = NullValueHandling.Ignore,
         MissingMemberHandling = MissingMemberHandling.Ignore,
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetComponentDetailsHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 /// <param name="cache">Score cache.</param>
 /// <param name="docsHandler">Knowledgebase items handler.</param>
 /// <param name="ownershipCache">Ownership cache using OwnershipEntity.</param>
 public GetComponentDetailsHandler(
     JosekiDbContext db,
     IInfrastructureScoreCache cache,
     GetKnowledgebaseItemsHandler docsHandler,
     IOwnershipCache ownershipCache)
 {
     this.db             = db;
     this.cache          = cache;
     this.docsHandler    = docsHandler;
     this.ownershipCache = ownershipCache;
 }
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetInfrastructureHistoryHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 /// <param name="cache">Score cache.</param>
 public GetInfrastructureHistoryHandler(JosekiDbContext db, IInfrastructureScoreCache cache)
 {
     this.db    = db;
     this.cache = cache;
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CveCache"/> class.
 /// </summary>
 /// <param name="config">Joseki configuration object.</param>
 /// <param name="db">Joseki database instance.</param>
 /// <param name="cache">In-memory cache.</param>
 public CveCache(ConfigurationParser config, JosekiDbContext db, IMemoryCache cache)
 {
     this.config = config.Get();
     this.db     = db;
     this.cache  = cache;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ComponentPermissionsHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 public ComponentPermissionsHandler(JosekiDbContext db)
 {
     this.db = db;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetOverviewDetailsHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 /// <param name="ownershipCache">Ownership cache using OwnershipEntity.</param>
 public GetOverviewDetailsHandler(JosekiDbContext db, IOwnershipCache ownershipCache)
 {
     this.db             = db;
     this.ownershipCache = ownershipCache;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MssqlJosekiDatabase"/> class.
 /// </summary>
 public MssqlJosekiDatabase(JosekiDbContext db, ConfigurationParser parser)
 {
     this.db     = db;
     this.config = parser.Get();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetKnowledgebaseItemsHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 /// <param name="rootPath">Root path for the files.</param>
 public GetKnowledgebaseItemsHandler(JosekiDbContext db, string rootPath = "Docs")
 {
     this.db       = db;
     this.rootPath = rootPath;
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InfraScoreDbWrapper"/> class.
 /// </summary>
 /// <param name="db">Joseki database.</param>
 public InfraScoreDbWrapper(JosekiDbContext db)
 {
     this.db = db;
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetImageScanHandler"/> class.
 /// </summary>
 /// <param name="db">Joseki database object.</param>
 public GetImageScanHandler(JosekiDbContext db)
 {
     this.db = db;
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OwnershipCache"/> class.
 /// </summary>
 /// <param name="db">Joseki database instance.</param>
 /// <param name="cache">In-memory cache.</param>
 public OwnershipCache(JosekiDbContext db, IMemoryCache cache)
 {
     this.db    = db;
     this.cache = cache;
 }