gen3authz 2.2.0__tar.gz → 2.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: gen3authz
3
- Version: 2.2.0
3
+ Version: 2.3.0
4
4
  Summary: Gen3 authz client
5
5
  License: Apache-2.0
6
6
  Author: CTDS UChicago
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "gen3authz"
3
- version = "2.2.0"
3
+ version = "2.3.0"
4
4
  description = "Gen3 authz client"
5
5
  authors = ["CTDS UChicago <cdis@uchicago.edu>"]
6
6
  license = "Apache-2.0"
@@ -846,14 +846,18 @@ class BaseArboristClient(AuthzClient):
846
846
  return True
847
847
 
848
848
  @maybe_sync
849
- async def grant_bulk_user_policy(self, username, policy_ids):
849
+ async def grant_bulk_user_policy(self, username, policy_ids, expires_at=None):
850
850
  """
851
851
  MUST be user name, and not serial user ID
852
852
  """
853
853
  url = self._user_url + "/{}/bulk/policy".format(quote(username))
854
854
  request = []
855
855
  for policy_id in policy_ids:
856
- request.append({"policy": policy_id})
856
+ policy_request = {"policy": policy_id}
857
+ if expires_at is not None:
858
+ expires = datetime.datetime.utcfromtimestamp(expires_at)
859
+ policy_request["expires_at"] = expires.isoformat() + "Z"
860
+ request.append(policy_request)
857
861
  response = await self.post(url, json=request, expect_json=False)
858
862
  if response.code != 204:
859
863
  self.logger.error(
File without changes
File without changes