./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 7 case Authorized of
12 true ->
13 4 {ok, 'AUTHORIZED'};
14 false ->
15 3 {ok, 'UNAUTHORIZED'}
16 end;
17 execute(Ctx, admin, <<"domain">>, _Args) ->
18 5 case maps:get(admin, Ctx, null) of
19 4 null -> {ok, null};
20 1 #jid{lserver = Domain} -> {ok, Domain}
21 end;
22 execute(Ctx, admin, <<"authType">>, _Args) ->
23 5 case maps:get(authorized_as, Ctx, null) of
24 3 null -> {ok, null};
25 1 domain_admin -> {ok, domain_admin};
26 1 admin -> {ok, admin}
27 end.
Line Hits Source