fix(sso): fix RBAC test errors && spellcheck
This commit is contained in:
parent
5b00998050
commit
61311081d8
|
@ -61,11 +61,11 @@ t_permission(_) ->
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
?assertEqual(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"username">> => ViewerUser,
|
<<"username">> := ViewerUser,
|
||||||
<<"role">> => ?ROLE_VIEWER,
|
<<"role">> := ?ROLE_VIEWER,
|
||||||
<<"description">> => ?ADD_DESCRIPTION
|
<<"description">> := ?ADD_DESCRIPTION
|
||||||
},
|
},
|
||||||
emqx_utils_json:decode(Payload, [return_maps])
|
emqx_utils_json:decode(Payload, [return_maps])
|
||||||
),
|
),
|
||||||
|
@ -104,11 +104,11 @@ t_update_role(_) ->
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
?assertEqual(
|
?assertMatch(
|
||||||
#{
|
#{
|
||||||
<<"username">> => ?DEFAULT_SUPERUSER,
|
<<"username">> := ?DEFAULT_SUPERUSER,
|
||||||
<<"role">> => ?ROLE_VIEWER,
|
<<"role">> := ?ROLE_VIEWER,
|
||||||
<<"description">> => ?ADD_DESCRIPTION
|
<<"description">> := ?ADD_DESCRIPTION
|
||||||
},
|
},
|
||||||
emqx_utils_json:decode(Payload, [return_maps])
|
emqx_utils_json:decode(Payload, [return_maps])
|
||||||
),
|
),
|
||||||
|
|
|
@ -8,14 +8,12 @@
|
||||||
|
|
||||||
-include_lib("hocon/include/hoconsc.hrl").
|
-include_lib("hocon/include/hoconsc.hrl").
|
||||||
-include_lib("emqx/include/logger.hrl").
|
-include_lib("emqx/include/logger.hrl").
|
||||||
-include_lib("typerefl/include/types.hrl").
|
|
||||||
|
|
||||||
-import(hoconsc, [
|
-import(hoconsc, [
|
||||||
mk/2,
|
mk/2,
|
||||||
array/1,
|
array/1,
|
||||||
enum/1,
|
enum/1,
|
||||||
ref/1,
|
ref/1
|
||||||
union/1
|
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
|
@ -37,7 +35,7 @@
|
||||||
-define(BAD_USERNAME_OR_PWD, 'BAD_USERNAME_OR_PWD').
|
-define(BAD_USERNAME_OR_PWD, 'BAD_USERNAME_OR_PWD').
|
||||||
-define(BAD_REQUEST, 'BAD_REQUEST').
|
-define(BAD_REQUEST, 'BAD_REQUEST').
|
||||||
-define(BACKEND_NOT_FOUND, 'BACKEND_NOT_FOUND').
|
-define(BACKEND_NOT_FOUND, 'BACKEND_NOT_FOUND').
|
||||||
-define(TAGS, <<"Dashboard Single Sign-on">>).
|
-define(TAGS, <<"Dashboard Single Sign-On">>).
|
||||||
|
|
||||||
namespace() -> "dashboard_sso".
|
namespace() -> "dashboard_sso".
|
||||||
|
|
||||||
|
@ -58,7 +56,7 @@ schema("/sso") ->
|
||||||
tags => [?TAGS],
|
tags => [?TAGS],
|
||||||
desc => ?DESC(get_sso),
|
desc => ?DESC(get_sso),
|
||||||
responses => #{
|
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,
|
in => In,
|
||||||
desc => ?DESC(backend_name_in_qs),
|
desc => ?DESC(backend_name_in_qs),
|
||||||
required => true,
|
required => false,
|
||||||
example => Default
|
example => Default
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
-behaviour(emqx_dashboard_sso).
|
-behaviour(emqx_dashboard_sso).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
fields/1
|
fields/1,
|
||||||
|
desc/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
|
@ -51,6 +52,11 @@ query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
|
||||||
query_timeout(default) -> <<"5s">>;
|
query_timeout(default) -> <<"5s">>;
|
||||||
query_timeout(_) -> undefined.
|
query_timeout(_) -> undefined.
|
||||||
|
|
||||||
|
desc(ldap) ->
|
||||||
|
"LDAP";
|
||||||
|
desc(_) ->
|
||||||
|
undefined.
|
||||||
|
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
%% APIs
|
%% APIs
|
||||||
%%------------------------------------------------------------------------------
|
%%------------------------------------------------------------------------------
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
%% ecpool connect & reconnect
|
%% ecpool connect & reconnect
|
||||||
-export([connect/1]).
|
-export([connect/1]).
|
||||||
|
|
||||||
-export([roots/0, fields/1]).
|
-export([roots/0, fields/1, desc/1]).
|
||||||
|
|
||||||
-export([do_get_status/1]).
|
-export([do_get_status/1]).
|
||||||
|
|
||||||
|
@ -100,6 +100,11 @@ fields(bind_opts) ->
|
||||||
)}
|
)}
|
||||||
].
|
].
|
||||||
|
|
||||||
|
desc(ssl) ->
|
||||||
|
?DESC(emqx_connector_schema_lib, "ssl");
|
||||||
|
desc(_) ->
|
||||||
|
undefined.
|
||||||
|
|
||||||
server() ->
|
server() ->
|
||||||
Meta = #{desc => ?DESC("server")},
|
Meta = #{desc => ?DESC("server")},
|
||||||
emqx_schema:servers_sc(Meta, ?LDAP_HOST_OPTIONS).
|
emqx_schema:servers_sc(Meta, ?LDAP_HOST_OPTIONS).
|
||||||
|
|
Loading…
Reference in New Issue