示例#1
0
 public StaticContentController()
 {
     helper             = OwnershipHelper.getInstance();
     acceptedExtensions = new NameValueCollection();
     acceptedExtensions.Add(".html", "text/html");
     acceptedExtensions.Add(".css", "text/css");
     acceptedExtensions.Add(".js", "application/javascript");
 }
 public static OwnershipHelper getInstance()
 {
     if (instance == null)
     {
         instance = new OwnershipHelper();
     }
     return(instance);
 }
        public override void ProcessRequest(HttpContext context)
        {
            // return the username of the current user
            string          name   = context.User.Identity.Name;
            OwnershipHelper helper = OwnershipHelper.getInstance();

            JObject userInfo  = helper.GetUserInfo(name);
            string  thumbnail = (string)userInfo["thumbnail"];

            context.Response.ContentType = "application/json";
            if (thumbnail == null)
            {
                context.Response.Write("{\"name\": \"" + name + "\", \"thumbnail\": " + thumbnail + " }");
            }
            else
            {
                context.Response.Write("{\"name\": \"" + name + "\", \"thumbnail\": \"" + thumbnail + "\" }");
            }

            Global.LogInfo("User " + name + " requested whoami.");
            return;
        }
 public ChangeOwnerHandler() : base("chown")
 {
     helper = OwnershipHelper.getInstance();
 }
 public RequestUserContentHandler() : base("user")
 {
     helper = OwnershipHelper.getInstance();
 }
示例#6
0
 public RequestGroupContentHandler() : base("group")
 {
     helper = OwnershipHelper.getInstance();
 }