Skip to content

Make role name check case insensitive #1964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
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
4 changes: 3 additions & 1 deletion libs/labelbox/src/labelbox/schema/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,9 @@ def create_api_key(
raise ValueError("role must be a Role object or a valid role name")

allowed_roles = ApiKey._get_available_api_key_roles(client)
if role_name not in allowed_roles:
# Normalize the allowed roles to lowercase for case-insensitive comparison
normalized_allowed_roles = [r.lower() for r in allowed_roles]
if role_name.lower() not in normalized_allowed_roles:
raise ValueError(
f"Invalid role specified. Allowed roles are: {allowed_roles}"
)
Expand Down
Loading