./ct_report/coverage/mongoose_graphql_admin_auth_info.COVER.html

1 -module(mongoose_graphql_admin_auth_info).
2 -behaviour(mongoose_graphql).
3
4 -export([execute/4]).
5
6 -ignore_xref([execute/4]).
7
8 -include_lib("jid/include/jid.hrl").
9
10 execute(#{authorized := Authorized}, admin, <<"authStatus">>, _Args) ->
11 5 case Authorized of
12 true ->
13 3 {ok, 'AUTHORIZED'};
14 false ->
15 2 {ok, 'UNAUTHORIZED'}
16 end;
17 execute(Ctx, admin, <<"domain">>, _Args) ->
18 3 case maps:get(admin, Ctx, null) of
19 3 null -> {ok, null};
20
:-(
#jid{lserver = Domain} -> {ok, Domain}
21 end;
22 execute(Ctx, admin, <<"authType">>, _Args) ->
23 3 case maps:get(authorized_as, Ctx, null) of
24 2 null -> {ok, null};
25
:-(
domain_admin -> {ok, domain_admin};
26 1 admin -> {ok, admin}
27 end.
Line Hits Source