Exemplo n.º 1
0
        public bool TienePermiso(IElementoDeDatos elemento, Operaciones operacion)
        {
            if (this.TieneAccesoGlobal())
            {
                return(true);
            }


            string TipoElemento = elemento.GetType().ToString();

            foreach (Permiso Perm in this)
            {
                if (Perm.Objeto.Tipo == TipoElemento &&
                    ((Perm.Operaciones & operacion) == operacion || (Perm.Operaciones & Operaciones.Total) == Operaciones.Total) &&
                    (Perm.Item == null || Perm.Item.Contains(elemento.Id)))
                {
                    return(true);
                }
            }

            return(TienePermiso(elemento.GetType().BaseType, operacion));
        }
Exemplo n.º 2
0
        public ListaIds GetItemsxTipo(IElementoDeDatos elemento)
        {
            ListaIds items        = new ListaIds();
            string   TipoElemento = elemento.GetType().ToString();

            foreach (Permiso Perm in this)
            {
                if (Perm.Objeto.Tipo == TipoElemento && Perm.Item != null && Perm.Item.Count > 0)
                {
                    for (int i = 0; i < Perm.Item.Count; i++)
                    {
                        items.Add(Perm.Item[i]);
                    }
                }
            }
            return(items);
        }