fix(authn): Use local content shard for the chain table

This commit is contained in:
k32 2021-08-21 17:42:03 +02:00
parent 9c74fa42a5
commit ecd7964a5d
1 changed files with 5 additions and 5 deletions

View File

@ -350,7 +350,7 @@ handle_call({lookup_chain, ID}, _From, State) ->
end; end;
handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, State) -> handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, State) ->
UpdateFun = UpdateFun =
fun(#chain{authenticators = Authenticators} = Chain) -> fun(#chain{authenticators = Authenticators} = Chain) ->
case lists:keymember(Name, 2, Authenticators) of case lists:keymember(Name, 2, Authenticators) of
true -> true ->
@ -374,7 +374,7 @@ handle_call({create_authenticator, ChainID, #{name := Name} = Config}, _From, St
reply(Reply, State); reply(Reply, State);
handle_call({delete_authenticator, ChainID, AuthenticatorID}, _From, State) -> handle_call({delete_authenticator, ChainID, AuthenticatorID}, _From, State) ->
UpdateFun = UpdateFun =
fun(#chain{authenticators = Authenticators} = Chain) -> fun(#chain{authenticators = Authenticators} = Chain) ->
case lists:keytake(AuthenticatorID, 1, Authenticators) of case lists:keytake(AuthenticatorID, 1, Authenticators) of
false -> false ->
@ -397,7 +397,7 @@ handle_call({update_or_create_authenticator, ChainID, AuthenticatorID, Config},
reply(Reply, State); reply(Reply, State);
handle_call({move_authenticator, ChainID, AuthenticatorID, Position}, _From, State) -> handle_call({move_authenticator, ChainID, AuthenticatorID, Position}, _From, State) ->
UpdateFun = UpdateFun =
fun(#chain{authenticators = Authenticators} = Chain) -> fun(#chain{authenticators = Authenticators} = Chain) ->
case do_move_authenticator(AuthenticatorID, Authenticators, Position) of case do_move_authenticator(AuthenticatorID, Authenticators, Position) of
{ok, NAuthenticators} -> {ok, NAuthenticators} ->
@ -524,7 +524,7 @@ do_delete_authenticator(#authenticator{provider = Provider, state = State}) ->
ok. ok.
update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Config, CreateWhenNotFound) -> update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Config, CreateWhenNotFound) ->
UpdateFun = UpdateFun =
fun(#chain{authenticators = Authenticators} = Chain) -> fun(#chain{authenticators = Authenticators} = Chain) ->
case lists:keytake(AuthenticatorID, 1, Authenticators) of case lists:keytake(AuthenticatorID, 1, Authenticators) of
false -> false ->
@ -586,7 +586,7 @@ update_or_create_authenticator(ChainID, AuthenticatorID, #{name := NewName} = Co
end end
end, end,
update_chain(ChainID, UpdateFun). update_chain(ChainID, UpdateFun).
replace_authenticator(ID, #authenticator{name = Name} = Authenticator, Authenticators) -> replace_authenticator(ID, #authenticator{name = Name} = Authenticator, Authenticators) ->
lists:keyreplace(ID, 1, Authenticators, {ID, Name, Authenticator}). lists:keyreplace(ID, 1, Authenticators, {ID, Name, Authenticator}).