예제 #1
0
def org_connect(config, org_name, sandbox, login_url, default, global_org):
    config.check_org_overwrite(org_name)

    try:
        connected_app = config.keychain.get_service("connected_app")
    except ServiceNotConfigured as e:
        raise ServiceNotConfigured(
            "Connected App is required but not configured. " +
            "Configure the Connected App service:\n" +
            "http://cumulusci.readthedocs.io/en/latest/" +
            "tutorial.html#configuring-the-project-s-connected-app")
    if sandbox:
        login_url = "https://test.salesforce.com"

    oauth_capture = CaptureSalesforceOAuth(
        client_id=connected_app.client_id,
        client_secret=connected_app.client_secret,
        callback_url=connected_app.callback_url,
        auth_site=login_url,
        scope="web full refresh_token",
    )
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict, org_name)
    org_config.load_userinfo()

    config.keychain.set_org(org_config, global_org)

    if default:
        org = config.keychain.set_default_org(org_name)
        click.echo("{} is now the default org".format(org_name))
예제 #2
0
def org_connect(config, org_name, sandbox, login_url, default, global_org):
    config.check_org_overwrite(org_name)

    connected_app = config.keychain.get_service("connected_app")
    if sandbox:
        login_url = "https://test.salesforce.com"

    oauth_capture = CaptureSalesforceOAuth(
        client_id=connected_app.client_id,
        client_secret=connected_app.client_secret,
        callback_url=connected_app.callback_url,
        auth_site=login_url,
        scope="web full refresh_token",
    )
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict, org_name)
    org_config.load_userinfo()
    org_config._load_orginfo()
    if org_config.organization_sobject["TrialExpirationDate"] is None:
        org_config.config["expires"] = "Persistent"
    else:
        org_config.config["expires"] = parse_api_datetime(
            org_config.organization_sobject["TrialExpirationDate"]).date()

    config.keychain.set_org(org_config, global_org)

    if default:
        config.keychain.set_default_org(org_name)
        click.echo(f"{org_name} is now the default org")
예제 #3
0
 def _create_oauth(self):
     return CaptureSalesforceOAuth(
         self.client_id,
         self.client_secret,
         self.callback_url,
         self.auth_site,
         self.scope,
     )
예제 #4
0
def org_connect(config, org_name, sandbox, login_url, global_org):
    check_connected_app(config)

    connected_app = config.keychain.get_connected_app()
    if sandbox:
        login_url = 'https://test.salesforce.com'

    oauth_capture = CaptureSalesforceOAuth(
        client_id = connected_app.client_id,
        client_secret = connected_app.client_secret,
        callback_url = connected_app.callback_url,
        auth_site = login_url,
        scope = 'web full refresh_token'
    )
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict)

    config.keychain.set_org(org_name, org_config, global_org)
예제 #5
0
def org_connect(config, org_name, sandbox, login_url, default, global_org):
    check_connected_app(config)

    connected_app = config.keychain.get_connected_app()
    if sandbox:
        login_url = 'https://test.salesforce.com'

    oauth_capture = CaptureSalesforceOAuth(
        client_id=connected_app.client_id,
        client_secret=connected_app.client_secret,
        callback_url=connected_app.callback_url,
        auth_site=login_url,
        scope='web full refresh_token')
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict)
    org_config.load_userinfo()

    config.keychain.set_org(org_name, org_config, global_org)

    if default:
        org = config.keychain.set_default_org(org_name)
        click.echo('{} is now the default org'.format(org_name))
예제 #6
0
def org_connect(config, org_name, sandbox, login_url, default, global_org):
    config.check_org_overwrite(org_name)

    connected_app = config.keychain.get_service("connected_app")
    if sandbox:
        login_url = "https://test.salesforce.com"

    oauth_capture = CaptureSalesforceOAuth(
        client_id=connected_app.client_id,
        client_secret=connected_app.client_secret,
        callback_url=connected_app.callback_url,
        auth_site=login_url,
        scope="web full refresh_token",
    )
    oauth_dict = oauth_capture()
    org_config = OrgConfig(oauth_dict, org_name)
    org_config.load_userinfo()

    config.keychain.set_org(org_config, global_org)

    if default:
        config.keychain.set_default_org(org_name)
        click.echo("{} is now the default org".format(org_name))