Skip to content

Commit fb19128

Browse files
authored
Make role name check case insensitive (#1964)
2 parents cca1079 + b803ae2 commit fb19128

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libs/labelbox/src/labelbox/schema/api_key.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,9 @@ def create_api_key(
324324
raise ValueError("role must be a Role object or a valid role name")
325325

326326
allowed_roles = ApiKey._get_available_api_key_roles(client)
327-
if role_name not in allowed_roles:
327+
# Normalize the allowed roles to lowercase for case-insensitive comparison
328+
normalized_allowed_roles = [r.lower() for r in allowed_roles]
329+
if role_name.lower() not in normalized_allowed_roles:
328330
raise ValueError(
329331
f"Invalid role specified. Allowed roles are: {allowed_roles}"
330332
)

0 commit comments

Comments
 (0)