Merge pull request #173 from robandpdx/emu-shortcode
Support emu accounts by adding EMU_SHORTCODE env var
This commit is contained in:
Коммит
b3afb53dd1
|
@ -67,6 +67,8 @@ OKTA_PRIVATE_KEY='{"kty": "RSA", ...}'
|
|||
## Who to assign the issues to
|
||||
#ISSUE_ASSIGNEE=githubber
|
||||
## Sync schedule, cron style schedule
|
||||
## Shortcode for emu accounts
|
||||
#EMU_SHORTCODE=volcano
|
||||
|
||||
## Default (hourly): 0 * * * *
|
||||
SYNC_SCHEDULE=0 * * * *
|
||||
|
|
|
@ -197,6 +197,7 @@ ISSUE_ASSIGNEE=githubber
|
|||
SYNC_SCHEDULE=0 * * * *
|
||||
TEST_MODE=false
|
||||
SYNCMAP_ONLY=false
|
||||
EMU_SHORTCODE=volcano
|
||||
|
||||
### Automatically add users missing from the organization
|
||||
ADD_MEMBER=false
|
||||
|
|
|
@ -108,6 +108,8 @@ class AzureAD:
|
|||
username = user_info[self.USERNAME_ATTRIBUTE]
|
||||
if self.AZURE_USER_IS_UPN:
|
||||
username = username.split("@")[0]
|
||||
if "EMU_SHORTCODE" in os.environ:
|
||||
username = username + "_" + os.environ["EMU_SHORTCODE"]
|
||||
user = {
|
||||
"username": username,
|
||||
"email": user_info["mail"],
|
||||
|
|
|
@ -105,7 +105,8 @@ class LDAPClient:
|
|||
).casefold()
|
||||
else:
|
||||
email = None
|
||||
|
||||
if "EMU_SHORTCODE" in os.environ:
|
||||
username = username + "_" + os.environ["EMU_SHORTCODE"]
|
||||
user_info = {"username": username, "email": email}
|
||||
member_list.append(user_info)
|
||||
except Exception as e:
|
||||
|
|
|
@ -70,6 +70,8 @@ class Okta:
|
|||
username = getattr(user.profile, self.USERNAME_ATTRIBUTE)
|
||||
username = username.split("@")[0]
|
||||
username = re.sub("[^0-9a-zA-Z-]+", "-", username)
|
||||
if "EMU_SHORTCODE" in os.environ:
|
||||
username = username + "_" + os.environ["EMU_SHORTCODE"]
|
||||
member_list.append(
|
||||
{
|
||||
"username": username,
|
||||
|
|
|
@ -20,6 +20,10 @@ class OneLogin:
|
|||
role = self.client.get_roles(query_parameters={"name": group_name})
|
||||
users = self.client.get_users(query_parameters={"role_id": role[0].id})
|
||||
for user in users:
|
||||
member_list.append({"username": user.username, "email": user.email})
|
||||
if "EMU_SHORTCODE" in os.environ:
|
||||
username = user.username + "_" + os.environ["EMU_SHORTCODE"]
|
||||
else:
|
||||
username = user.username
|
||||
member_list.append({"username": username, "email": user.email})
|
||||
|
||||
return member_list
|
||||
|
|
Загрузка…
Ссылка в новой задаче