// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseCookiePolicy(); app.UseAuthentication(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); RolesData.SeedRoles(app.ApplicationServices).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseAuthentication(); app.UseEndpoints(endpoints => { endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); }); RolesData.SeedRoles(serviceProvider).Wait(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, RoleManager <IdentityRole> roleManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // Swagger app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Library API"); }); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); RolesData.SeedRoles(roleManager).Wait(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// 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, 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(); RolesData.SeedRoles(roleManager, userManager).Wait(); // 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?}"); }); app.UseIdentity(); }
//To update access rights public IHttpActionResult UpdateRoleAndRights(List <RoleRightsMappingModel> rolesRightsModel) { try { if (ModelState.IsValid) { RolesData roleRightsData = new RolesData(); var config = new MapperConfiguration(cfg => { //cfg.CreateMap<RolesModel, RolesDTO>(); cfg.CreateMap <RoleRightsMappingModel, RoleRightsMappingDTO>(); }); IMapper mapper = config.CreateMapper(); var roleRights = mapper.Map <List <RoleRightsMappingModel>, List <RoleRightsMappingDTO> >(rolesRightsModel); roleRightsData.UpdateRoleAndRights(roleRights); return(Created("api/UpdateRoleAndRights", true)); } else { return(BadRequest(ModelState)); } } catch (Exception ex) { return(BadRequest("Could not update rights")); } }
// GET: Usuario/Edit/5 public ActionResult Edit(int id) { ViewBag.roles = RolesData.getAll(); var p = usuarioData.ObtenerPorId(id); return(View(p)); }
public JsonResult JsonListarRoles(string nom) { var listadoTotal = RolesData.ListarRoles(nom); var resjson1 = (new JqGridExtension <ListarRolesDto>()).DataBind(listadoTotal, listadoTotal.Count); return(resjson1); }
//[HttpPost] public ActionResult AsignarMenuOpcion(string id) { if (string.IsNullOrEmpty(id)) { this.Error(new ArgumentNullException("No se ha ingresado el id del rol")); // return RedirectToAction("ListarRoles", "Rol"); } if (!Utilidades.IsNumeric(id)) { this.Error(new InvalidCastException("El id ingresado no cumple el formato numerico requerido")); //return RedirectToAction("ListarRoles", "Rol"); } var resRol = RolesData.ObtenerDatosRol(int.Parse(id)); // if (resRol == null) return RedirectToAction("ListarRoles", "Roles"); var modelo = new AsignarMenuOpcionModel(); modelo.ListaOpciones = MenuOpcionData.GetListaTotalMenu(int.Parse(id)); modelo.rol_int_id = resRol.rol_int_id; modelo.rol_str_descrip = resRol.rol_str_descrip; //return Json(new { success = true, cod =modelo.sis_str_sigla, des = modelo.rol_str_descrip }, JsonRequestBehavior.AllowGet); // if (roles_procesados > 0) // return RedirectToAction("AsignarMenuOpcion", "Roles", new { area = "seguridad", id = modelo.rol_int_id }); return(View(modelo)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IAntiforgery antiforgery, IBackgroundJobClient backgroundJobs, RoleManager <IdentityRole> roleManager, IUserService userService, IRecurringJobManager recurringJobManager) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseMigrationsEndPoint(); } else { app.UseExceptionHandler("/Home/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.Use(next => context => { string path = context.Request.Path.Value; if ( string.Equals(path, "/", StringComparison.OrdinalIgnoreCase) || string.Equals(path, "/index.html", StringComparison.OrdinalIgnoreCase)) { var tokens = antiforgery.GetAndStoreTokens(context); context.Response.Cookies.Append("XSRF-TOKEN", tokens.RequestToken, new CookieOptions() { HttpOnly = false }); } return(next(context)); }); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseResponseCaching(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); RolesData.SeedRoles(roleManager).Wait(); app.UseHangfireDashboard("/hangfire", new DashboardOptions { Authorization = new[] { new HangfireAuthorizationFilter() } }); //Add methods to run recurringly here: //recurringJobManager.AddOrUpdate("GetUserData", Job.FromExpression(() => userService.GetAllUserData()), Cron.Daily()); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); endpoints.MapRazorPages(); endpoints.MapHangfireDashboard(); endpoints.MapHub <LiveFeedHub>("/LiveFeedHub"); }); }
// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } // => Localization var supportedCultures = new[] { new CultureInfo("en"), new CultureInfo("kk"), new CultureInfo("ru"), }; app.UseRequestLocalization(new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("ru"), // Formatting numbers, dates, etc. SupportedCultures = supportedCultures, // UI strings that we have localized. SupportedUICultures = supportedCultures }); // <= app.UseStaticFiles(); app.UseIdentity(); // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 //// => Sessions //app.UseSession(); //app.UseMiddleware<Middleware>(); //// <= RolesData.SeedRoles(app.ApplicationServices).Wait(); var userManager = app.ApplicationServices.GetService <UserManager <ApplicationUser> >(); ApplicationUser user = userManager.Users.FirstOrDefault(u => u.Email == "*****@*****.**"); userManager.AddToRoleAsync(user, "Administrator"); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public IHttpActionResult updateRoleElement(PermissionDTO pPermissionDTO) { if (!RolesData.updateRolePermission(pPermissionDTO)) { return(BadRequest()); } return(Ok()); }
public IHttpActionResult updateRoleElement(ElementDTO pElementDTO) { if (!RolesData.updateRoleElement(pElementDTO)) { return(BadRequest()); } return(Ok()); }
public IHttpActionResult Delete(int id_role) { if (!RolesData.deleteRole(id_role.ToString())) { return(BadRequest()); } return(Ok()); }
public JsonResult ListarRolesDisponiblesAsignados(string ptipo, string pured, string pralias, string sidx, string sord, int page, int rows) { int tiporeporte = (String.IsNullOrEmpty(ptipo) || !Utilidades.IsNumeric(ptipo)) ? 0 : Convert.ToInt32(ptipo); var listadoTotal = RolesData.GetListarRolesAsignables(pured, pralias, tiporeporte); var resjson1 = (new JqGridExtension <ListarRolesAsignablesDto>()).DataBind(listadoTotal, listadoTotal.Count); return(resjson1); }
public DatabaseProvider() { Users = new UsersData(); Roles = new RolesData(); Households = new HouseholdsData(); Audits = new AuditData(); Permissions = new PermissionsData(); }
//To get access rights public IHttpActionResult GetUserRights([FromUri] List <string> roleID) { try { RolesData roleRightsData = new RolesData(); UsersData addUserData = new UsersData(); var rights = addUserData.GetRights(roleID); var workspaceReports = roleRightsData.GetWorkspacesAndReports(); //WorkSpaceData workSpaceData = new WorkSpaceData(); //var workSpaceAndReports = workSpaceData.GetPowerBIWorkspace(); List <RoleRightsMappingDTO> roleRightsMappingsList = new List <RoleRightsMappingDTO>(); foreach (var b in workspaceReports) { RoleRightsMappingDTO a = new RoleRightsMappingDTO(); //a.ID = 0; a.WorkspaceID = b.WorkspaceID; a.WorkspaceName = b.WorkspaceName; a.ReportID = b.ReportID; a.ReportName = b.ReportName; roleRightsMappingsList.Add(a); } List <RoleRightsMappingDTO> updatedRoleRightsMappingsList = new List <RoleRightsMappingDTO>(); foreach (var s in roleRightsMappingsList) { updatedRoleRightsMappingsList.Add(s); } foreach (var l1 in roleRightsMappingsList) { bool existed = false; foreach (var l2 in rights) { if (l1.WorkspaceID == l2.WorkspaceID && l1.ReportID == l2.ReportID) { existed = true; break; } } if (existed) { updatedRoleRightsMappingsList.Remove(l1); } } rights = rights.Concat(updatedRoleRightsMappingsList); return(Ok(rights)); } catch (Exception ex) { return(BadRequest("Could not fetch rights")); } }
public RoleDTO Post(RoleDTO pRoleDTO) { RoleDTO roleDTO = new RoleDTO(); if ((roleDTO.id_role = RolesData.insertRoll(pRoleDTO)) == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(roleDTO); }
protected void btnAddRole_Click(object sender, EventArgs e) { if (txtRoleName.Text.CompareTo(String.Empty) != 0) { DataProvider dp = new DataProvider(); dp.AddRoles(txtRoleName.Text); RolesData.Select(); ListAllRoles.DataBind(); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseHsts(); app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseAuthentication(); IList <CultureInfo> supportedCultures = new List <CultureInfo> { new CultureInfo("en-US"), new CultureInfo("pl-PL"), }; var localizationOptions = new RequestLocalizationOptions { DefaultRequestCulture = new RequestCulture("pl-PL"), SupportedCultures = supportedCultures, SupportedUICultures = supportedCultures }; var requestProvider = new RouteDataRequestCultureProvider(); localizationOptions.RequestCultureProviders.Insert(0, requestProvider); app.UseRouter(routes => { routes.MapMiddlewareRoute("{culture=pl-PL}/{*mvcRoute}", subApp => { subApp.UseRequestLocalization(localizationOptions); subApp.UseMvc(mvcRoutes => { mvcRoutes.MapRoute( name: "default", template: "{culture=pl-PL}/{controller=Home}/{action=Index}/{id?}"); }); }); }); if (!CurrentEnvironment.IsEnvironment("Testing") && !CurrentEnvironment.IsEnvironment("SingleTest")) { RolesData.SeedRoles(app.ApplicationServices, Configuration).Wait(); } }
// 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, WebKantoraDbContext context, RoleManager <Role> roleManager) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIdentity(); RolesData.SeedRoles(roleManager).Wait(); if (env.IsDevelopment()) { app.UseExceptionHandler("/Home/Error"); app.UseStatusCodePagesWithReExecute("/Home/Error"); //app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); app.UseStatusCodePagesWithRedirects("/Home/Error"); } app.UseStaticFiles(); app.UseIdentity(); app.UseSession(); //AutoMapperConfig automapperConfig = new AutoMapperConfig(); //automapperConfig.Execute(Assembly.GetEntryAssembly()); // Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "areas", template: "{area:exists}/{controller=Blog}/{action=Index}/{id?}" ); routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context, app); }
//To get Workspace and Reports public IHttpActionResult GetWorkspacesAndReports() { try { RolesData rolesData = new RolesData(); var workspaceReports = rolesData.GetWorkspacesAndReports(); return(Ok(workspaceReports)); } catch (Exception ex) { return(BadRequest("Could not fetch workspace and reports")); } }
//To get roles public IHttpActionResult GetRoles() { try { RolesData rolesData = new RolesData(); var roles = rolesData.GetRoles(); return(Ok(roles)); } catch (Exception ex) { return(BadRequest("Could not fetch roles")); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, RoleManager <UserRoleEntity> roleManager, UserManager <UserEntity> userManager) { if (env.IsDevelopment()) { //IServiceScopeFactory scopeFactory = app.ApplicationServices // .GetRequiredService<IServiceScopeFactory>(); //using (IServiceScope scope = scopeFactory.CreateScope()) //{ // RoleManager<UserRoleEntity> roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<UserRoleEntity>>(); // // Add test role // AddTestRole(roleManager).Wait(); //} //var roleManager = app.ApplicationServices // .GetRequiredService<RoleManager<UserRoleEntity>>(); app.UseDeveloperExceptionPage(); // Lynda Video Tutorial: Part 4 (seed the database with test data) // InvalidOperationException is thrown // Athletes are currently added in the constructor of the AthleteController //var context = app.ApplicationServices.GetRequiredService<FieldScribeAPIContext>(); //AddTestData(context); } app.UseHsts(opt => { opt.MaxAge(days: 180); opt.IncludeSubdomains(); opt.Preload(); }); app.UseAuthentication(); // Add roles to database RolesData.CreateRoles(roleManager).Wait(); // Add admins and test users to database Admins.CreateAdmins(userManager).Wait(); TestUsers.CreateTestUsers(userManager).Wait(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, AuthDbContext dbContext, RoleManager <IdentityRole> roleManager ) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // ===== Use Authentication ====== app.UseAuthentication(); RolesData.SeedRoles(roleManager).Wait(); app.UseMvc(); // ===== Create tables ====== dbContext.Database.EnsureCreated(); }
// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } RolesData.SeedRoles(app.ApplicationServices).Wait(); app.UseStaticFiles(); app.UseIdentity(); // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); //Redirect HTTP requests to HTTPS loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); var options = new RewriteOptions() .AddRedirectToHttps(); }
public virtual void makeLocalUserAndRolesData() { this.o_userRoleData = new UserAndRolesDataAnonymousInnerClass(this); PrincipalsData principalsData = new PrincipalsData(); principalsData.PrincipalId = getEncProperty("database.username"); principalsData.Password = getEncProperty("database.password"); this.o_userRoleData.PrincipalsData = principalsData; string[] arrayOfString = getStringArrayProperty("database.accessibility"); RolesData[] arrayOfRolesData = new RolesData[arrayOfString.Length]; for (sbyte b = 0; b < arrayOfString.Length; b++) { RolesData rolesData = new RolesData(); rolesData.PrincipalId = principalsData.PrincipalId; rolesData.Role = arrayOfString[b]; rolesData.RoleId = arrayOfString[b]; arrayOfRolesData[b] = rolesData; } this.o_userRoleData.RolesData = arrayOfRolesData; this.o_userId = principalsData.PrincipalId; this.o_password = principalsData.Password; }
// 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, CureContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); RolesData.SeedRoles(app.ApplicationServices).Wait(); app.UseApplicationInsightsRequestTelemetry(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.UseIdentity(); // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); DbInitializer.Initialize(context); }
public ActionResult AsignarMenuOpcion2(string ids, int rol) { var sis_str_siglas = ConfigurationManager.AppSettings["ModuleAcronym"] == null ? string.Empty : Convert.ToString(ConfigurationManager.AppSettings["ModuleAcronym"]); //if (formcollection["trevalor"] == null) throw new ArgumentException("Hubo un error al momento de obtener los datos "); //var datos_array = Convert.ToString(formcollection["trevalor"]).Split(','); //modelo.ListaOpciones = new List<MenuOpcion>(); string ids_extras = ","; string[] datos_array_first = ids.Split(','); foreach (var item in datos_array_first) { string idpadre = RolesData.GetObtenerIdPadre(Convert.ToInt32(item)).ToString(); if (ids.IndexOf(idpadre) != -1) { continue; } if (Convert.ToInt32(idpadre) == 0) { continue; } if (ids_extras.IndexOf(idpadre) == -1) { ids_extras = ids_extras + "," + idpadre; } } var modelo = new AsignarMenuOpcionModel(); modelo.rol_int_id = rol; modelo.ListaOpciones = new List <MenuOpcion>(); ids = ids + ids_extras; string[] datos_array = ids.Split(','); foreach (var datos in datos_array) { if (datos == "") { continue; } modelo.ListaOpciones.Add(new MenuOpcion() { IdMenuOpcion = int.Parse(datos), //int.Parse(GetDataFormatString("data-idmenu", datos)), CodigoPermiso = "AME", // GetDataFormatString("data-permiso", datos), ItemSeleccionado = true //bool.Parse(GetDataFormatString("data-selectoption", datos)) }); } var roles_procesados = RolesData.AsignarMenuOpcionRol(this.ControllerContext, sis_str_siglas, modelo.rol_int_id, modelo.ListaOpciones.Where(x => x.ItemSeleccionado == true).ToList()); if (roles_procesados == 0) { ViewBag.Mensaje = "Se han activo todas las opciones para este rol"; } else { ViewBag.Mensaje = string.Format("se han asignado {0} opciones al rol", roles_procesados); } if (roles_procesados > 0) { //return RedirectToAction("AsignarMenuOpcion", "Roles", new { area = "seguridad", id = modelo.rol_int_id }); return(Json(new { success = true, res = "1" }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, res = "0" }, JsonRequestBehavior.AllowGet)); } //return View(modelo); }
public async Task <ActionResult> Login(LoginViewModel u) { try { if (ModelState.IsValid) { string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password: u.Pass, salt: System.Text.Encoding.ASCII.GetBytes(configuration["Salt"]), prf: KeyDerivationPrf.HMACSHA1, iterationCount: 1000, numBytesRequested: 256 / 8 )); var usuario = usuarioData.ObtenerPorMail(u.Mail); if (usuario == null || usuario.Pass != hashed) { ModelState.AddModelError("", "El email o la clave no son correctas"); return(View("index", u)); } var claims = new List <Claim> { new Claim("Id", usuario.Id.ToString()), new Claim(ClaimTypes.Name, usuario.Mail), new Claim(ClaimTypes.Role, RolesData.getById(usuario.RolId).Nombre), new Claim("Image", usuario.Avatar) }; if (RolesData.getById(usuario.RolId).Nombre == "Administrador") { claims.Add( new Claim("Admin", "Admin") ); } var claimsIdentity = new ClaimsIdentity( claims, CookieAuthenticationDefaults.AuthenticationScheme); await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity)); return(RedirectToAction(nameof(Index), "Home")); } else { ViewBag.Error = "Usuario o contraseña invalidos"; return(RedirectToAction(nameof(Index))); } } catch (Exception) { throw; } }
// 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) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseApplicationInsightsRequestTelemetry(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseApplicationInsightsExceptionTelemetry(); // Initialise ReactJS.NET. Must be before static files. app.UseReact(config => { // If you want to use server-side rendering of React components, // add all the necessary JavaScript files here. This includes // your components as well as all of their dependencies. // See http://reactjs.net/ for more information. Example: //config // .AddScript("~/Scripts/First.jsx") // .AddScript("~/Scripts/Second.jsx"); // If you use an external build too (for example, Babel, Webpack, // Browserify or Gulp), you can improve performance by disabling // ReactJS.NET's version of Babel and loading the pre-transpiled // scripts. Example: //config // .SetLoadBabel(false) // .AddScriptWithoutTransform("~/Scripts/bundle.server.js"); }); app.UseStaticFiles(); app.UseIdentity(); #region Swagger // Enable middleware to serve generated Swagger as a JSON endpoint. app.UseSwagger(c => { c.PreSerializeFilters.Add((swagger, httpReq) => swagger.Host = httpReq.Host.Value); }); // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint. app.UseSwaggerUi(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "AxiaHomework v1"); }); #endregion // Add external authentication middleware below. To configure them please see http://go.microsoft.com/fwlink/?LinkID=532715 #region Facebook Authentication app.UseFacebookAuthentication(new FacebookOptions() { AppId = Configuration["Authentication:Facebook:AppId"], AppSecret = Configuration["Authentication:Facebook:AppSecret"] }); #endregion #region Google Authentication app.UseGoogleAuthentication(new GoogleOptions() { ClientId = Configuration["Authentication:Google:ClientId"], ClientSecret = Configuration["Authentication:Google:ClientSecret"] }); #endregion app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); //Initialise Data RolesData.SeedRoles(app.ApplicationServices).Wait(); UserData.SeedUsers(app.ApplicationServices).Wait(); }
public IEnumerable <ElementDTO> permissionElementsbyRole(string id_rolePermission) { List <ElementDTO> elements = RolesData.getElements(id_rolePermission); return(elements); }