예제 #1
0
        public string GetNavigationMenu()
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            if (UserInfo.GetUserInfo() == null)
            {
                result.Add("resultcode", "error");
                result.Add("error", "invalid user");
                return(JsonConvert.SerializeObject(result));
            }

            result.Add("resultcode", "success");
            result.Add("navigation", new TUINavigation().LoadNavigationUI());

            string assistant = String.Empty;

            if (assistant == String.Empty)
            {
                assistant = TSettingsWebConnector.GetSetupAssistant();
            }

            if (assistant == String.Empty)
            {
                assistant = TMaintenanceWebConnector.GetSelfServiceAssistant();
            }

            if (assistant == String.Empty)
            {
                assistant = TGLSetupWebConnector.GetLedgerSetupAssistant();
            }

            result.Add("assistant", assistant);

            return(JsonConvert.SerializeObject(result));
        }
예제 #2
0
        public bool SetInitialSysadminEmail(string AEmailAddress, string AFirstName, string ALastName, string ALanguageCode, string AAuthToken)
        {
            bool result = true;

            string requiredToken = TAppSettingsManager.GetValue("AuthTokenForInitialisation");

            if ((AAuthToken != requiredToken) || (requiredToken == String.Empty))
            {
                return(false);
            }

            string UserEmailAddress = String.Empty;
            string UserID           = String.Empty;

            UserInfo.SetUserInfo(new TPetraPrincipal("SYSADMIN"));

            if (TMaintenanceWebConnector.SetInitialSysadminEmail(AEmailAddress, AFirstName, ALastName, ALanguageCode))
            {
                // create unprivileged user as well
                if (AEmailAddress.Contains("+sysadmin@"))
                {
                    string InitialModulePermissions;
                    Int64  SiteKey;
                    string InitialPassword;
                    string FirstName;
                    string LastName;
                    string LanguageCode;

                    result = TSettingsWebConnector.GetDefaultsForFirstSetup(
                        ALanguageCode,
                        out UserID,
                        out FirstName,
                        out LastName,
                        out LanguageCode,
                        out UserEmailAddress,
                        out InitialModulePermissions,
                        out InitialPassword,
                        out SiteKey);

                    if (result)
                    {
                        TVerificationResultCollection VerificationResult;
                        result = TSettingsWebConnector.RunFirstSetup(
                            UserID,
                            FirstName,
                            LastName,
                            LanguageCode,
                            UserEmailAddress,
                            InitialModulePermissions.Split(',').ToList(),
                            "",
                            SiteKey,
                            false,
                            out VerificationResult);
                    }
                }

                if (result)
                {
                    return(TMaintenanceWebConnector.SendWelcomeEmail(AEmailAddress, UserEmailAddress, UserID, AFirstName, ALastName, ALanguageCode));
                }
            }

            return(false);
        }