Merge branch 'main' into ldap-tls
This commit is contained in:
Коммит
46eea47c89
|
@ -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 * * * *
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: "CodeQL analysis"
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Current File",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${file}",
|
||||
"console": "integratedTerminal",
|
||||
"justMyCode": true
|
||||
}
|
||||
]
|
||||
}
|
2
Pipfile
2
Pipfile
|
@ -7,7 +7,7 @@ verify_ssl = true
|
|||
pytest = "*"
|
||||
pytest-mock = "*"
|
||||
isort = "*"
|
||||
black = "==21.11b1"
|
||||
black = "*"
|
||||
pre-commit = "*"
|
||||
pylint = "*"
|
||||
seed-isort-config = "*"
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
17
README.md
17
README.md
|
@ -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
|
||||
|
@ -204,6 +205,22 @@ ADD_MEMBER=false
|
|||
REMOVE_ORG_MEMBERS_WITHOUT_TEAM=false
|
||||
```
|
||||
|
||||
### Sample `.env` setting for flask app
|
||||
```env
|
||||
####################
|
||||
## Flask Settings ##
|
||||
####################
|
||||
## Default: app, comment out to run once as a script
|
||||
FLASK_APP=app
|
||||
## Default: production
|
||||
FLASK_ENV=development
|
||||
## Default: 5000
|
||||
FLASK_RUN_PORT=5000
|
||||
## Default: 127.0.0.1
|
||||
FLASK_RUN_HOST=0.0.0.0
|
||||
|
||||
```
|
||||
|
||||
### Sample `syncmap.yml` custom mapping file
|
||||
```yaml
|
||||
---
|
||||
|
|
16
app.py
16
app.py
|
@ -382,11 +382,15 @@ def get_directory_from_slug(slug, custom_map, org):
|
|||
return custom_map[slug]
|
||||
|
||||
|
||||
thread = threading.Thread(target=sync_all_teams)
|
||||
thread.start()
|
||||
if "FLASK_APP" in os.environ:
|
||||
thread = threading.Thread(target=sync_all_teams)
|
||||
thread.start()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(
|
||||
host=os.environ.get("FLASK_RUN_HOST", "0.0.0.0"),
|
||||
port=os.environ.get("FLASK_RUN_PORT", "5000"),
|
||||
)
|
||||
if "FLASK_APP" in os.environ:
|
||||
app.run(
|
||||
host=os.environ.get("FLASK_RUN_HOST", "0.0.0.0"),
|
||||
port=os.environ.get("FLASK_RUN_PORT", "5000"),
|
||||
)
|
||||
else:
|
||||
sync_all_teams()
|
||||
|
|
|
@ -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"],
|
||||
|
|
|
@ -131,7 +131,10 @@ 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:
|
||||
|
|
|
@ -69,7 +69,9 @@ class Okta:
|
|||
try:
|
||||
username = getattr(user.profile, self.USERNAME_ATTRIBUTE)
|
||||
username = username.split("@")[0]
|
||||
username = re.sub('[^0-9a-zA-Z-]+', '-', username)
|
||||
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
|
||||
|
|
Загрузка…
Ссылка в новой задаче