./ct_report/coverage/mongoose_ldap_config.COVER.html

1 -module(mongoose_ldap_config).
2
3 %% Config spec
4 -export([spec/0,
5 uids/0,
6 dn_filter/0,
7 local_filter/0]).
8
9 %% Config spec callbacks
10 -export([process_uids/1,
11 process_dn_filter/1,
12 process_local_filter/1]).
13
14 -include("mongoose_config_spec.hrl").
15
16 spec() ->
17 198 #section{
18 items = #{<<"pool_tag">> => #option{type = atom,
19 validate = pool_name},
20 <<"base">> => #option{type = binary},
21 <<"deref">> => #option{type = atom,
22 validate = {enum, [never, always, finding, searching]}},
23 <<"filter">> => #option{type = binary}},
24 defaults = #{<<"pool_tag">> => default,
25 <<"deref">> => never,
26 <<"filter">> => <<>>}
27 }.
28
29 uids() ->
30 132 #section{
31 items = #{<<"attr">> => #option{type = binary},
32 <<"format">> => #option{type = binary}},
33 process = fun ?MODULE:process_uids/1,
34 required = [<<"attr">>]
35 }.
36
37 dn_filter() ->
38 66 #section{
39 items = #{<<"filter">> => #option{type = binary,
40 validate = ldap_filter},
41 <<"attributes">> => #list{items = #option{type = binary}}
42 },
43 required = [<<"filter">>],
44 defaults = #{<<"attributes">> => []},
45 process = fun ?MODULE:process_dn_filter/1
46 }.
47
48 local_filter() ->
49 66 #section{
50 items = #{<<"operation">> => #option{type = atom,
51 validate = {enum, [equal, notequal]}},
52 <<"attribute">> => #option{type = string,
53 validate = non_empty},
54 <<"values">> => #list{items = #option{type = string},
55 validate = non_empty}
56 },
57 required = all,
58 process = fun ?MODULE:process_local_filter/1
59 }.
60
61
:-(
process_uids(#{attr := Attr, format := Format}) -> {Attr, Format};
62
:-(
process_uids(#{attr := Attr}) -> Attr.
63
64 process_dn_filter(#{filter := Filter, attributes := Attrs}) ->
65
:-(
{Filter, Attrs}.
66
67 process_local_filter(#{operation := Op, attribute := Attr, values := Values}) ->
68
:-(
{Op, {Attr, Values}}.
Line Hits Source