./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 456 #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 format_items = map
28 }.
29
30 uids() ->
31 304 #section{
32 items = #{<<"attr">> => #option{type = binary},
33 <<"format">> => #option{type = binary}},
34 process = fun ?MODULE:process_uids/1,
35 required = [<<"attr">>],
36 format_items = map
37 }.
38
39 dn_filter() ->
40 152 #section{
41 items = #{<<"filter">> => #option{type = binary,
42 validate = ldap_filter},
43 <<"attributes">> => #list{items = #option{type = binary}}
44 },
45 required = [<<"filter">>],
46 defaults = #{<<"attributes">> => []},
47 process = fun ?MODULE:process_dn_filter/1,
48 format_items = map
49 }.
50
51 local_filter() ->
52 152 #section{
53 items = #{<<"operation">> => #option{type = atom,
54 validate = {enum, [equal, notequal]}},
55 <<"attribute">> => #option{type = string,
56 validate = non_empty},
57 <<"values">> => #list{items = #option{type = string},
58 validate = non_empty}
59 },
60 required = all,
61 process = fun ?MODULE:process_local_filter/1,
62 format_items = map
63 }.
64
65
:-(
process_uids(#{attr := Attr, format := Format}) -> {Attr, Format};
66
:-(
process_uids(#{attr := Attr}) -> Attr.
67
68 process_dn_filter(#{filter := Filter, attributes := Attrs}) ->
69
:-(
{Filter, Attrs}.
70
71 process_local_filter(#{operation := Op, attribute := Attr, values := Values}) ->
72
:-(
{Op, {Attr, Values}}.
Line Hits Source