internal static IQueryable <Rol> GetRoles(Castellano.Ambito ambito, Aplicacion aplicacion, bool showProtected) { return (from rol in GetRoles(aplicacion) where GetRoles(ambito, showProtected).Contains <Rol>(rol) select rol); }
public static List <Rol> GetAll(Castellano.Ambito ambito, bool showProtected) { return (( from query in Query.GetRoles(ambito, showProtected) orderby query.Clave, query.Nombre select query ).ToList <Rol>()); }
internal static IQueryable <Rol> GetRoles(Castellano.Ambito ambito, bool showProtected) { switch (showProtected) { case true: return(from rol in GetRoles() where rol.Ambito == ambito select rol); case false: return(from rol in GetRoles() where rol.Ambito == ambito && rol.Clave == null select rol); } return(null); }
public static List <Rol> GetAll(Castellano.Ambito ambito, List <Aplicacion> aplicaciones, bool showProtected) { List <Rol> roles = new List <Rol>(); foreach (Aplicacion aplicacion in aplicaciones) { foreach (Rol rol in Query.GetRoles(ambito, aplicacion, showProtected)) { if (!roles.Contains <Rol>(rol)) { roles.Add(rol); } } } return(roles); }
public JsonResult GetRoles(int ambitoCodigo) { Castellano.Ambito ambito = Castellano.Ambito.Get(ambitoCodigo); Castellano.Web.UI.Areas.Administracion.Models.Rol.Roles rol = new Castellano.Web.UI.Areas.Administracion.Models.Rol.Roles(); rol.data = new List <Castellano.Web.UI.Areas.Administracion.Models.Rol>(); foreach (Castellano.Membresia.Rol r in Castellano.Membresia.Rol.GetAll(ambito, true)) { rol.data.Add(new Castellano.Web.UI.Areas.Administracion.Models.Rol { Id = r.Id, AmbitoCodigo = r.AmbitoCodigo, Nombre = r.Nombre, Clave = r.Clave, Accion = string.Format("{0}{1}{2}", Castellano.Helpers.ActionLinkExtension.ActionLink(null, null, string.Format("GetPermissions?rolId={0}", r.Id), "Admin", "Administracion", Castellano.Helpers.TypeButton.Accept, r.Id, "btn btn-success btn-xs btn-flat", "fa-legal", "Configurar permisos"), Castellano.Helpers.ActionLinkExtension.ActionLinkCrudEmbedded(r.Id, null, Castellano.Helpers.TypeButton.Edit), Castellano.Helpers.ActionLinkExtension.ActionLinkCrudEmbedded(r.Id, null, Castellano.Helpers.TypeButton.Delete)) }); } return(this.Json(rol, JsonRequestBehavior.AllowGet)); }