client: if project_init.xml specifies project and account, attach to it

without involving the Manager.
This commit is contained in:
davidpanderson 2020-08-20 17:49:29 -07:00
parent ed3747db5c
commit d754c09d47
3 changed files with 19 additions and 6 deletions

View File

@ -767,6 +767,12 @@ int CLIENT_STATE::init() {
process_autologin(true);
acct_mgr_info.init();
project_init.init();
// if project_init.xml specifies an account, attach
//
if (strlen(project_init.url) && strlen(project_init.account_key)) {
add_project(project_init.url, project_init.account_key, project_init.name, false);
project_init.remove();
}
log_show_projects(); // this must follow acct_mgr_info.init()

View File

@ -285,7 +285,7 @@ bool CWizardAttach::Run(
if (m_ProjectPropertiesPage && m_ProjectInfoPage && m_ProjectWelcomePage) {
IsAttachToProjectWizard = true;
IsAccountManagerWizard = false;
if ((strProjectName.size() && strProjectURL.size())) {
if (strProjectName.size() && strProjectURL.size()) {
return RunWizard(m_ProjectWelcomePage);
} else if (strProjectURL.size() && (IsCredentialsCached() || IsCredentialsDetected())) {
return RunWizard(m_ProjectPropertiesPage);

View File

@ -69,6 +69,7 @@ UINT CACreateProjectInitFile::OnExecution()
tstring strDataDirectory;
tstring strProjectInitUrl;
tstring strProjectInitAuthenticator;
tstring project_name;
PROJECT_INIT pi;
UINT uiReturnValue = 0;
@ -78,6 +79,9 @@ UINT CACreateProjectInitFile::OnExecution()
uiReturnValue = GetProperty( _T("PROJINIT_URL"), strProjectInitUrl );
if ( uiReturnValue ) return uiReturnValue;
uiReturnValue = GetProperty(_T("PROJINIT_NAME"), project_name);
if (uiReturnValue) return uiReturnValue;
uiReturnValue = GetProperty( _T("PROJINIT_AUTH"), strProjectInitAuthenticator );
if ( uiReturnValue ) return uiReturnValue;
@ -99,7 +103,7 @@ UINT CACreateProjectInitFile::OnExecution()
if (!strProjectInitUrl.empty()) {
LogMessage(
INSTALLMESSAGE_INFO,
NULL,
NULL,
NULL,
NULL,
NULL,
@ -108,10 +112,13 @@ UINT CACreateProjectInitFile::OnExecution()
pi.init();
strncpy(pi.url, CW2A(strProjectInitUrl.c_str()), sizeof(pi.url)-1);
strncpy(pi.name, CW2A(strProjectInitUrl.c_str()), sizeof(pi.name)-1);
// Use project URL as name
// TODO: add a cmdline arg for project name
strncpy(pi.url, CW2A(strProjectInitUrl.c_str()), sizeof(pi.url) - 1);
if (!project_name.empty()) {
strncpy(pi.name, CW2A(project_name.c_str()), sizeof(pi.name) - 1);
} else {
strncpy(pi.name, CW2A(strProjectInitUrl.c_str()), sizeof(pi.name) - 1);
}
strncpy(pi.account_key, CW2A(strProjectInitAuthenticator.c_str()), sizeof(pi.account_key)-1);
pi.embedded = false;