Example #1
0
        public static User GetUser(this HttpRequest request)
        {
            var temp = new Privileges();
            var psw  = request.GetPassword();

            if (temp.Contains(psw))
            {
                return(temp[psw]);
            }
            return(temp.Contains(User.AnonymousPassword) ? temp[User.AnonymousPassword] : new User());
        }
Example #2
0
        public static Privileges Parse(string value)
        {
            var result = new Privileges();

            foreach (var user in value.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                     .Select(line => new User(line)).Where(user => !result.Contains(user.Password)))
            {
                result.Add(user);
            }
            return(result);
        }