Browse Source

fix(emqx_acl_mnesia): Dialyzer warnings

ayodele.akingbule 5 years atrás
parent
commit
5644fdc1f0
1 changed files with 2 additions and 8 deletions
  1. 2 8
      apps/emqx_auth_mnesia/src/emqx_acl_mnesia_api.erl

+ 2 - 8
apps/emqx_auth_mnesia/src/emqx_acl_mnesia_api.erl

@@ -151,7 +151,7 @@ do_add(Params) ->
     Action = urldecode(get_value(<<"action">>, Params)),
     Action = urldecode(get_value(<<"action">>, Params)),
     Access = urldecode(get_value(<<"access">>, Params)),
     Access = urldecode(get_value(<<"access">>, Params)),
     Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
     Re = case validate([login, topic, action, access], [Login, Topic, Action, Access]) of
-        ok -> 
+        ok ->
             emqx_acl_mnesia_cli:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
             emqx_acl_mnesia_cli:add_acl(Login, Topic, erlang:binary_to_atom(Action, utf8), erlang:binary_to_atom(Access, utf8));
         Err -> Err
         Err -> Err
     end,
     end,
@@ -163,7 +163,7 @@ do_add(Params) ->
                      all -> #{all => '$all'};
                      all -> #{all => '$all'};
                      _ -> maps:from_list([Login])
                      _ -> maps:from_list([Login])
                    end).
                    end).
-    
+
 delete(#{clientid := Clientid, topic := Topic}, _) ->
 delete(#{clientid := Clientid, topic := Topic}, _) ->
     return(emqx_acl_mnesia_cli:remove_acl({clientid, urldecode(Clientid)}, urldecode(Topic)));
     return(emqx_acl_mnesia_cli:remove_acl({clientid, urldecode(Clientid)}, urldecode(Topic)));
 delete(#{username := Username, topic := Topic}, _) ->
 delete(#{username := Username, topic := Topic}, _) ->
@@ -202,12 +202,6 @@ do_validation(login, {clientid, V}) when is_binary(V)
 do_validation(login, {username, V}) when is_binary(V)
 do_validation(login, {username, V}) when is_binary(V)
                      andalso byte_size(V) > 0->
                      andalso byte_size(V) > 0->
     true;
     true;
-do_validation(clientid, V) when is_binary(V)
-                     andalso byte_size(V) > 0 ->
-    true;
-do_validation(username, V) when is_binary(V)
-                     andalso byte_size(V) > 0 ->
-    true;
 do_validation(topic, V) when is_binary(V)
 do_validation(topic, V) when is_binary(V)
                      andalso byte_size(V) > 0 ->
                      andalso byte_size(V) > 0 ->
     true;
     true;