Пример #1
0
        public bool TienePermisoxItem(Type tipo, Operaciones operacion, ListaIds items)
        {
            if (this.TieneAccesoGlobal())
            {
                return(true);
            }

            if (tipo == null)
            {
                return(false);
            }

            string TipoElemento = tipo.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 == items || (Perm.Operaciones & Operaciones.Total) == Operaciones.Total))
                {
                    return(true);
                }
            }

            if (tipo != typeof(Lbl.ElementoDeDatos) && tipo != typeof(System.Object))
            {
                return(TienePermisoxItem(tipo.BaseType, operacion, items));
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 public Permiso(Lbl.Personas.Usuario usuario, Objeto tipo, Operaciones ops, ListaIds item)
     : this(usuario.Connection)
 {
     this.Usuario     = usuario;
     this.Objeto      = tipo;
     this.Operaciones = ops;
     this.Item        = item;
 }
Пример #3
0
 public Permiso(Lbl.Personas.Usuario usuario, Objeto tipo, Operaciones ops, ListaIds item)
         : this(usuario.Connection)
 {
         this.Usuario = usuario;
         this.Objeto = tipo;
         this.Operaciones = ops;
         this.Item = item;
 }
Пример #4
0
 public bool TienePermisoxItem(Type tipo, Sys.Permisos.Operaciones operacion, ListaIds items)
 {
     if (this.Usuario == null)
     {
         return(true);    // FIXME: tengo que decir que si por los módulos que no se loguean
     }
     else
     {
         return(this.Usuario.Pemisos.TienePermisoxItem(tipo, operacion, items));
     }
 }
Пример #5
0
                public override void OnLoad()
                {
                        if (this.GetFieldValue<int>("id_objeto") > 0)
                                this.Objeto = new Permisos.Objeto(this.Connection, this.GetFieldValue<int>("id_objeto"));
                        else
                                this.Objeto = null;

                        if (this.GetFieldValue<string>("items") != null)
                                this.Item = new ListaIds(this.GetFieldValue<string>("items"));
                        else
                                this.Item = null;

                        base.OnLoad();
                }
Пример #6
0
        public ListaIds GetItemsxTipo(string tipo)
        {
            ListaIds items = new ListaIds();

            foreach (Permiso Perm in this)
            {
                if (Perm.Objeto.Tipo == tipo && Perm.Item != null && Perm.Item.Count > 0)
                {
                    for (int i = 0; i < Perm.Item.Count; i++)
                    {
                        items.Add(Perm.Item[i]);
                    }
                }
            }
            return(items);
        }
Пример #7
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);
        }
Пример #8
0
        public bool TienePermisoxItem(string tipo, Operaciones operacion, ListaIds items)
        {
            if (this.TieneAccesoGlobal())
            {
                return(true);
            }

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

            return(false);
        }
Пример #9
0
        public override void OnLoad()
        {
            if (this.GetFieldValue <int>("id_objeto") > 0)
            {
                this.Objeto = new Permisos.Objeto(this.Connection, this.GetFieldValue <int>("id_objeto"));
            }
            else
            {
                this.Objeto = null;
            }

            if (this.GetFieldValue <string>("items") != null)
            {
                this.Item = new ListaIds(this.GetFieldValue <string>("items"));
            }
            else
            {
                this.Item = null;
            }

            base.OnLoad();
        }
        public IHttpActionResult Post(ListaIds lista)
        {
            List <ViewTema> temas = new List <ViewTema>();

            using (ctx = new JogoMasterEntities())
            {
                lista.ids.ForEach(id =>
                {
                    var tema = ctx.Temas.Where(t => t.Id == id).Select(t => new ViewTema
                    {
                        Id    = t.Id,
                        Tema  = t.Tema1,
                        Cor   = t.Cor,
                        Icone = t.Icone
                    }
                                                                       ).FirstOrDefault();

                    temas.Add(tema);
                });
            }

            return(Ok(temas));
        }
Пример #11
0
        public bool TienePermisoxItem(IElementoDeDatos elemento, Operaciones operacion, ListaIds items)
        {
            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) || (Perm.Operaciones & Operaciones.Total) == Operaciones.Total))
                {
                    return(true);
                }
            }

            return(TienePermisoxItem(elemento.GetType().BaseType, operacion, items));
        }