Skip to content

Commit 1bd9af2

Browse files
committed
WIP
1 parent 59fb53c commit 1bd9af2

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

deps/rabbit/src/rabbit_auth_backend_internal.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,10 @@ delete_user(Username, ActingUser) ->
300300
rabbit_types:error('not_found').
301301

302302
lookup_user(Username) ->
303-
rabbit_db_user:get(Username).
303+
case rabbit_db_user:get(Username) of
304+
undefined -> {error, not_found};
305+
User -> {ok, User}
306+
end.
304307

305308
-spec exists(rabbit_types:username()) -> boolean().
306309

deps/rabbit/src/rabbit_db_user.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ get(Username) when is_binary(Username) ->
109109
#{mnesia => fun() -> get_in_mnesia(Username) end}).
110110

111111
get_in_mnesia(Username) ->
112-
rabbit_misc:dirty_read({rabbit_user, Username}).
112+
case ets:lookup(?MNESIA_TABLE, Username) of
113+
[User] -> User;
114+
[] -> undefined
115+
end.
113116

114117
%% -------------------------------------------------------------------
115118
%% get_all().

deps/rabbit/src/rabbit_vhost.erl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,10 @@ default_name() ->
506506

507507
-spec lookup(vhost:name()) -> vhost:vhost() | rabbit_types:ok_or_error(any()).
508508
lookup(VHostName) ->
509-
rabbit_db_vhost:get(VHostName).
509+
case rabbit_db_vhost:get(VHostName) of
510+
undefined -> {error, {no_such_vhost, VHostName}};
511+
VHost -> VHost
512+
end.
510513

511514
-spec assert(vhost:name()) -> 'ok'.
512515
assert(VHostName) ->

0 commit comments

Comments
 (0)