Skip to content

Commit

Permalink
introduced error cases to supress case_clause errors because of bifro…
Browse files Browse the repository at this point in the history
…st delayed response.

Signed-off-by: sreepuramsudheer <ssudheer@progress.com>
  • Loading branch information
sreepuramsudheer committed Aug 11, 2022
1 parent 4f141cf commit f42b51b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/oc_erchef/apps/oc_chef_authz/src/oc_chef_authz.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ create_entity_if_authorized(Context, OrgId, CreatorAId, ObjectType) ->
{error, forbidden};
true ->
create_entity_with_container_acl(CreatorAId, ContainerAId, ObjectType)

end.

%%%
Expand Down Expand Up @@ -318,7 +319,7 @@ get_data_for_id([Id | _Ids] = OIds , [{RId, RData} | Resources], Denied, Permitt
%
-spec is_authorized_on_resource(requestor_id(), resource_type(), object_id(),
'actor'|'group', actor_id(), access_method())
-> true|false|{error,server_error}.
-> true|false|{error,any()}.
is_authorized_on_resource(RequestorId, ResourceType, ResourceId, ActorType, ActorId, AccessMethod)
when is_atom(ResourceType) and is_atom(ActorType) and is_atom(AccessMethod) ->
Url = make_url([pluralize_resource(ResourceType), ResourceId, <<"acl">>,
Expand All @@ -328,7 +329,7 @@ is_authorized_on_resource(RequestorId, ResourceType, ResourceId, ActorType, Acto
%% This api returns not found for any missing permission
{error, not_found} -> false;
%% Otherwise, we expect server_error; not forbidden
{error, server_error} -> {error, server_error}
{error, Error} -> {error, Error}
end.

%
Expand Down

0 comments on commit f42b51b

Please sign in to comment.