예제 #1
0
 public AccountController(
     UserManager <ApplicationUser> userManager,
     SignInManager <ApplicationUser> signInManager,
     ILoggerFactory loggerFactory,
     ApplicationDbContext db,
     rmsContext context)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = loggerFactory.CreateLogger <AccountController>();
     _db            = db;
     _context       = context;
 }
예제 #2
0
        public async static void Initialize(rmsContext db, RoleManager <IdentityRole> _roleManager, UserManager <ApplicationUser> _userManager)
        {
            db.Database.EnsureCreated();

            // Look for any students.
            if (_roleManager.Roles.Any() || _userManager.Users.Any())
            {
                return;   // DB has been seeded
            }

            IdentityRole Role = new IdentityRole();

            Role.NormalizedName = "ADMINISTRATOR";
            Role.Name           = "administrator";
            await _roleManager.CreateAsync(Role);

            IdentityRole Role2 = new IdentityRole();

            Role2.NormalizedName = "DATAENTRY";
            Role2.Name           = "dataentry";
            await _roleManager.CreateAsync(Role2);

            IdentityRole Role3 = new IdentityRole();

            Role3.NormalizedName = "GUEST";
            Role3.Name           = "guest";
            await _roleManager.CreateAsync(Role3);

            var user = new ApplicationUser
            {
                UserName    = "******",
                PhoneNumber = "99999999",
                FirstName   = "admin",
                LastName    = "admin",
                Email       = "*****@*****.**",
                Position    = "admin",
                Active      = true,
                TenantId    = 1
            };
            var result = await _userManager.CreateAsync(user, "159*951-Aa");

            if (result.Succeeded)
            {
                await _userManager.AddClaimAsync(user, new System.Security.Claims.Claim("super_admin", "1"));

                await _userManager.AddToRoleAsync(user, "administrator");
            }
        }
예제 #3
0
 public FacilitiesController(rmsContext context, ApplicationDbContext db)
 {
     _context = context;
     _db      = db;
 }
예제 #4
0
 public AuthorizationsController(rmsContext context, ICipherService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
예제 #5
0
 public intakeController(rmsContext context, ICipherService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
예제 #6
0
 public RegistrationController(rmsContext context, ICipherService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
예제 #7
0
 public DistrictsController(rmsContext context)
 {
     _context = context;
 }
예제 #8
0
 public ProvincesController(rmsContext context)
 {
     _context = context;
 }
예제 #9
0
 public GbvController(rmsContext context, IDataProtectionProvider dataProtectionProvider, ICipherService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
예제 #10
0
 public TenantsController(rmsContext context)
 {
     _context = context;
 }
예제 #11
0
        // 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, rmsContext context, RoleManager <IdentityRole> _roleManager, UserManager <ApplicationUser> _userManager)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseIdentity();

            // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            DbInitializer.Initialize(context, _roleManager, _userManager);
        }
예제 #12
0
 public ConsentsController(rmsContext context, ICipherService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
예제 #13
0
 public AgencyTypesController(rmsContext context)
 {
     _context = context;
 }