public PostsController(IngoContext context, UserManager <UserIdentity> userManager, CurrentUser currentUser
                        , EntityRightsChecker rightsChecker)
 {
     _context       = context;
     _userManager   = userManager;
     _currentUser   = currentUser;
     _rightsChecker = rightsChecker;
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory
                              , UserManager <UserIdentity> userManager, IngoContext ingoContext)
        {
            // if (env.IsDevelopment())
            // {
            app.UseDeveloperExceptionPage();
            // }
            //else
            //{
            //    app.UseExceptionHandler("/Error");
            //    app.UseHsts();
            //}
            app.UseCors(configurePolicy => configurePolicy
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        .AllowAnyOrigin()
                        .AllowCredentials()
                        );


            // loggerFactory.AddFile("logs/log.txt");


            app.UseConfiguredSwagger();

            app.UseAuthentication();

            app.SeedAdmin(userManager, ingoContext);

            //app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSpaStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            });

            app.UseSpa(spa =>
            {
                if (env.IsDevelopment())
                {
                    spa.Options.SourcePath     = "ClientApp";
                    spa.Options.StartupTimeout = new TimeSpan(hours: 0, minutes: 2, seconds: 0);
                    spa.UseAngularCliServer("start");
                }
                else
                {
                    spa.Options.SourcePath = "ClientApp/dist";
                }
            });
        }
Exemple #3
0
 public AccountController(UserManager<UserIdentity> userManager, SignInManager<UserIdentity> signInManager, IngoContext context
     , IOptions<JwtSettings> jwtSettings, CurrentUser currentUser, ILogger<AccountController> logger
     , EmailService emailService)
 {
     _userManager = userManager;
     _signInManager = signInManager;
     _context = context;
     _jwtSettings = jwtSettings.Value;
     _currentUser = currentUser;
     _logger = logger;
     _emailService = emailService;
 }
Exemple #4
0
 public BadgesController(IngoContext context)
 {
     _context = context;
 }
Exemple #5
0
 public CurrentUser(IngoContext context)
 {
     _ingoContext = context;
 }
Exemple #6
0
        public static void SeedAdmin(this IApplicationBuilder app, UserManager <UserIdentity> userManager, IngoContext ingoContext)
        {
            var admin         = ingoContext.UserProfiles.Find(1);
            var adminIdentity = userManager.FindByNameAsync("Admin").Result;

            if (admin.IdentityId == adminIdentity?.Id)
            {
                return;
            }
            admin.Identity = adminIdentity;
            ingoContext.UserProfiles.Update(admin);
            ingoContext.SaveChanges();
        }
Exemple #7
0
 public EventController(IngoContext context)
 {
     _context = context;
 }
Exemple #8
0
 public UsersController(IngoContext context, CurrentUser currentUser, UserManager <UserIdentity> userManager)
 {
     _context     = context;
     _currentUser = currentUser;
     _userManager = userManager;
 }
Exemple #9
0
 public FaqController(IngoContext context)
 {
     _context = context;
 }
 public FaqCategoryController(IngoContext context)
 {
     _context = context;
 }