Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
Co-authored-by: Paweł Chrząszcz <[email protected]>
  • Loading branch information
gustawlippa and chrzaszcz committed Mar 4, 2022
1 parent 5b47a48 commit c227259
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 1 addition & 2 deletions big_tests/tests/vcard_simple_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ ldap_opts() ->
base => <<"ou=Users,dc=esl,dc=com">>,
search_fields => [{"Full Name", "cn"}, {"User", "uid"}],
vcard_map => [{"FN", "%s", ["cn"]}]},
DefaultLDAPOpts = config_parser_helper:default_config([modules, mod_vcard, ldap]),
LDAPOptsWithDefaults = maps:merge(DefaultLDAPOpts, LDAPOpts),
LDAPOptsWithDefaults = config_parser_helper:config([modules, mod_vcard, ldap], LDAPOpts),
config_parser_helper:mod_config(mod_vcard, #{backend => ldap, ldap => LDAPOptsWithDefaults}).

ensure_started(HostType, Opts) ->
Expand Down
4 changes: 2 additions & 2 deletions src/config/mongoose_config_spec.erl
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ outgoing_pool_connection(<<"ldap">>) ->
},
format_items = map,
include = always,
defaults = #{<<"rootdn">> => <<"">>,
<<"password">> => <<"">>,
defaults = #{<<"rootdn">> => <<>>,
<<"password">> => <<>>,
<<"encrypt">> => none,
<<"servers">> => ["localhost"],
<<"connect_interval">> => 10000}
Expand Down
12 changes: 6 additions & 6 deletions src/mod_shared_roster_ldap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ config_spec() ->
<<"useruid">> => <<"cn">>,
<<"memberattr">> => <<"memberUid">>,
<<"memberattr_format">> => <<"%u">>,
<<"memberattr_format_re">> => <<"">>,
<<"memberattr_format_re">> => <<>>,
<<"auth_check">> => true,
<<"user_cache_validity">> => ?USER_CACHE_VALIDITY,
<<"group_cache_validity">> => ?GROUP_CACHE_VALIDITY,
<<"user_cache_size">> => ?CACHE_SIZE,
<<"group_cache_size">> => ?CACHE_SIZE,
<<"rfilter">> => <<"">>,
<<"gfilter">> => <<"">>,
<<"ufilter">> => <<"">>},
<<"rfilter">> => <<>>,
<<"gfilter">> => <<>>,
<<"ufilter">> => <<>>},
CommonLDAPSpec#section{items = maps:merge(CommonLDAPSpec#section.items, Items),
defaults = maps:merge(CommonLDAPSpec#section.defaults, Defaults),
process = fun process_ldap_options/1}.
Expand Down Expand Up @@ -533,7 +533,7 @@ parse_options(Host, #{base := Base, pool_tag := EldapID, deref := Deref, filter
SubFilter = <<"(&(", UIDAttr/binary, "=", UIDAttrFormat/binary,
")(", GroupAttr/binary, "=%g))">>,
UIDAttrFormatRe = case UIDAttrFormatReIn of
<<"">> -> UIDAttrFormatReIn;
<<>> -> UIDAttrFormatReIn;
RE ->
{ok, MP} = re:compile(RE),
MP
Expand Down Expand Up @@ -579,7 +579,7 @@ parse_options(Host, #{base := Base, pool_tag := EldapID, deref := Deref, filter
group_cache_size = GroupCacheSize,
group_cache_validity = GroupCacheValidity}.

check_filter(<<"">>) -> <<"">>;
check_filter(<<>>) -> <<>>;
check_filter(F) ->
{ok, _} = eldap_filter:parse(F),
F.
2 changes: 1 addition & 1 deletion src/mongoose_ldap_config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec() ->
<<"filter">> => #option{type = binary}},
defaults = #{<<"pool_tag">> => default,
<<"deref">> => never,
<<"filter">> => <<"">>},
<<"filter">> => <<>>},
format_items = map
}.

Expand Down

0 comments on commit c227259

Please sign in to comment.