private void MostrarPermiso(Lbl.Sys.Permisos.Permiso permiso) { Lbl.Sys.Permisos.Operaciones Nivel = permiso.Operaciones; string Key = permiso.GetHashCode().ToString(); ListViewItem Itm = Listado.Items.Add(Key, permiso.Objeto.Nombre, 0); Itm.Tag = permiso; Itm.SubItems.Add(Nivel.ToString()); if (permiso.Item == null) { Itm.SubItems.Add("Todos"); } else { Itm.SubItems.Add(permiso.Item.ToString()); } if ((Nivel | Lbl.Sys.Permisos.Operaciones.Total) == Lbl.Sys.Permisos.Operaciones.Total) { Itm.ForeColor = System.Drawing.Color.Tomato; } else { Itm.ForeColor = Listado.ForeColor; } }
/// <summary> /// Actualiza el control con los datos del elemento. /// </summary> public override void ActualizarControl() { Lazaro.Pres.Forms.Section Sect = new Lazaro.Pres.Forms.Section("Campos adicionales"); this.Tabla = Lfx.Workspace.Master.Tables[m_Elemento.TablaDatos]; //Tabla.Connection = this.Connection; if (Tabla.Tags != null) { foreach (Lfx.Data.Tag Tg in Tabla.Tags) { if (Tg.Internal == false) { Lazaro.Pres.Field Fld = new Lazaro.Pres.Field(Tg.FieldName, Tg.Label, Tg.InputFieldType); if (string.IsNullOrEmpty(Tg.LblType) == false) { Fld.LblType = Lbl.Instanciador.InferirTipo(Tg.LblType); } if (Tg.Access > 0) { Lbl.Sys.Permisos.Operaciones Oper = (Lbl.Sys.Permisos.Operaciones)(Tg.Access); if (Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(m_Elemento, Oper) == false) { Fld.ReadOnly = true; } } Fld.Relation = Tg.Relation; Sect.Fields.Add(Fld); } } } this.FromSection(Sect); base.ActualizarControl(); }
public static bool ValidateAccess(Type tipo, Lbl.Sys.Permisos.Operaciones operacion) { bool Tiene = Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(tipo, operacion); if (Tiene == false) { Lfx.Workspace.Master.RunTime.Toast("No tiene permiso para realizar la operación solicitada.", "Error"); } return(Tiene); }