Beispiel #1
0
        public Perm(FieldInfo info) : base(null, null)
        {
            var x = new FieldNodeInfo(info);

            Node        = x.Node;
            Description = x.Description;
            Type        = PermType.Grant;
        }
 public User()
 {
     Id    = -1;
     Login = "";
     Pass  = "";
     Name  = "";
     Type  = PermType.Error;
 }
Beispiel #3
0
        //私有方法

        private OptResult GetPermByType(PermType type)
        {
            OptResult rst = null;

            try
            {
                var predicate = Predicates.Field <PermissionCacheDto>(p => p.per_type, Operator.Eq, type.ToString());
                var perFuncs  = _perRep.GetList <PermissionCacheDto>(predicate);
                rst = OptResult.Build(ResultCode.Success, Msg_GetAllFuncs, perFuncs);
            }
            catch (Exception ex)
            {
                LogHelper.LogError(Msg_GetAllFuncs, ex);
                rst = OptResult.Build(ResultCode.DbError, Msg_GetAllFuncs);
            }
            return(rst);
        }
Beispiel #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PermType != 0)
            {
                hash ^= PermType.GetHashCode();
            }
            if (Key.Length != 0)
            {
                hash ^= Key.GetHashCode();
            }
            if (RangeEnd.Length != 0)
            {
                hash ^= RangeEnd.GetHashCode();
            }
            return(hash);
        }
Beispiel #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PermType != global::Authpb.Permission.Types.Type.Read)
            {
                hash ^= PermType.GetHashCode();
            }
            if (Key.Length != 0)
            {
                hash ^= Key.GetHashCode();
            }
            if (RangeEnd.Length != 0)
            {
                hash ^= RangeEnd.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public int getIdByPerm(PermType perm)
        {
            Permisos p = db.Permisos.Where(pe => pe.valor == perm.ToString()).Single();

            return(p.id_permiso);
        }
 public bool havePerm(int id_rol, PermType perm)
 {
     return((from rp in db.Rol_Permiso where rp.id_rol == id_rol && rp.Permisos.valor == perm.ToString() select rp).Count() > 0);
 }
Beispiel #8
0
        public MethodsConfig AddPermission(SocketGuild guild, int methodID, string targetID, PermType permType, AllowType allowType)
        {
            var item = GetBaseQuery(true).FirstOrDefault(o => o.GuildID == guild.Id.ToString() && o.ID == methodID);

            if (item == null)
            {
                throw new ArgumentException("Požadovaná metoda neexistuje.");
            }

            item.Permissions.Add(new MethodPerm()
            {
                AllowType = allowType,
                DiscordID = targetID,
                PermType  = permType
            });

            Context.SaveChanges();
            return(item);
        }
Beispiel #9
0
 public Perm(NodeInfo node, PermType type) : base(node.Node, node.Description)
 {
     Type = type;
 }
Beispiel #10
0
 public static User LoadClient(int id, PermType pt)
 {
     return(mysql.LoadClient(id, pt));
 }
Beispiel #11
0
 public static User LoadClient(String login, PermType dt)
 {
     return(mysql.LoadClient(login, dt));
 }
Beispiel #12
0
 public static List <User> LoadClients(String name, PermType dt)
 {
     return(mysql.LoadClients(name, dt));
 }