Skip to content

Commit 1698a73

Browse files
committed
Merge branch 'issue95' into v2. No conflicts.
With this merge, v2 has all the latest work from master, v1, and issue95. Devs should base all their new branches off of v2, and existing branches should be rebased against the tip of v2 so they can be merged back into v2 when the work is done. This may be a tricky rebase/merge to do, because v2 and v1 have diverged widely with the issue95 work.
2 parents cffc200 + 6df3e74 commit 1698a73

26 files changed

+1410
-1360
lines changed

README.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ To set up PyCharm for debugging,
6262
# Basic Usage
6363

6464
```
65-
Adobe Enterprise Dashboard User Sync
65+
User Sync from Adobe
6666
6767
optional arguments:
6868
-h, --help show this help message and exit
@@ -127,10 +127,4 @@ optional arguments:
127127

128128
# Configuration
129129

130-
See `examples/example.user-sync-config.yml` for the main configuration template. The main configuration file user-sync-config.yml must exist in the configuration path.
131-
132-
See `examples/example.dashboard-config.yml` for the dashboard configuration template. The tool would try and find dashboard-owning-config.yml in the configuration path.
133-
134-
See `examples/example.connector-ldap.yml` for the ldap configuration template. The main configuration file can be configured to reference this file.
135-
136-
130+
See the `examples` directory for sample confguration files of all types.

examples/config files - basic/1 user-sync-config.yml

Lines changed: 199 additions & 98 deletions
Large diffs are not rendered by default.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This is a sample configuration file for the umapi connector type.
2+
#
3+
# umapi (user management api) is a network protocol served by Adobe that
4+
# provides management of users in Adobe-hosted enterprise organizations.
5+
#
6+
# This sample file contains all of the settable options for this protocol.
7+
# All of the settings here can be changed. It is recommended
8+
# that you make a copy of this file and edit that to match your configuration.
9+
# While you are at it, you will likely want to remove a lot of this commentary,
10+
# in order to enhance the readability of your file.
11+
12+
# (optional) UMAPI server settings (defaults as shown)
13+
# These settings specify how to contact the Adobe servers which
14+
# host the UMAPI services and those which provide authorization.
15+
# You will never need to alter these settings unless you are provided
16+
# alternate values as part of a pilot program with Adobe. It is
17+
# highly recommended that you leave these values commented out
18+
# so that the default values are guaranteed to be used.
19+
server:
20+
#host: usermanagement.adobe.io
21+
#endpoint: /v2/usermanagement
22+
#ims_host: ims-na1.adobelogin.com
23+
#ims_endpoint_jwt: /ims/exchange/jwt
24+
25+
# (required) enterprise organization settings
26+
# You must specify all five of these settings. Consult the
27+
# Adobe UMAPI documentation and the Adobe I/O Console to determine
28+
# the correct settings for your enterprise organization.
29+
# [NOTE: the priv_key_path setting can be an absolute or relative pathname;
30+
# if relative, it is interpreted relative to this configuration file.]
31+
enterprise:
32+
org_id: "Org ID goes here"
33+
api_key: "API key goes here"
34+
client_secret: "Client secret goes here"
35+
tech_acct: "Tech account ID goes here"
36+
priv_key_path: "path/to/private/key/file"

examples/config files - basic/2 dashboard-config.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 117 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,124 @@
1-
username: "LDAP user goes here"
1+
# This is a sample configuration file for the ldap connector type.
2+
#
3+
# ldap (lightweight directory access protocol) is a network protocol used by
4+
# most enterprise directory systems (including Active Directory from Microsoft).
5+
#
6+
# This sample file contains all of the settable options for this protocol.
7+
# There is tremendous variation in the user object structure and attribute
8+
# value structure among LDAP directories even within a single enterprise, so
9+
# you will likely have to adapt the value specified here to match those in
10+
# use in your situation. All of the settings here can be changed, and
11+
# many do not have default values and so are required. It is recommended
12+
# that you make a copy of this file and edit that to match your configuration.
13+
# While you are at it, you will likely want to remove a lot of this commentary,
14+
# in order to enhance the readability of your file.
15+
16+
# connection settings (required)
17+
# You must specify all four of these settings. Consult with your
18+
# enterprise directory administrators to get suitable values.
19+
# You may want to specify these connection settings in a separate file
20+
# from the rest of your settings, so as to guard your credential more
21+
# securely than your other configuration values. See the User Sync
22+
# documentation for an explanation of how to do this.
23+
username: "LDAP username goes here"
224
password: "LDAP password goes here"
325
host: "LDAP host URL goes here. e.g. ldap://ldap.example.com"
426
base_dn: "defines the base DN. e.g. DC=example,DC=com"
527

6-
# specifies the string format used to construct a group query.
7-
# {group} is replaced with the name of the group to find. Default is:
8-
# group_filter_format: "(&(|(objectCategory=group)(objectClass=groupOfNames)(objectClass=posixGroup))(cn={group}))"
9-
#
10-
# example for AD
11-
# group_filter_format: "(&(objectCategory=group)(cn={group}))"
12-
#
13-
# example for OpenLDAP
14-
# group_filter_format: "(&(objectClass=groupOfNames)(objectClass=posixGroup)(cn={group}))"
28+
# (optional) user_identity_type (default is inherited from main configuration)
29+
# user_identity_type specifies a default identity type for when directory users
30+
# are created on the Adobe side (one of adobeID, enterpriseID, federatedID).
31+
# This overrides the exact same setting in the top-level user sync configuration
32+
# file, and if not specified here the value set or default there is used as
33+
# the default value for this connection. To set an override, uncomment this setting.
34+
#user_identity_type: enterpriseID
1535

16-
# specifies the string filter used to find all users in the directory.
17-
# Default, intending for AD, is:
18-
# all_users_filter: "(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"
19-
#
20-
# example for OpenLDAP
21-
# all_users_filter: "(&(objectClass=person)(objectClass=top))"
36+
# (optional) search_page_size (default value given below)
37+
# search_page_size specifies the result page size requested when
38+
# fetching values from the directory.
39+
search_page_size: 200
40+
41+
# (optional) require_tls_cert (default value given below)
42+
# require_tls_cert forces the ldap connection to use TLS security with cerficate
43+
# validation. Allowed values are True (require) or False (don't require).
44+
require_tls_cert: False
2245

23-
# specifies how an email address is retrieved in the system.
24-
# the string is a string format, with names enclosed by curly brackets replaced
25-
# by the corresponding attributes for a user. Default is:
26-
# user_email_format: "{mail}"
46+
# (optional) all_users_filter (default value given below)
47+
# all_users_filter specifies the query used to find all users in the directory.
48+
# The default value specified here is appropriate for Active Directory, which has a
49+
# special field that is used to enable and disable users. The value for OpenLDAP
50+
# directories might be much simpler: "(&(objectClass=person)(objectClass=top))"
51+
all_users_filter: "(&(objectClass=user)(objectCategory=person)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"
52+
53+
# (optional) group_filter_format (default value given below)
54+
# group_filter_format specifies the format string used to construct a group query,
55+
# as needed by the --users groups or --users mapped command-line arguments.
56+
# {group} is replaced with the name of the group to find. The default value here is
57+
# complex, because it's meant to work for both AD-style and OpenLDAP-style directories.
58+
# You will likely want to replace it with a simpler query customized for your directory,
59+
# such as this one for Active Directory: "(&(objectCategory=group)(cn={group}))"
60+
# or this one for OpenLDAP: "(&(|(objectClass=groupOfNames)(objectClass=posixGroup))(cn={group}))"
61+
group_filter_format: "(&(|(objectCategory=group)(objectClass=groupOfNames)(objectClass=posixGroup))(cn={group}))"
62+
63+
# (optional) user_identity_type_format (no default)
64+
# user_identity_type_format specifies how to construct a user's desired identity
65+
# type on the Adobe side by combining constant strings with attribute values.
66+
# Any names in curly braces are take as attribute names, and everything including
67+
# the braces will be replaced on a per-user basis with the values of the attributes.
68+
# There is no default value for this setting, because most directories don't contain
69+
# users with different identity types (so setting the default identity type suffices).
70+
# If your directory contains users of different identity types, you should define
71+
# this field to look at the value of an appropriate attribute in your directory.
72+
# For example, if your directory attribute "idType" had one of the values
73+
# adobe, enterprise, or federated in it for each user, you could use:
74+
#user_identity_type_format: "{idType}ID"
75+
76+
# (optional) user_email_format (default value given below)
77+
# user_email_format specifies how to construct a user's email address by
78+
# combining constant strings with the values of specific directory attributes.
79+
# Any names in curly braces are take as attribute names, and everything including
80+
# the braces will be replaced on a per-user basis with the values of the attributes.
81+
# The default value used here is simple, and suitable for OpenLDAP systems. If you
82+
# are using a non-email-aware AD system, which holds the username separately
83+
# from the domain name, you may want: "{sAMAccountName}@mydomain.com"
84+
user_email_format: "{mail}"
85+
86+
# (optional) user_domain_format (no default value)
87+
# user_domain_format is analogous to user_email_format in syntax, but it
88+
# is used to discover the domain for a given user. If not specified, the
89+
# domain is taken from the domain part of the user's email address.
90+
#user_domain_format: "{domain}"
91+
92+
# (optional) user_username_format (no default value)
93+
# user_username_format specifies how to construct a user's username on the
94+
# Adobe side by combining contstant strings with attribute values.
95+
# Any names in curly braces are take as attribute names, and everything including
96+
# the braces will be replaced on a per-user basis with the values of the attributes.
97+
# This setting should only be used when you are using federatedID and your
98+
# federation configuration specifies username-based login. In all other cases,
99+
# make sure this is not set or returns an empty value, and the user's username
100+
# will be taken from the user's email.
101+
# This example supposes that the department and user_id are concatenated to
102+
# produce a unique username for each user.
103+
#user_username_format: "{department}_{user_id}"
104+
105+
# Some additional info about LDAP connectors:
106+
#
107+
# Unlike the CSV connector, the LDAP connector does not have custom specifications
108+
# for how to construct user first names, last names, or country codes from the
109+
# values of different attributes. That's because the LDAP protocol specifies
110+
# pre-defined aliases for a large number of typical attribute values, so there
111+
# are already pre-defined attribute names that are used for these fields:
112+
# - the Adobe first name is set from the LDAP "givenName" attribute
113+
# - the Adobe last name is set from the LDAP "sn" (surname) attribute
114+
# - the Adobe country is set from the LDAP "country" attribute
115+
# If you need to override these values on the Adobe side, you can use the
116+
# custom extension mechanism (see the docs) to compute and set field values
117+
# by combining these and any other custom attributes needed. Seed the
118+
# User Sync documentation for full details.
27119
#
28-
# other example:
29-
# user_email_format: "{sAMAccountName}@example.com"
30-
31-
# specifies the identity type of the dashboard user to create.
32-
# the valid values are: enterpriseID, federatedID
33-
#
34-
# If not specified, the default identity type from the main config file is used.
35-
#
36-
# example for enterprise ID:
37-
# user_identity_type: enterpriseID
38-
39-
# specifies the result page size. Default is:
40-
# search_page_size: 200
41-
42-
# set to True if you want to validate SSL cert. Default is:
43-
# require_tls_cert: False
44-
45-
# Definition of where in the directory to get the domain if that information
46-
# is in a non-standard place. The value can be a fixed string and/or one or
47-
# more directory attribute names enclosed in curly braces.
48-
# user_domain_format: {domain}
49-
50-
# Definition of where in the directory to get the user name for a federated
51-
# domain using username-based login. The value can be a string and/or one or
52-
# more directory attribute names enclosed in curly braces. For example,
53-
# user_username_format: {user_id}_{department}
120+
# Finally, some LDAP systems use uids to identify groups, and place users in
121+
# groups via uid rather than name. The User Sync implementation always reads
122+
# the uid attribute on all objects if the directory provides one, so it is
123+
# able to handle directories which function in this way even though the
124+
# configuration files always specify groups by name.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This is a sample configuration file for the csv connector type.
2+
#
3+
# CSV (Comma-Separated Values) is a plain-text spreadsheet format.
4+
# The main function of this configuration file is to specify how column names
5+
# in the spreadsheet are mapped to attribute names in the customer directory.
6+
#
7+
# The first line of a CSV file is assumed to be header row with column names.
8+
# The column names in your spreadsheet can be in any order, and if there are
9+
# fewer values in a row than there are in the header row, the attributes
10+
# for the missing columns are given no value.
11+
#
12+
# This sample file contains all of the settable options for this format,
13+
# with each set to its default value. If the defaults are fine for your
14+
# application, you can use a copy of this file as-is, or you can omit the csv
15+
# setting from the connectors in your main User Sync configuration file.
16+
17+
# (optional) delimiter (no default value)
18+
# The delimiter is the string that separates columns. Normally,
19+
# this is detected automatically from the first line in the file.
20+
# To set it to a specific value, uncomment this setting:
21+
#delimiter: ","
22+
23+
# (optional) email_column_name (default "email")
24+
# The column name that contains the user's email address.
25+
# Values in this column must be valid, unquoted email addresses.
26+
# A value is required in this column for all users, regardless
27+
# of their identity type. For Adobe ID users, all of the other
28+
# column values are ignored. For Enterprise and Federated ID
29+
# users, all of the other column values are significant.
30+
email_column_name: email
31+
32+
# (optional) first_name_column_name (default "firstname")
33+
# The column name that contains the user's first name (aka given name).
34+
# Values in this column can be any string
35+
first_name_column_name: firstname
36+
37+
# (optional) last_name_column_name (default "lastname")
38+
# The column name that contains the user's last name (aka surname).
39+
# Values in this column can be any string
40+
last_name_column_name: lastname
41+
42+
# (optional) country_column_name (default "country")
43+
# The column name that contains the user's home country.
44+
# Values in this column must be an ISO-3166 two-letter country code.
45+
country_column_name: country
46+
47+
# (optional) groups_column_name (default "groups")
48+
# The column name that contains the user's group memberships.
49+
# Values in this column must be a comma-separated list of group names.
50+
# NOTE: Since commas usually separate columns, be sure to surround the
51+
# entire column value with double quotes, to prevent any embedded commas
52+
# from being interpreted as column separators.
53+
groups_column_name: groups
54+
55+
# (optional) identity_type_column_name (default "type")
56+
# The column name that contains the user's identity type.
57+
# Values in this column must be adobeID, enterpriseID, or FederatedID.
58+
identity_type_column_name: type
59+
60+
# (optional) username_column_name (default "username")
61+
# The column name that contains the user's username (for the Adobe side).
62+
# Values in this column should not be specified unless the user is of type federatedID
63+
# and the user's domain is configured for username-based federation. In all other
64+
# cases, leave this column blank, and the email will be used for the username.
65+
username_column_name: username
66+
67+
# (optional) domain_column_name (default "domain")
68+
# The column name that contains the user's domain.
69+
# Values in this column should not be specified unless the user is of type federatedID,
70+
# the user's domain is configured for username-based federation, and there is a value
71+
# in the username field. If this field is left blank, the domain part of the email
72+
# address will be used for the user's domain.
73+
domain_column_name: domain

examples/config files - basic/4 connector-ldap-source-filter.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This is a sample configuration file for a user extension.
2+
#
3+
# This file extends the behavior specified in your main configuration file,
4+
# by adding custom python code to the logic for attribute and group mapping
5+
# which is specified in the directory_users section.
6+
#
7+
# To load your extension file, put the file's relative or absolute path
8+
# as the value of the extension setting in the directory_users section
9+
# of your main configuration file.
10+
11+
# (optional) extended_attributes (default value is an empty list)
12+
# extended_attributes is a list of attribute names whose per-user
13+
# values are required by your extension in order to function properly.
14+
# These attributes will be read on a per-user basis, and will be available
15+
# in the source_attributes dictionary in your after_mapping_hook. Any
16+
# of these attributes which don't have a value in the directory entry for
17+
# a given user will have a Python None value in that user's dictionary.
18+
extended_attributes:
19+
- bc
20+
- subco
21+
22+
# (optional) extended_adobe_groups (default value is an empty list)
23+
# extended_adobe_groups is a list of Adobe-side product configuration
24+
# and/or user group names, exactly like those found in the groups
25+
# setting in the main configuration file. Your after_mapping_hook
26+
# can add users to any product configuration or user group found here
27+
# as well as any found in the groups setting, and the effect of the
28+
# --process-groups argument will treat them exactly as if the
29+
# extended mapping had been specified as part of the groups setting.
30+
extended_adobe_groups:
31+
- Company 1 Users
32+
- Company 2 Users
33+
34+
# (required) after_mapping_hook
35+
# This is where you specify your Python hook code. Note the vertical bar
36+
# after the after_mapping_hook label: this vertical bar is required and
37+
# denotes that all the following indented lines up to the next blank
38+
# line are part of a code block. Do not have blank lines in your code block.
39+
#
40+
# after_mapping_hook code executes in a scope containing the following variables:
41+
#
42+
# source_attributes # in: attributes retrieved from customer directory system (eg 'c', 'givenName')
43+
# # out: N/A
44+
# source_groups # in: customer-side directory groups found for user
45+
# # out: N/A
46+
# target_attributes # in: user's attributes for UMAPI calls as defined by usual rules (eg 'country', 'firstname')
47+
# # out: user's attributes for UMAPI calls as potentially changed by hook code
48+
# target_groups # in: Adobe-side dashboard groups mapped for user by usual rules
49+
# # out: Adobe-side dashboard groups as potentially changed by hook code
50+
# hook_storage # for exclusive use by hook code: initialized to None; persists across per-user calls
51+
# logger # an object of type logging.logger which outputs to the console and/or file log
52+
#
53+
after_mapping_hook: |
54+
bc = source_attributes.get('bc')
55+
subco = source_attributes.get('subco')
56+
if bc is not None:
57+
target_attributes['country'] = bc[0:2]
58+
if subco == 'Company 1':
59+
target_groups.add('Company 1 Users')
60+
elif subco == 'Company 2':
61+
target_groups.add('Company 2 Users')

0 commit comments

Comments
 (0)