-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ministryofjustice/rbac-uplift
Rbac uplift
- Loading branch information
Showing
13 changed files
with
405 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
import click | ||
from cli import ldap | ||
import cli.ldap.add_roles_to_username, cli.ldap.rbac | ||
|
||
from cli import git | ||
import cli.env | ||
|
||
|
||
@click.group() | ||
def main_group(): | ||
pass | ||
|
||
|
||
@click.command() | ||
@click.option("--user-ou", help="OU to add users to, defaults to ou=Users", default="ou=Users") | ||
@click.option("--root-dn", help="Root DN to add users to", default="dc=moj,dc=com") | ||
@click.argument("user-role-list", required=True) | ||
def add_roles_to_users(user_ou, root_dn, user_role_list): | ||
ldap.process_user_roles_list(user_role_list, user_ou, root_dn) | ||
cli.ldap.add_roles_to_username.process_user_roles_list(user_role_list, user_ou, root_dn) | ||
|
||
|
||
@click.command() | ||
def git_test(): | ||
git.dl_test() | ||
@click.option("--rbac-repo-tag", help="RBAC repo tag to use", default="master") | ||
def rbac_uplift(rbac_repo_tag): | ||
cli.ldap.rbac.main(rbac_repo_tag) | ||
|
||
|
||
# from cli.ldap import test | ||
|
||
main_group.add_command(add_roles_to_users) | ||
main_group.add_command(git_test) | ||
main_group.add_command(rbac_uplift) | ||
|
||
if __name__ == "__main__": | ||
main_group() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import os | ||
|
||
from dotenv import dotenv_values | ||
|
||
import ast | ||
|
||
# ldap_host = os.getenv("LDAP_HOST") | ||
# ldap_user = os.getenv("LDAP_USER") | ||
# ldap_password = os.getenv("LDAP_PASSWORD") | ||
# db_user = os.getenv("DB_USER") | ||
# db_password = os.getenv("DB_PASSWORD") | ||
# db_host = os.getenv("DB_HOST") | ||
# db_port = os.getenv("DB_PORT") | ||
# db_service_name = os.getenv("DB_SERVICE_NAME") | ||
# gh_app_id = os.getenv("GH_APP_ID") | ||
# gh_private_key = os.getenv("GH_PRIVATE_KEY") | ||
# gh_installation_id = os.getenv("GH_INSTALLATION_ID") | ||
|
||
|
||
vars = { | ||
**{ | ||
key.replace("VAR_", "").replace("_DICT", ""): ast.literal_eval(val) if "DICT" in key else val | ||
for key, val in dotenv_values(".vars").items() | ||
if val is not None | ||
}, # load development variables | ||
**{ | ||
key.replace("VAR_", "").replace("_DICT", ""): ast.literal_eval(val) if "DICT" in key else val | ||
for key, val in os.environ.items() | ||
if key.startswith("VAR_") and val is not None | ||
}, | ||
} | ||
# loads all environment variables starting with SECRET_ into a dictionary | ||
secrets = { | ||
**{ | ||
key.replace("SECRET_", "").replace("_DICT", "").replace("SSM_", ""): ast.literal_eval(val) | ||
if "_DICT" in key | ||
else val | ||
for key, val in dotenv_values(".secrets").items() | ||
if val is not None | ||
}, | ||
**{ | ||
key.replace("SECRET_", "").replace("_DICT", "").replace("SSM_", ""): ast.literal_eval(val) | ||
if "DICT" in key | ||
else val | ||
for key, val in os.environ.items() | ||
if key.startswith("SECRET_") or key.startswith("SSM_") and val is not None | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.