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