fix(sso): fix RBAC test errors && spellcheck

This commit is contained in:
firest 2023-09-20 00:25:11 +08:00
parent 5b00998050
commit 61311081d8
4 changed files with 25 additions and 16 deletions

View File

@ -61,11 +61,11 @@ t_permission(_) ->
}
),
?assertEqual(
?assertMatch(
#{
<<"username">> => ViewerUser,
<<"role">> => ?ROLE_VIEWER,
<<"description">> => ?ADD_DESCRIPTION
<<"username">> := ViewerUser,
<<"role">> := ?ROLE_VIEWER,
<<"description">> := ?ADD_DESCRIPTION
},
emqx_utils_json:decode(Payload, [return_maps])
),
@ -104,11 +104,11 @@ t_update_role(_) ->
}
),
?assertEqual(
?assertMatch(
#{
<<"username">> => ?DEFAULT_SUPERUSER,
<<"role">> => ?ROLE_VIEWER,
<<"description">> => ?ADD_DESCRIPTION
<<"username">> := ?DEFAULT_SUPERUSER,
<<"role">> := ?ROLE_VIEWER,
<<"description">> := ?ADD_DESCRIPTION
},
emqx_utils_json:decode(Payload, [return_maps])
),

View File

@ -8,14 +8,12 @@
-include_lib("hocon/include/hoconsc.hrl").
-include_lib("emqx/include/logger.hrl").
-include_lib("typerefl/include/types.hrl").
-import(hoconsc, [
mk/2,
array/1,
enum/1,
ref/1,
union/1
ref/1
]).
-export([
@ -37,7 +35,7 @@
-define(BAD_USERNAME_OR_PWD, 'BAD_USERNAME_OR_PWD').
-define(BAD_REQUEST, 'BAD_REQUEST').
-define(BACKEND_NOT_FOUND, 'BACKEND_NOT_FOUND').
-define(TAGS, <<"Dashboard Single Sign-on">>).
-define(TAGS, <<"Dashboard Single Sign-On">>).
namespace() -> "dashboard_sso".
@ -58,7 +56,7 @@ schema("/sso") ->
tags => [?TAGS],
desc => ?DESC(get_sso),
responses => #{
200 => array(enum(emqx_dashboard_sso:types()))
200 => array(ref(backend_status))
}
}
};
@ -189,7 +187,7 @@ backend_name_as_arg(In, Extra, Default) ->
#{
in => In,
desc => ?DESC(backend_name_in_qs),
required => true,
required => false,
example => Default
}
)}

View File

@ -12,7 +12,8 @@
-behaviour(emqx_dashboard_sso).
-export([
fields/1
fields/1,
desc/1
]).
-export([
@ -51,6 +52,11 @@ query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
query_timeout(default) -> <<"5s">>;
query_timeout(_) -> undefined.
desc(ldap) ->
"LDAP";
desc(_) ->
undefined.
%%------------------------------------------------------------------------------
%% APIs
%%------------------------------------------------------------------------------

View File

@ -25,7 +25,7 @@
%% ecpool connect & reconnect
-export([connect/1]).
-export([roots/0, fields/1]).
-export([roots/0, fields/1, desc/1]).
-export([do_get_status/1]).
@ -100,6 +100,11 @@ fields(bind_opts) ->
)}
].
desc(ssl) ->
?DESC(emqx_connector_schema_lib, "ssl");
desc(_) ->
undefined.
server() ->
Meta = #{desc => ?DESC("server")},
emqx_schema:servers_sc(Meta, ?LDAP_HOST_OPTIONS).