diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index 2077dfdf1fc..f234b7d1f1f 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -739,7 +739,7 @@ void HTTPHandler::processQuery( if (context->getUser()->granted_roles.isGranted(role_id)) context->setCurrentRoles(std::vector{role_id}); else - throw Exception(ErrorCodes::UNKNOWN_ROLE, "Role {} is not granted to the current user", role_name); + throw Exception(ErrorCodes::UNKNOWN_ROLE, "Role {} does not exist or not granted to the current user", role_name); } /// Settings can be overridden in the query. diff --git a/tests/queries/0_stateless/03096_http_interface_role_query_param.sh b/tests/queries/0_stateless/03096_http_interface_role_query_param.sh index a508f74a6ff..6cf13f94399 100755 --- a/tests/queries/0_stateless/03096_http_interface_role_query_param.sh +++ b/tests/queries/0_stateless/03096_http_interface_role_query_param.sh @@ -5,8 +5,7 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) . "$CUR_DIR"/../shell_config.sh TEST_USER="03096_role_query_param_user" -TEST_PASSWORD="foobar" -TEST_USER_AUTH="$TEST_USER:$TEST_PASSWORD" +TEST_USER_AUTH="$TEST_USER:" TEST_ROLE="03096_role_query_param_role" TEST_ROLE_ENABLED_BY_DEFAULT="03096_role_query_param_role_enabled_by_default" @@ -20,7 +19,6 @@ TEST_TABLE_ENABLED_BY_DEFAULT="03096_role_query_param_table_enabled_by_default" TEST_TABLE_QUERY="SELECT * FROM $TEST_DB.$TEST_TABLE" TEST_TABLE_ENABLED_BY_DEFAULT_QUERY="SELECT * FROM $TEST_DB.$TEST_TABLE_ENABLED_BY_DEFAULT" -DEFAULT_DB_QUERY="SELECT * FROM $DEFAULT_TABLE" $CLICKHOUSE_CLIENT -q "DROP USER IF EXISTS $TEST_USER" $CLICKHOUSE_CLIENT -q "DROP ROLE IF EXISTS $TEST_ROLE" @@ -35,7 +33,7 @@ $CLICKHOUSE_CLIENT -q "INSERT INTO $TEST_DB.$TEST_TABLE_ENABLED_BY_DEFAULT VALUE $CLICKHOUSE_CLIENT -q "CREATE TABLE $TEST_DB.$TEST_TABLE (i Int32) ENGINE = Memory" $CLICKHOUSE_CLIENT -q "INSERT INTO $TEST_DB.$TEST_TABLE VALUES (144)" -$CLICKHOUSE_CLIENT -q "CREATE USER $TEST_USER IDENTIFIED BY '$TEST_PASSWORD'" +$CLICKHOUSE_CLIENT -q "CREATE USER $TEST_USER NOT IDENTIFIED" $CLICKHOUSE_CLIENT -q "CREATE ROLE $TEST_ROLE_ENABLED_BY_DEFAULT" $CLICKHOUSE_CLIENT -q "GRANT SELECT ON $TEST_DB.$TEST_TABLE_ENABLED_BY_DEFAULT TO $TEST_ROLE_ENABLED_BY_DEFAULT"