Ejemplo n.º 1
0
        public override bool IsUserInRole(string username, string roleName)
        {
            SeniorDBEntities db = new SeniorDBEntities();
            var user            = db.Users.Where(a => a.username.ToLower() == username.ToLower()).FirstOrDefault();

            if (user == null)
            {
                return(false);
            }
            return(user.Role.Name.ToLower() == roleName.ToLower());
        }
Ejemplo n.º 2
0
        public override string[] GetRolesForUser(string username)
        {
            string[]         roles = { Constants.ROLES.GUEST };
            SeniorDBEntities db    = new SeniorDBEntities();
            var user = db.Users.Where(a => a.username.ToLower() == username.ToLower()).FirstOrDefault();

            if (user != null)
            {
                return new string[] { user.Role.Name }
            }
            ;

            return(roles);
        }