Example #1
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);
        }
Example #2
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 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Request.GetUser().Admin)
     {
         Response.StatusCode = 401;
         return;
     }
     if (!IsPostBack)
     {
         RootBox.Text = new Config().Root;
     }
     if (Request.Form["hidden"] != null)
     {
         Privileges.Parse(Request.Form["hidden"]).Save();
     }
     Data = new Privileges().ToString();
 }