Skip to content

Commit

Permalink
fix(sso): fix RBAC test errors && spellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
lafirest committed Sep 20, 2023
1 parent 5b00998 commit 6131108
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 16 deletions.
16 changes: 8 additions & 8 deletions apps/emqx_dashboard_rbac/test/emqx_dashboard_rbac_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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])
),
Expand Down Expand Up @@ -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])
),
Expand Down
10 changes: 4 additions & 6 deletions apps/emqx_dashboard_sso/src/emqx_dashboard_sso_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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".

Expand All @@ -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))
}
}
};
Expand Down Expand Up @@ -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
}
)}
Expand Down
8 changes: 7 additions & 1 deletion apps/emqx_dashboard_sso/src/emqx_dashboard_sso_ldap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
-behaviour(emqx_dashboard_sso).

-export([
fields/1
fields/1,
desc/1
]).

-export([
Expand Down Expand Up @@ -51,6 +52,11 @@ query_timeout(desc) -> ?DESC(?FUNCTION_NAME);
query_timeout(default) -> <<"5s">>;
query_timeout(_) -> undefined.

desc(ldap) ->
"LDAP";
desc(_) ->
undefined.

%%------------------------------------------------------------------------------
%% APIs
%%------------------------------------------------------------------------------
Expand Down
7 changes: 6 additions & 1 deletion apps/emqx_ldap/src/emqx_ldap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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]).

Expand Down Expand Up @@ -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).
Expand Down

0 comments on commit 6131108

Please sign in to comment.