Skip to content

Commit 5bbde40

Browse files
add ip add restrictions and saml to user create; fixes #110
1 parent 79d9d9a commit 5bbde40

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'veracode_api_py'
3-
version = '0.9.60'
3+
version = '0.9.61'
44
authors = [ {name = "Tim Jarrett", email="[email protected]"} ]
55
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.'
66
readme = 'README.md'
@@ -22,4 +22,4 @@ dependencies = {file = ["requirements.txt"]}
2222
[project.urls]
2323
"Homepage" = "https://github.com/veracode/veracode-api-py"
2424
"Bug Tracker" = "https://github.com/veracode/veracode-api-py/issues"
25-
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0960.tar.gz"
25+
"Download" = "https://github.com/veracode/veracode-api-py/archive/v_0961.tar.gz"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
setup(
88
name = 'veracode_api_py',
99
packages = ['veracode_api_py'],
10-
version = '0.9.60',
10+
version = '0.9.61',
1111
license='MIT',
1212
description = 'Python helper library for working with the Veracode APIs. Handles retries, pagination, and other features of the modern Veracode REST APIs.',
1313
long_description = long_description,
1414
long_description_content_type="text/markdown",
1515
author = 'Tim Jarrett',
1616
author_email = '[email protected]',
1717
url = 'https://github.com/tjarrettveracode',
18-
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0960.tar.gz',
18+
download_url = 'https://github.com/veracode/veracode-api-py/archive/v_0961.tar.gz',
1919
keywords = ['veracode', 'veracode-api'],
2020
install_requires=[
2121
'veracode-api-signing'

veracode_api_py/identity.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ def get_user_search(self,search_term: str=None, api_id: UUID=None, role_id: UUID
5858

5959
return APIHelper()._rest_paged_request(self.USER_URI + "/search","GET","users",request_params)
6060

61-
def create(self,email,firstname: str,lastname: str,username: str=None,type="HUMAN",roles=[],teams=[],mfa=False):
61+
def create(self,email,firstname: str,lastname: str,username: str=None,type="HUMAN",roles=[],teams=[],mfa=False,
62+
ipRestricted=False, allowedIpAddresses=[],
63+
samlUser=False, samlSubject=""):
6264
user_def = { "email_address": email, "first_name": firstname, "last_name": lastname, "active": True }
6365

6466
rolelist = []
@@ -93,6 +95,14 @@ def create(self,email,firstname: str,lastname: str,username: str=None,type="HUMA
9395
if mfa:
9496
user_def.update({"pin_required":True})
9597

98+
if ipRestricted & len(allowedIpAddresses)>0:
99+
user_def.update({"ipRestricted":True})
100+
user_def.update({"allowedIpAddresses": allowedIpAddresses})
101+
102+
if samlUser & len(samlSubject)>0:
103+
user_def.update({"samlUser":True})
104+
user_def.update({"samlSubject": samlSubject})
105+
96106
payload = json.dumps(user_def)
97107
return APIHelper()._rest_request(self.USER_URI,'POST',body=payload)
98108

0 commit comments

Comments
 (0)