From 384ea1ce0fa13a96343fe643e545df354284b83a Mon Sep 17 00:00:00 2001 From: Jordan Prescott Date: Mon, 18 Nov 2024 16:08:18 +0000 Subject: [PATCH 1/2] Added policy update to admins --- odins_spear/methods/put.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 33c9b6b..740f443 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -16,6 +16,30 @@ def session(self): #ACCOUNT AUTHORIZATION CODES #ADMINISTRATORS + + def group_admin_policies_bulk(self, user_ids: list, policy_config: dict): + """_summary_ + + Args: + user_ids (list): _description_ + + Raises: + OSInvalidWeighting: _description_ + OSInvalidCode: _description_ + + Returns: + _type_: _description_ + """ + endpoint = '/groups/admins/policies/bulk' + + data = { + 'users': [{'userId':user} for user in user_ids], + 'data': policy_config + } + + self.requester.put(endpoint, data=data) + + #ADVICE OF CHARGE #ALTERNATE NUMBERS #ANSWER CONFIRMATION From a8daf57bef10c68d174d4d937c347d85d22bf143 Mon Sep 17 00:00:00 2001 From: Jordan Prescott Date: Tue, 19 Nov 2024 10:47:03 +0000 Subject: [PATCH 2/2] Added admin policy bulk --- odins_spear/methods/post.py | 21 +++++++++++++++++++++ odins_spear/methods/put.py | 24 ------------------------ 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/odins_spear/methods/post.py b/odins_spear/methods/post.py index 5c689b0..255b08b 100644 --- a/odins_spear/methods/post.py +++ b/odins_spear/methods/post.py @@ -54,7 +54,28 @@ def group_admin(self, service_provider_id: str, group_id: str, user_id: str, pas payload["password"] = password return self.requester.post(endpoint, data=payload) + + + def group_admin_policies_bulk(self, user_ids: list, policy_config: dict): + """Applies policy settings to multiple group administrators. + + Note: See docs for formatting of parameters. + Args: + user_ids (list): User IDs of admins to apply policy to. + policy_config (dict): Policy settings to apply to target users. + + Returns: + Dict: Returns admins and policy applied. + """ + endpoint = '/groups/admins/policies/bulk' + + data = { + 'users': [{'userId':user} for user in user_ids], + 'data': policy_config + } + + self.requester.post(endpoint, data=data) #ADVICE OF CHARGE #ALTERNATE NUMBERS diff --git a/odins_spear/methods/put.py b/odins_spear/methods/put.py index 740f443..33c9b6b 100644 --- a/odins_spear/methods/put.py +++ b/odins_spear/methods/put.py @@ -16,30 +16,6 @@ def session(self): #ACCOUNT AUTHORIZATION CODES #ADMINISTRATORS - - def group_admin_policies_bulk(self, user_ids: list, policy_config: dict): - """_summary_ - - Args: - user_ids (list): _description_ - - Raises: - OSInvalidWeighting: _description_ - OSInvalidCode: _description_ - - Returns: - _type_: _description_ - """ - endpoint = '/groups/admins/policies/bulk' - - data = { - 'users': [{'userId':user} for user in user_ids], - 'data': policy_config - } - - self.requester.put(endpoint, data=data) - - #ADVICE OF CHARGE #ALTERNATE NUMBERS #ANSWER CONFIRMATION