]> granicus.if.org Git - ejabberd/commitdiff
Rename is_user_exists -> user_exists
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 11 May 2017 12:49:06 +0000 (15:49 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Thu, 11 May 2017 12:49:06 +0000 (15:49 +0300)
15 files changed:
src/ejabberd_auth.erl
src/ejabberd_auth_anonymous.erl
src/ejabberd_auth_external.erl
src/ejabberd_auth_ldap.erl
src/ejabberd_auth_pam.erl
src/ejabberd_sm.erl
src/ejabberd_web_admin.erl
src/extauth.erl
src/mod_admin_extra.erl
src/mod_configure.erl
src/mod_disco.erl
src/mod_register.erl
src/mod_register_web.erl
src/mod_shared_roster_ldap.erl
src/mod_vcard_ldap.erl

index 23ed0eeae214f739a7f8a9720dbbad91d48e137c..230bd87b576de99df57cd7df368fa87c0515662b 100644 (file)
@@ -39,7 +39,7 @@
         count_users/1, import/5, import_start/2,
         count_users/2, get_password/2,
         get_password_s/2, get_password_with_authmodule/2,
-        is_user_exists/2, is_user_exists_in_other_modules/3,
+        user_exists/2, user_exists_in_other_modules/3,
         remove_user/2, remove_user/3, plain_password_required/1,
         store_type/1, entropy/1, backend_type/1, password_format/1]).
 %% gen_server callbacks
@@ -73,7 +73,7 @@
 -callback store_type(binary()) -> plain | external | scram.
 -callback set_password(binary(), binary(), binary()) -> ok | {error, atom()}.
 -callback remove_user(binary(), binary()) -> ok | {error, any()}.
--callback is_user_exists(binary(), binary()) -> boolean() | {error, atom()}.
+-callback user_exists(binary(), binary()) -> boolean() | {error, atom()}.
 -callback check_password(binary(), binary(), binary(), binary()) -> boolean().
 -callback try_register(binary(), binary(), password()) -> ok | {error, atom()}.
 -callback get_users(binary(), opts()) -> [{binary(), binary()}].
@@ -84,7 +84,7 @@
 
 -optional_callbacks([set_password/3,
                     remove_user/2,
-                    is_user_exists/2,
+                    user_exists/2,
                     check_password/4,
                     try_register/3,
                     get_users/2,
@@ -250,7 +250,7 @@ set_password(User, Server, Password) ->
 try_register(User, Server, Password) ->
     case validate_credentials(User, Server, Password) of
        {ok, LUser, LServer} ->
-           case is_user_exists(LUser, LServer) of
+           case user_exists(LUser, LServer) of
                true ->
                    {error, exists};
                false ->
@@ -357,15 +357,15 @@ get_password_with_authmodule(User, Server) ->
            {false, undefined}
     end.
 
--spec is_user_exists(binary(), binary()) -> boolean().
-is_user_exists(_User, <<"">>) ->
+-spec user_exists(binary(), binary()) -> boolean().
+user_exists(_User, <<"">>) ->
     false;
-is_user_exists(User, Server) ->
+user_exists(User, Server) ->
     case validate_credentials(User, Server) of
        {ok, LUser, LServer} ->
            lists:any(
              fun(M) ->
-                     case db_is_user_exists(LUser, LServer, M) of
+                     case db_user_exists(LUser, LServer, M) of
                          {error, _} ->
                              false;
                          Else ->
@@ -376,19 +376,19 @@ is_user_exists(User, Server) ->
            false
     end.
 
--spec is_user_exists_in_other_modules(atom(), binary(), binary()) -> boolean() | maybe.
-is_user_exists_in_other_modules(Module, User, Server) ->
-    is_user_exists_in_other_modules_loop(
+-spec user_exists_in_other_modules(atom(), binary(), binary()) -> boolean() | maybe.
+user_exists_in_other_modules(Module, User, Server) ->
+    user_exists_in_other_modules_loop(
       auth_modules(Server) -- [Module], User, Server).
 
-is_user_exists_in_other_modules_loop([], _User, _Server) ->
+user_exists_in_other_modules_loop([], _User, _Server) ->
     false;
-is_user_exists_in_other_modules_loop([AuthModule | AuthModules], User, Server) ->
-    case db_is_user_exists(User, Server, AuthModule) of
+user_exists_in_other_modules_loop([AuthModule | AuthModules], User, Server) ->
+    case db_user_exists(User, Server, AuthModule) of
        true ->
            true;
        false ->
-           is_user_exists_in_other_modules_loop(AuthModules, User, Server);
+           user_exists_in_other_modules_loop(AuthModules, User, Server);
        {error, _} ->
            maybe
     end.
@@ -537,14 +537,14 @@ db_get_password(User, Server, Mod) ->
            Mod:get_password(User, Server)
     end.
 
-db_is_user_exists(User, Server, Mod) ->
+db_user_exists(User, Server, Mod) ->
     case db_get_password(User, Server, Mod) of
        {ok, _} ->
            true;
        error ->
            case Mod:store_type(Server) of
                external ->
-                   Mod:is_user_exists(User, Server);
+                   Mod:user_exists(User, Server);
                _ ->
                    false
            end
index b3ae1f6dd4c007a63de9868114472acffa37f067..a4f3ac1c5e22d41dd1548e53650a4fd83eca6e37 100644 (file)
@@ -40,7 +40,7 @@
         unregister_connection/3
        ]).
 
--export([login/2, check_password/4, is_user_exists/2,
+-export([login/2, check_password/4, user_exists/2,
         get_users/2, count_users/2, store_type/1,
         plain_password_required/1, opt_type/1]).
 
@@ -135,7 +135,7 @@ unregister_connection(_SID,
 %% ---------------------------------
 check_password(User, _AuthzId, Server, _Password) ->
     case
-      ejabberd_auth:is_user_exists_in_other_modules(?MODULE,
+      ejabberd_auth:user_exists_in_other_modules(?MODULE,
                                                    User, Server)
        of
       %% If user exists in other module, reject anonnymous authentication
@@ -165,7 +165,7 @@ get_users(Server, _) ->
 count_users(Server, Opts) ->
     length(get_users(Server, Opts)).
 
-is_user_exists(User, Server) ->
+user_exists(User, Server) ->
     anonymous_user_exist(User, Server).
 
 plain_password_required(_) ->
index 5b2b26c1a618fb834b30c771b2152e6aee12a0d0..c5669761041955f33b43ffe872c4b5ef94290988 100644 (file)
@@ -32,7 +32,7 @@
 -behaviour(ejabberd_auth).
 
 -export([start/1, stop/1, set_password/3, check_password/4,
-        try_register/3, is_user_exists/2, remove_user/2,
+        try_register/3, user_exists/2, remove_user/2,
         store_type/1, plain_password_required/1, opt_type/1]).
 
 -include("ejabberd.hrl").
@@ -68,8 +68,8 @@ set_password(User, Server, Password) ->
 try_register(User, Server, Password) ->
     extauth:try_register(User, Server, Password).
 
-is_user_exists(User, Server) ->
-    try extauth:is_user_exists(User, Server) of
+user_exists(User, Server) ->
+    try extauth:user_exists(User, Server) of
        Res -> Res
     catch
        _:Error ->
index 15abebedcfb2ffe1252fcfe8a151f149c6d379be..21f7ca62ce2704f640095b03f8932d9d7d973353 100644 (file)
@@ -37,7 +37,7 @@
         handle_cast/2, terminate/2, code_change/3]).
 
 -export([start/1, stop/1, start_link/1, set_password/3,
-        check_password/4, is_user_exists/2,
+        check_password/4, user_exists/2,
         get_users/2, count_users/2,
         store_type/1, plain_password_required/1,
         opt_type/1]).
@@ -147,8 +147,8 @@ count_users(Server, Opts) ->
     length(get_users(Server, Opts)).
 
 %% @spec (User, Server) -> true | false | {error, Error}
-is_user_exists(User, Server) ->
-    case catch is_user_exists_ldap(User, Server) of
+user_exists(User, Server) ->
+    case catch user_exists_ldap(User, Server) of
       {'EXIT', _Error} -> {error, db_failure};
       Result -> Result
     end.
@@ -218,7 +218,7 @@ get_users_ldap(Server) ->
       _ -> []
     end.
 
-is_user_exists_ldap(User, Server) ->
+user_exists_ldap(User, Server) ->
     {ok, State} = eldap_utils:get_state(Server, ?MODULE),
     case find_user_dn(User, State) of
       false -> false;
index f865f36f64734270abf3838781644c6b5f02877b..f31ba4c9a02c3e916fa40e2ddaef33953d8334d8 100644 (file)
@@ -31,7 +31,7 @@
 -behaviour(ejabberd_auth).
 
 -export([start/1, stop/1, check_password/4,
-        is_user_exists/2, store_type/1, plain_password_required/1,
+        user_exists/2, store_type/1, plain_password_required/1,
         opt_type/1]).
 
 start(_Host) ->
@@ -57,7 +57,7 @@ check_password(User, AuthzId, Host, Password) ->
         end
     end.
 
-is_user_exists(User, Host) ->
+user_exists(User, Host) ->
     Service = get_pam_service(Host),
     UserInfo = case get_pam_userinfotype(Host) of
                 username -> User;
index 92c6bb94fb3061b77400a6b58870cb7d9b645eec..9ab38a76341c77243ed3e4d83618be9164528ce5 100644 (file)
@@ -178,7 +178,7 @@ close_session(SID, User, Server, Resource) ->
                            subscribe | subscribed | unsubscribe | unsubscribed,
                            binary()) -> boolean() | {stop, false}.
 check_in_subscription(Acc, User, Server, _JID, _Type, _Reason) ->
-    case ejabberd_auth:is_user_exists(User, Server) of
+    case ejabberd_auth:user_exists(User, Server) of
       true -> Acc;
       false -> {stop, false}
     end.
@@ -716,7 +716,7 @@ route_message(#message{to = To, type = Type} = Packet) ->
                        end,
                        PrioRes);
       _ ->
-           case ejabberd_auth:is_user_exists(LUser, LServer) andalso
+           case ejabberd_auth:user_exists(LUser, LServer) andalso
                is_privacy_allow(Packet) of
                true ->
                    ejabberd_hooks:run_fold(offline_message_hook,
index 6fdac19710e5c4a3574df333dad837ee0fa1d9a6..4c2ca730a61cf08fb71c6c9e6036abdd2f192c37 100644 (file)
@@ -281,7 +281,7 @@ get_auth_account(HostOfRule, AccessRule, User, Server,
            true -> {ok, {User, Server}}
          end;
       false ->
-         case ejabberd_auth:is_user_exists(User, Server) of
+         case ejabberd_auth:user_exists(User, Server) of
            true -> {unauthorized, <<"bad-password">>};
            false -> {unauthorized, <<"inexistent-account">>}
          end
@@ -1025,7 +1025,7 @@ process_admin(Host,
 process_admin(Host,
              #request{path = [<<"user">>, U],
                       auth = {_, _Auth, AJID}, q = Query, lang = Lang}) ->
-    case ejabberd_auth:is_user_exists(U, Host) of
+    case ejabberd_auth:user_exists(U, Host) of
       true ->
          Res = user_info(U, Host, Query, Lang),
          make_xhtml(Res, Host, Lang, AJID);
index 70f32bf8fca20361c83b9fa1f5b856907782dc4f..9f04a44ea063ec30c492b2ac0052667f301286cb 100644 (file)
@@ -31,7 +31,7 @@
 
 -export([start/2, stop/1, init/2, check_password/3,
         set_password/3, try_register/3, remove_user/2,
-        remove_user/3, is_user_exists/2, opt_type/1]).
+        remove_user/3, user_exists/2, opt_type/1]).
 
 -include("ejabberd.hrl").
 -include("logger.hrl").
@@ -73,7 +73,7 @@ get_process_name(Host, Integer) ->
 check_password(User, Server, Password) ->
     call_port(Server, [<<"auth">>, User, Server, Password]).
 
-is_user_exists(User, Server) ->
+user_exists(User, Server) ->
     call_port(Server, [<<"isuser">>, User, Server]).
 
 set_password(User, Server, Password) ->
index 982772af0741aff4e3fcbd133eecb84eee507cb9..0b3b007ce5246ff7207abd7c5f8f1a4340d1409c 100644 (file)
@@ -210,7 +210,7 @@ get_commands_spec() ->
                        result_desc = "Result tuple"},
      #ejabberd_commands{name = check_account, tags = [accounts],
                        desc = "Check if an account exists or not",
-                       module = ejabberd_auth, function = is_user_exists,
+                       module = ejabberd_auth, function = user_exists,
                        args = [{user, binary}, {host, binary}],
                        args_example = [<<"peter">>, <<"myserver.com">>],
                        args_desc = ["User name to check", "Server to check"],
@@ -1638,7 +1638,7 @@ decide_rip_jid({UName, UServer}, Match_list) ->
       Match_list).
 
 user_action(User, Server, Fun, OK) ->
-    case ejabberd_auth:is_user_exists(User, Server) of
+    case ejabberd_auth:user_exists(User, Server) of
         true ->
            case catch Fun() of
                 OK -> ok;
index f3eb496d876df1b7b38786d13442ce94b311be43..3bb9f22791b17a52e408ff8941d724c72ba862cf 100644 (file)
@@ -1541,7 +1541,7 @@ set_form(From, Host, ?NS_ADMINL(<<"delete-user">>),
                             Server = JID#jid.lserver,
                             true = Server == Host orelse
                                      get_permission_level(From) == global,
-                            true = ejabberd_auth:is_user_exists(User, Server),
+                            true = ejabberd_auth:user_exists(User, Server),
                             {User, Server}
                     end,
                     AccountStringList),
@@ -1610,7 +1610,7 @@ set_form(From, Host,
     Server = JID#jid.lserver,
     true = Server == Host orelse
             get_permission_level(From) == global,
-    true = ejabberd_auth:is_user_exists(User, Server),
+    true = ejabberd_auth:user_exists(User, Server),
     ejabberd_auth:set_password(User, Server, Password),
     {result, undefined};
 set_form(From, Host,
index 7fde1b410e78b042d1f8ebce7095b325f5fddbb1..76be408f4c189f8662545633b0301341cc8901ea 100644 (file)
@@ -376,7 +376,7 @@ process_sm_iq_info(#iq{type = get, lang = Lang,
 get_sm_identity(Acc, _From,
                #jid{luser = LUser, lserver = LServer}, _Node, _Lang) ->
     Acc ++
-      case ejabberd_auth:is_user_exists(LUser, LServer) of
+      case ejabberd_auth:user_exists(LUser, LServer) of
        true ->
            [#identity{category = <<"account">>, type = <<"registered">>}];
        _ -> []
index 5167370c1d6cdae13a82967465a1a706b2c1caa9..c2efca5c1deec6d14f3bf3398202a94366bdadf6 100644 (file)
@@ -198,7 +198,7 @@ process_iq(#iq{type = get, from = From, to = To, id = ID, lang = Lang} = IQ,
     {IsRegistered, Username} =
        case From of
            #jid{user = User, lserver = Server} ->
-               case ejabberd_auth:is_user_exists(User, Server) of
+               case ejabberd_auth:user_exists(User, Server) of
                    true ->
                        {true, User};
                    false ->
index d5e4112c3b9a87ba4a02c0a21184fce46dc2a2a6..16c2d80207639c7440d9a98c25cd3251d20d039f 100644 (file)
@@ -438,7 +438,7 @@ change_password(Username, Host, PasswordOld,
     end.
 
 check_account_exists(Username, Host) ->
-    case ejabberd_auth:is_user_exists(Username, Host) of
+    case ejabberd_auth:user_exists(Username, Host) of
       true -> account_exists;
       false -> account_doesnt_exist
     end.
index 08220f7ecaaa15cc871d14d502b4644247a889da..bc7694fe4a0c5448dce67f96f1efd4d863558831 100644 (file)
@@ -390,7 +390,7 @@ search_group_info(State, Group) ->
                      end
                end,
     AuthChecker = case State#state.auth_check of
-                   true -> fun ejabberd_auth:is_user_exists/2;
+                   true -> fun ejabberd_auth:user_exists/2;
                    _ -> fun (_U, _S) -> true end
                  end,
     case eldap_search(State,
index f97eb18a9038a457ec2e2da0085c1af24a095866..967a2c4cf54b83b70dc6f53984e19883829c1203 100644 (file)
@@ -148,7 +148,7 @@ search_items(Entries, State) ->
                  {U, UIDAttrFormat} ->
                      case eldap_utils:get_user_part(U, UIDAttrFormat) of
                          {ok, Username} ->
-                             case ejabberd_auth:is_user_exists(Username,
+                             case ejabberd_auth:user_exists(Username,
                                                                LServer) of
                                  true ->
                                      RFields = lists:map(