Skip to content

Commit 21fbea9

Browse files
author
Inbal Tako
committed
SN-1938 Validate user id
1 parent 0eae997 commit 21fbea9

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.0
1+
0.3.1

securenative/models/sdk_event.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import uuid
22

33
from securenative.context.context_builder import ContextBuilder
4+
from securenative.exceptions.securenative_invalid_options_exception import SecureNativeInvalidOptionsException
45
from securenative.models.request_context import RequestContextBuilder
56
from securenative.models.user_traits import UserTraits
67
from securenative.utils.date_utils import DateUtils
@@ -10,6 +11,9 @@
1011
class SDKEvent(object):
1112

1213
def __init__(self, event_options, securenative_options):
14+
if event_options.user_id is None or len(event_options.user_id) <=0 or event_options.user_id == "":
15+
raise SecureNativeInvalidOptionsException("Invalid event structure; User Id is missing")
16+
1317
if event_options.context is not None:
1418
self.context = event_options.context
1519
else:
@@ -32,7 +36,7 @@ def __init__(self, event_options, securenative_options):
3236

3337
self.rid = str(uuid.uuid4())
3438
self.event_type = event_options.event if event_options.event else ""
35-
self.user_id = event_options.user_id if event_options.user_id else ""
39+
self.user_id = event_options.user_id
3640
self.user_traits = user_traits
3741
self.request = RequestContextBuilder() \
3842
.with_cid(client_token.cid if client_token else "") \

securenative/utils/version_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ class VersionUtils(object):
22

33
@staticmethod
44
def get_version():
5-
return "0.3.0"
5+
return "0.3.1"

0 commit comments

Comments
 (0)