mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
add test to access rights
This commit is contained in:
parent
fc17936c12
commit
dafc6d32ef
@ -0,0 +1,3 @@
|
||||
Not enough privileges
|
||||
1 a
|
||||
2 b
|
38
tests/queries/0_stateless/02015_async_inserts_4.sh
Executable file
38
tests/queries/0_stateless/02015_async_inserts_4.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck source=../shell_config.sh
|
||||
. "$CURDIR"/../shell_config.sh
|
||||
|
||||
url="${CLICKHOUSE_URL}&async_insert_mode=1&wait_for_async_insert=1"
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "DROP USER IF EXISTS u_02015_allowed"
|
||||
${CLICKHOUSE_CLIENT} -q "DROP USER IF EXISTS u_02015_denied"
|
||||
${CLICKHOUSE_CLIENT} -q "DROP ROLE IF EXISTS role_02015"
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "CREATE ROLE role_02015"
|
||||
${CLICKHOUSE_CLIENT} -q "CREATE USER u_02015_allowed";
|
||||
${CLICKHOUSE_CLIENT} -q "CREATE USER u_02015_denied";
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "REVOKE ALL ON *.* FROM u_02015_allowed"
|
||||
${CLICKHOUSE_CLIENT} -q "REVOKE ALL ON *.* FROM u_02015_denied"
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "DROP TABLE IF EXISTS async_inserts"
|
||||
${CLICKHOUSE_CLIENT} -q "CREATE TABLE async_inserts (id UInt32, s String) ENGINE = MergeTree ORDER BY id"
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "GRANT INSERT ON async_inserts TO role_02015"
|
||||
${CLICKHOUSE_CLIENT} -q "GRANT role_02015 to u_02015_allowed"
|
||||
|
||||
${CLICKHOUSE_CURL} -sS "$url&user=u_02015_denied" \
|
||||
-d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 1, "s": "a"} {"id": 2, "s": "b"}' \
|
||||
| grep -o "Not enough privileges"
|
||||
|
||||
${CLICKHOUSE_CURL} -sS "$url&user=u_02015_allowed" \
|
||||
-d 'INSERT INTO async_inserts FORMAT JSONEachRow {"id": 1, "s": "a"} {"id": 2, "s": "b"}'
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "SELECT * FROM async_inserts ORDER BY id"
|
||||
|
||||
${CLICKHOUSE_CLIENT} -q "DROP TABLE async_inserts"
|
||||
${CLICKHOUSE_CLIENT} -q "DROP USER u_02015_allowed"
|
||||
${CLICKHOUSE_CLIENT} -q "DROP USER u_02015_denied"
|
||||
${CLICKHOUSE_CLIENT} -q "DROP ROLE role_02015"
|
Loading…
Reference in New Issue
Block a user