예제 #1
0
        public static XVar clearSecuritySession()
        {
            dynamic toClear = XVar.Array();

            XSession.Session.Abandon();
            MVCFunctions.SetCookie(new XVar("username"), new XVar(""), (XVar)(MVCFunctions.time() - (365 * 1440) * 60));
            MVCFunctions.SetCookie(new XVar("password"), new XVar(""), (XVar)(MVCFunctions.time() - (365 * 1440) * 60));
            MVCFunctions.RemoveCookie("username");
            MVCFunctions.RemoveCookie("password");
            XSession.Session.Remove("UserID");
            XSession.Session.Remove("UserName");
            XSession.Session.Remove("AccessLevel");
            XSession.Session.Remove("fromFacebook");
            XSession.Session.Remove("UserRights");
            XSession.Session.Remove("LastReadRights");
            XSession.Session.Remove("GroupID");
            XSession.Session.Remove("OwnerID");
            XSession.Session.Remove("securityOverrides");
            toClear = XVar.Clone(XVar.Array());
            foreach (KeyValuePair <XVar, dynamic> v in XSession.Session.GetEnumerator())
            {
                if (MVCFunctions.substr((XVar)(v.Key), new XVar(-8)) == "_OwnerID")
                {
                    toClear.InitAndSetArrayItem(v.Key, null);
                }
            }
            foreach (KeyValuePair <XVar, dynamic> v in toClear.GetEnumerator())
            {
                XSession.Session.Remove(v.Key);
            }
            return(null);
        }