コード例 #1
0
ファイル: Master-v5.master.cs プロジェクト: anthrax3/Swarmops
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                this._authority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
            }
            catch (Exception)
            {
                // if this fails FOR WHATEVER REASON then we're not authenticated

                this._authority = null;
                FormsAuthentication.SignOut();
                Response.Redirect("/", true);
            }

            // BEGIN TEST CODE

            // VatReports.CreateNewReports();

            // END TEST CODE


            if (this._authority.Organization.Identity == 3 &&
                PilotInstallationIds.IsPilot(PilotInstallationIds.PiratePartySE))
            {
                this._authority = null;
                FormsAuthentication.SignOut();
                Response.Redirect("/", true);
            }
        }
コード例 #2
0
ファイル: PageV5Base.cs プロジェクト: osoftware/Swarmops
        protected static AuthenticationData GetAuthenticationDataAndCulture()
        {
            // This function is called from static page methods in AJAX calls to get
            // the current set of authentication data. Static page methods cannot access
            // the instance data of PageV5Base.

            return(CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current));
        }
コード例 #3
0
ファイル: DataV5Base.cs プロジェクト: osoftware/Swarmops
        /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
        protected override void OnInitComplete(EventArgs e)
        {
            base.OnInitComplete(e);

            string identity = HttpContext.Current.User.Identity.Name;

            if (!string.IsNullOrEmpty(identity))
            {
                try
                {
                    CurrentAuthority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
                }
                catch (Exception)
                {
                    // if this fails FOR WHATEVER REASON then we're not authenticated
                    this.CurrentAuthority = null;
                    FormsAuthentication.SignOut();
                }
            }
            else
            {
                CurrentAuthority = null; // unauthenticated!
            }

            // Regardless of auth data and culture, set Gregorian calendar
            // (avoids problems with Arabic, etc, calendars and bookkeeping in localization)

            GregorianCalendar normalizedCalendar = new GregorianCalendar();

            normalizedCalendar.CalendarType = GregorianCalendarTypes.USEnglish;

            // Set the calendar to GregorianCalendar.USEnglish. This sometimes fails on Windows but works
            // on Mono. If it fails on Windows, no biggie b/c this is supposed to be the default anyway.
            try
            {
                Thread.CurrentThread.CurrentCulture.DateTimeFormat.Calendar   = normalizedCalendar;
                Thread.CurrentThread.CurrentUICulture.DateTimeFormat.Calendar = normalizedCalendar;
            }
            catch (Exception)
            {
                // meh
            }
        }
コード例 #4
0
ファイル: CommonV5.cs プロジェクト: osoftware/Swarmops
        public static Authority InitAuthority()
        {
            try
            {
                Authority authority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
                return(authority);
            }
            catch (Exception)
            {
                // if this fails FOR WHATEVER REASON then we're not authenticated
                System.Web.Security.FormsAuthentication.SignOut();

                if (!HttpContext.Current.Request.Path.ToLowerInvariant().StartsWith("/security/login"))
                {
                    // If we're not already on the login page, put us on the login page leading to Dashboard
                    HttpContext.Current.Response.Redirect("/");
                }
                return(null);
            }
        }
コード例 #5
0
ファイル: Master-v5.master.cs プロジェクト: mikran/Swarmops
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                this._authority = CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current).Authority;
                this._authority.Organization.GetMemberCount(); // will throw if Organization can't be looked up
            }
            catch (Exception)
            {
                // if this fails FOR WHATEVER REASON then we're not authenticated

                this._authority = null;
                FormsAuthentication.SignOut();
                Response.Redirect("/", true);
            }

            // BEGIN TEST CODE

            // VatReports.CreateNewReports();

            // END TEST CODE
        }
コード例 #6
0
ファイル: DataV5Base.cs プロジェクト: osoftware/Swarmops
        protected override void OnPreInit(EventArgs e)
        {
            CommonV5.CulturePreInit(Request);

            base.OnPreInit(e);
        }
コード例 #7
0
ファイル: DataV5Base.cs プロジェクト: osoftware/Swarmops
 public static string JavascriptEscape(string input)
 {
     return(CommonV5.JavascriptEscape(input));
 }
コード例 #8
0
ファイル: DataV5Base.cs プロジェクト: osoftware/Swarmops
 protected static AuthenticationData GetAuthenticationDataAndCulture()
 {
     return(CommonV5.GetAuthenticationDataAndCulture(HttpContext.Current));
 }
コード例 #9
0
ファイル: ControlV5Base.cs プロジェクト: osoftware/Swarmops
 protected string JavascriptEscape(string input)
 {
     return(CommonV5.JavascriptEscape(input));
 }
コード例 #10
0
ファイル: ControlV5Base.cs プロジェクト: osoftware/Swarmops
 protected override void OnInit(EventArgs e)
 {
     this._authority = CommonV5.InitAuthority();
     base.OnInit(e);
 }