1 |
|
-module(mongoose_graphql_admin_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-ignore_xref([execute/4]). |
7 |
|
|
8 |
|
-include("../mongoose_graphql_types.hrl"). |
9 |
|
|
10 |
|
execute(_Ctx, _Obj, <<"domains">>, _Args) -> |
11 |
4 |
{ok, admin}; |
12 |
|
execute(_Ctx, _Obj, <<"account">>, _Args) -> |
13 |
18 |
{ok, account}; |
14 |
|
execute(_Ctx, _Obj, <<"muc_light">>, _Args) -> |
15 |
17 |
{ok, muc_light}; |
16 |
|
execute(_Ctx, _Obj, <<"session">>, _Args) -> |
17 |
14 |
{ok, session}; |
18 |
|
execute(_Ctx, _Obj, <<"stanza">>, _Args) -> |
19 |
8 |
{ok, #{}}; |
20 |
|
execute(#{authorized := Authorized}, _Obj, <<"checkAuth">>, _Args) -> |
21 |
3 |
case Authorized of |
22 |
|
true -> |
23 |
2 |
{ok, 'AUTHORIZED'}; |
24 |
|
false -> |
25 |
1 |
{ok, 'UNAUTHORIZED'} |
26 |
|
end. |