mirror of
https://github.com/clearml/clearml-server
synced 2025-02-07 13:33:42 +00:00
Fix role checked for endpoints not requiring authorization
This commit is contained in:
parent
c17b10ff1d
commit
d6321588f3
@ -74,7 +74,9 @@ class EventBLL(object):
|
||||
errors_per_type = defaultdict(int)
|
||||
valid_tasks = self._get_valid_tasks(
|
||||
company_id,
|
||||
task_ids={event["task"] for event in events if event.get("task")},
|
||||
task_ids={
|
||||
event["task"] for event in events if event.get("task") is not None
|
||||
},
|
||||
allow_locked_tasks=allow_locked_tasks,
|
||||
)
|
||||
for event in events:
|
||||
|
@ -52,7 +52,7 @@ def validate_all(call: APICall, endpoint: Endpoint):
|
||||
|
||||
def validate_role(endpoint, call):
|
||||
try:
|
||||
if not endpoint.allows(call.identity.role):
|
||||
if endpoint.authorize and not endpoint.allows(call.identity.role):
|
||||
raise errors.forbidden.RoleNotAllowed(role=call.identity.role, allowed=endpoint.allow_roles)
|
||||
except MissingIdentity:
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user