Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Change Log (v2.8.1+)

## v4.1.3 [2025-03-07]

__What's New:__

* None

__Enhancements:__

* None

__Bug Fixes:__

* Upload `check[in|out]_file` content for `access_broker.resources.permissions.[create|update]` to avoid `requests` injected headers.

__Dependencies:__

* None

__Other:__

* None

## v4.1.2 [2025-03-06]

__What's New:__
Expand Down
2 changes: 1 addition & 1 deletion src/britive/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.1.2'
__version__ = '4.1.3'
33 changes: 25 additions & 8 deletions src/britive/access_broker/resources/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def create(
resource_type_id: str,
name: str,
description: str = '',
checkin_file: bytes = None,
checkout_file: bytes = None,
checkin_file: str = None,
checkout_file: str = None,
variables: list = None,
) -> dict:
"""
Expand Down Expand Up @@ -41,8 +41,16 @@ def create(
if checkin_file and checkout_file:
permissionId = permission['permissionId']
urls = self.get_urls(permissionId)
requests.put(urls['checkinURL'], files={'file': checkin_file})
requests.put(urls['checkoutURL'], files={'file': checkout_file})
try:
with open(checkin_file, 'rb') as checkin_upload:
requests.put(urls['checkinURL'], data=checkin_upload)
except FileNotFoundError:
requests.put(urls['checkinURL'], data=checkin_file)
try:
with open(checkout_file, 'rb') as checkout_upload:
requests.put(urls['checkoutURL'], data=checkout_upload)
except FileNotFoundError:
requests.put(urls['checkoutURL'], data=checkout_file)
update_params = {
'checkinFileName': permissionId + '_checkin',
'checkinTimeLimit': 60,
Expand Down Expand Up @@ -107,9 +115,9 @@ def update(
permission_id: str,
resource_type_id: str,
name: str,
checkin_file: bytes = None,
checkin_file: str = None,
checkin_time_limit: int = 60,
checkout_file: bytes = None,
checkout_file: str = None,
checkout_time_limit: int = 60,
**kwargs,
) -> dict:
Expand Down Expand Up @@ -151,8 +159,17 @@ def update(

if checkin_file and checkout_file:
urls = self.get_urls(permission_id)
requests.put(urls['checkinURL'], files={'file': checkin_file})
requests.put(urls['checkoutURL'], files={'file': checkout_file})
try:
with open(checkin_file, 'rb') as checkin_upload:
requests.put(urls['checkinURL'], data=checkin_upload)
except FileNotFoundError:
requests.put(urls['checkinURL'], data=checkin_file)
try:
with open(checkout_file, 'rb') as checkout_upload:
requests.put(urls['checkoutURL'], data=checkout_upload)
except FileNotFoundError:
requests.put(urls['checkoutURL'], data=checkout_file)

params.update(
checkinFileName=permission_id + '_checkin',
checkinURL=urls['checkinURL'],
Expand Down