mirror of
https://github.com/clearml/clearml-server
synced 2025-06-13 08:20:05 +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)
|
errors_per_type = defaultdict(int)
|
||||||
valid_tasks = self._get_valid_tasks(
|
valid_tasks = self._get_valid_tasks(
|
||||||
company_id,
|
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,
|
allow_locked_tasks=allow_locked_tasks,
|
||||||
)
|
)
|
||||||
for event in events:
|
for event in events:
|
||||||
|
@ -52,7 +52,7 @@ def validate_all(call: APICall, endpoint: Endpoint):
|
|||||||
|
|
||||||
def validate_role(endpoint, call):
|
def validate_role(endpoint, call):
|
||||||
try:
|
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)
|
raise errors.forbidden.RoleNotAllowed(role=call.identity.role, allowed=endpoint.allow_roles)
|
||||||
except MissingIdentity:
|
except MissingIdentity:
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user