Skip to content

Commit

Permalink
use custom_role_mapping_name instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmauer committed May 31, 2024
1 parent 5c9ab64 commit 3dbd5c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions propelauth_py/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def create_org(
members_must_have_matching_domain=False,
domain=None,
max_users=None,
custom_role_mapping_id=None,
custom_role_mapping_name=None,
):
return _create_org(
auth_url,
Expand All @@ -395,7 +395,7 @@ def create_org(
members_must_have_matching_domain,
domain,
max_users,
custom_role_mapping_id,
custom_role_mapping_name,
)

def update_org_metadata(
Expand All @@ -421,12 +421,12 @@ def update_org_metadata(
domain=domain,
)

def subscribe_org_to_role_mapping(org_id, custom_role_mapping_id):
def subscribe_org_to_role_mapping(org_id, custom_role_mapping_name):
return _subscribe_org_to_role_mapping(
auth_url,
integration_api_key,
org_id,
custom_role_mapping_id,
custom_role_mapping_name,
)

def delete_org(org_id):
Expand Down
10 changes: 5 additions & 5 deletions propelauth_py/api/org.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _create_org(
members_must_have_matching_domain=False,
domain=None,
max_users=None,
custom_role_mapping_id=None,
custom_role_mapping_name=None,
):
url = auth_url + f"{ENDPOINT_PATH}/"
json = {
Expand All @@ -102,8 +102,8 @@ def _create_org(
json["domain"] = domain
if max_users is not None:
json["max_users"] = max_users
if custom_role_mapping_id is not None:
json["custom_role_mapping_id"] = custom_role_mapping_id
if custom_role_mapping_name is not None:
json["custom_role_mapping_name"] = custom_role_mapping_name

response = requests.post(url, json=json, auth=_ApiKeyAuth(integration_api_key))
if response.status_code == 401:
Expand Down Expand Up @@ -250,14 +250,14 @@ def _subscribe_org_to_role_mapping(
auth_url,
integration_api_key,
org_id,
custom_role_mapping_id,
custom_role_mapping_name,
):
if not _is_valid_id(org_id):
return False

url = auth_url + f"{ENDPOINT_PATH}/{org_id}"
json = {
"custom_role_mapping_id": custom_role_mapping_id,
"custom_role_mapping_name": custom_role_mapping_name,
}

response = requests.put(url, json=json, auth=_ApiKeyAuth(integration_api_key))
Expand Down

0 comments on commit 3dbd5c5

Please sign in to comment.