Пример #1
0
        public static List<Features> GetPermissoes(Login user)
        {
            if (user != null)
            {
                List<Features> perms = new List<Features>();

                var items = from i in user.GruposUsuarios
                            from j in i.Permissoes
                            where i.Ativo == true && j.Ativo == true
                            select j.Features;

                perms.AddRange(items);

                return perms;
            }
            return null;
        }
Пример #2
0
 public static bool Authenticate(string username, string password, out Login AuthUser, out List<Features> Permissoes)
 {
     Login user = (from i in DBInstance.DB.Login
                  where i.Username.ToUpper().Equals(username) &&
                        i.Password.Equals(password) &&
                        i.Ativo.Equals(true)
                  select i).FirstOrDefault();
     if (user != null)
     {
         AuthUser = user;
         Permissoes = GetPermissoes(user);
         return true;
     }
     AuthUser = null;
     Permissoes = null;
     return false;
 }
Пример #3
0
 /// <summary>
 /// Create a new Login object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="username">Initial value of the Username property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="ativo">Initial value of the Ativo property.</param>
 public static Login CreateLogin(global::System.Guid id, global::System.String username, global::System.String password, global::System.Boolean ativo)
 {
     Login login = new Login();
     login.Id = id;
     login.Username = username;
     login.Password = password;
     login.Ativo = ativo;
     return login;
 }
Пример #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Login EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLogin(Login login)
 {
     base.AddObject("Login", login);
 }