feat(authn): support sync configuration in the cluster
This commit is contained in:
parent
85a6f0f1e8
commit
e1bcbd012c
|
@ -793,9 +793,10 @@ add_user(ChainName,
|
||||||
AuthenticatorID,
|
AuthenticatorID,
|
||||||
#{<<"user_id">> := UserID, <<"password">> := Password} = UserInfo) ->
|
#{<<"user_id">> := UserID, <<"password">> := Password} = UserInfo) ->
|
||||||
IsSuperuser = maps:get(<<"is_superuser">>, UserInfo, false),
|
IsSuperuser = maps:get(<<"is_superuser">>, UserInfo, false),
|
||||||
case emqx_authentication:add_user(ChainName, AuthenticatorID, #{ user_id => UserID
|
case emqx_authentication:add_user(ChainName, AuthenticatorID,
|
||||||
, password => Password
|
#{ user_id => UserID
|
||||||
, is_superuser => IsSuperuser}) of
|
, password => Password
|
||||||
|
, is_superuser => IsSuperuser}) of
|
||||||
{ok, User} ->
|
{ok, User} ->
|
||||||
{201, User};
|
{201, User};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
|
@ -845,7 +846,8 @@ list_users(ChainName, AuthenticatorID, PageParams) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
update_config(Path, ConfigRequest) ->
|
update_config(Path, ConfigRequest) ->
|
||||||
emqx:update_config(Path, ConfigRequest, #{rawconf_with_defaults => true}).
|
emqx_conf:update(Path, ConfigRequest, #{rawconf_with_defaults => true,
|
||||||
|
override_to => cluster}).
|
||||||
|
|
||||||
get_raw_config_with_defaults(ConfKeyPath) ->
|
get_raw_config_with_defaults(ConfKeyPath) ->
|
||||||
NConfKeyPath = [atom_to_binary(Key, utf8) || Key <- ConfKeyPath],
|
NConfKeyPath = [atom_to_binary(Key, utf8) || Key <- ConfKeyPath],
|
||||||
|
|
Loading…
Reference in New Issue