mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #71250 from cwurm/missing_sources_grants
Add missing sources grants for Kafka, NATS and RabbitMQ
This commit is contained in:
commit
57fde54f10
@ -242,10 +242,13 @@ Hierarchy of privileges:
|
||||
- `HDFS`
|
||||
- `HIVE`
|
||||
- `JDBC`
|
||||
- `KAFKA`
|
||||
- `MONGO`
|
||||
- `MYSQL`
|
||||
- `NATS`
|
||||
- `ODBC`
|
||||
- `POSTGRES`
|
||||
- `RABBITMQ`
|
||||
- `REDIS`
|
||||
- `REMOTE`
|
||||
- `S3`
|
||||
@ -524,10 +527,13 @@ Allows using external data sources. Applies to [table engines](../../engines/tab
|
||||
- `HDFS`. Level: `GLOBAL`
|
||||
- `HIVE`. Level: `GLOBAL`
|
||||
- `JDBC`. Level: `GLOBAL`
|
||||
- `KAFKA`. Level: `GLOBAL`
|
||||
- `MONGO`. Level: `GLOBAL`
|
||||
- `MYSQL`. Level: `GLOBAL`
|
||||
- `NATS`. Level: `GLOBAL`
|
||||
- `ODBC`. Level: `GLOBAL`
|
||||
- `POSTGRES`. Level: `GLOBAL`
|
||||
- `RABBITMQ`. Level: `GLOBAL`
|
||||
- `REDIS`. Level: `GLOBAL`
|
||||
- `REMOTE`. Level: `GLOBAL`
|
||||
- `S3`. Level: `GLOBAL`
|
||||
|
@ -192,14 +192,23 @@ GRANT SELECT(x,y) ON db.table TO john WITH GRANT OPTION
|
||||
- `addressToSymbol`
|
||||
- `demangle`
|
||||
- [SOURCES](#grant-sources)
|
||||
- `AZURE`
|
||||
- `FILE`
|
||||
- `URL`
|
||||
- `REMOTE`
|
||||
- `MYSQL`
|
||||
- `ODBC`
|
||||
- `JDBC`
|
||||
- `HDFS`
|
||||
- `HIVE`
|
||||
- `JDBC`
|
||||
- `KAFKA`
|
||||
- `MONGO`
|
||||
- `MYSQL`
|
||||
- `NATS`
|
||||
- `ODBC`
|
||||
- `POSTGRES`
|
||||
- `RABBITMQ`
|
||||
- `REDIS`
|
||||
- `REMOTE`
|
||||
- `S3`
|
||||
- `SQLITE`
|
||||
- `URL`
|
||||
- [dictGet](#grant-dictget)
|
||||
|
||||
Примеры того, как трактуется данная иерархия:
|
||||
@ -461,14 +470,23 @@ GRANT INSERT(x,y) ON db.table TO john
|
||||
Разрешает использовать внешние источники данных. Применяется к [движкам таблиц](../../engines/table-engines/index.md) и [табличным функциям](../table-functions/index.md#table-functions).
|
||||
|
||||
- `SOURCES`. Уровень: `GROUP`
|
||||
- `AZURE`. Уровень: `GLOBAL`
|
||||
- `FILE`. Уровень: `GLOBAL`
|
||||
- `URL`. Уровень: `GLOBAL`
|
||||
- `REMOTE`. Уровень: `GLOBAL`
|
||||
- `MYSQL`. Уровень: `GLOBAL`
|
||||
- `ODBC`. Уровень: `GLOBAL`
|
||||
- `JDBC`. Уровень: `GLOBAL`
|
||||
- `HDFS`. Уровень: `GLOBAL`
|
||||
- `HIVE`. Уровень: `GLOBAL`
|
||||
- `JDBC`. Уровень: `GLOBAL`
|
||||
- `KAFKA`. Уровень: `GLOBAL`
|
||||
- `MONGO`. Уровень: `GLOBAL`
|
||||
- `MYSQL`. Уровень: `GLOBAL`
|
||||
- `NATS`. Уровень: `GLOBAL`
|
||||
- `ODBC`. Уровень: `GLOBAL`
|
||||
- `POSTGRES`. Уровень: `GLOBAL`
|
||||
- `RABBITMQ`. Уровень: `GLOBAL`
|
||||
- `REDIS`. Уровень: `GLOBAL`
|
||||
- `REMOTE`. Уровень: `GLOBAL`
|
||||
- `S3`. Уровень: `GLOBAL`
|
||||
- `SQLITE`. Уровень: `GLOBAL`
|
||||
- `URL`. Уровень: `GLOBAL`
|
||||
|
||||
Привилегия `SOURCES` разрешает использование всех источников. Также вы можете присвоить привилегию для каждого источника отдельно. Для использования источников необходимы дополнительные привилегии.
|
||||
|
||||
|
@ -170,14 +170,23 @@ GRANT SELECT(x,y) ON db.table TO john WITH GRANT OPTION
|
||||
- `addressToSymbol`
|
||||
- `demangle`
|
||||
- [SOURCES](#grant-sources)
|
||||
- `AZURE`
|
||||
- `FILE`
|
||||
- `URL`
|
||||
- `REMOTE`
|
||||
- `YSQL`
|
||||
- `ODBC`
|
||||
- `JDBC`
|
||||
- `HDFS`
|
||||
- `HIVE`
|
||||
- `JDBC`
|
||||
- `KAFKA`
|
||||
- `MONGO`
|
||||
- `MYSQL`
|
||||
- `NATS`
|
||||
- `ODBC`
|
||||
- `POSTGRES`
|
||||
- `RABBITMQ`
|
||||
- `REDIS`
|
||||
- `REMOTE`
|
||||
- `S3`
|
||||
- `SQLITE`
|
||||
- `URL`
|
||||
- [dictGet](#grant-dictget)
|
||||
|
||||
如何对待该层级的示例:
|
||||
@ -428,14 +437,23 @@ GRANT INSERT(x,y) ON db.table TO john
|
||||
允许在 [table engines](../../engines/table-engines/index.md) 和 [table functions](../../sql-reference/table-functions/index.md#table-functions)中使用外部数据源。
|
||||
|
||||
- `SOURCES`. 级别: `GROUP`
|
||||
- `AZURE`. 级别: `GLOBAL`
|
||||
- `FILE`. 级别: `GLOBAL`
|
||||
- `URL`. 级别: `GLOBAL`
|
||||
- `REMOTE`. 级别: `GLOBAL`
|
||||
- `YSQL`. 级别: `GLOBAL`
|
||||
- `ODBC`. 级别: `GLOBAL`
|
||||
- `JDBC`. 级别: `GLOBAL`
|
||||
- `HDFS`. 级别: `GLOBAL`
|
||||
- `HIVE`. 级别: `GLOBAL`
|
||||
- `JDBC`. 级别: `GLOBAL`
|
||||
- `KAFKA`. 级别: `GLOBAL`
|
||||
- `MONGO`. 级别: `GLOBAL`
|
||||
- `MYSQL`. 级别: `GLOBAL`
|
||||
- `NATS`. 级别: `GLOBAL`
|
||||
- `ODBC`. 级别: `GLOBAL`
|
||||
- `POSTGRES`. 级别: `GLOBAL`
|
||||
- `RABBITMQ`. 级别: `GLOBAL`
|
||||
- `REDIS`. 级别: `GLOBAL`
|
||||
- `REMOTE`. 级别: `GLOBAL`
|
||||
- `S3`. 级别: `GLOBAL`
|
||||
- `SQLITE`. 级别: `GLOBAL`
|
||||
- `URL`. 级别: `GLOBAL`
|
||||
|
||||
`SOURCES` 权限允许使用所有数据源。当然也可以单独对每个数据源进行授权。要使用数据源时,还需要额外的权限。
|
||||
|
||||
|
@ -243,6 +243,9 @@ enum class AccessType : uint8_t
|
||||
M(S3, "", GLOBAL, SOURCES) \
|
||||
M(HIVE, "", GLOBAL, SOURCES) \
|
||||
M(AZURE, "", GLOBAL, SOURCES) \
|
||||
M(KAFKA, "", GLOBAL, SOURCES) \
|
||||
M(NATS, "", GLOBAL, SOURCES) \
|
||||
M(RABBITMQ, "", GLOBAL, SOURCES) \
|
||||
M(SOURCES, "", GROUP, ALL) \
|
||||
\
|
||||
M(CLUSTER, "", GLOBAL, ALL) /* ON CLUSTER queries */ \
|
||||
|
@ -52,7 +52,10 @@ namespace
|
||||
{AccessType::HDFS, "HDFS"},
|
||||
{AccessType::S3, "S3"},
|
||||
{AccessType::HIVE, "Hive"},
|
||||
{AccessType::AZURE, "AzureBlobStorage"}
|
||||
{AccessType::AZURE, "AzureBlobStorage"},
|
||||
{AccessType::KAFKA, "Kafka"},
|
||||
{AccessType::NATS, "NATS"},
|
||||
{AccessType::RABBITMQ, "RabbitMQ"}
|
||||
};
|
||||
|
||||
|
||||
|
@ -308,6 +308,7 @@ void registerStorageKafka(StorageFactory & factory)
|
||||
creator_fn,
|
||||
StorageFactory::StorageFeatures{
|
||||
.supports_settings = true,
|
||||
.source_access_type = AccessType::KAFKA,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,13 @@ void registerStorageNATS(StorageFactory & factory)
|
||||
return std::make_shared<StorageNATS>(args.table_id, args.getContext(), args.columns, args.comment, std::move(nats_settings), args.mode);
|
||||
};
|
||||
|
||||
factory.registerStorage("NATS", creator_fn, StorageFactory::StorageFeatures{ .supports_settings = true, });
|
||||
factory.registerStorage(
|
||||
"NATS",
|
||||
creator_fn,
|
||||
StorageFactory::StorageFeatures{
|
||||
.supports_settings = true,
|
||||
.source_access_type = AccessType::NATS,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1322,7 +1322,13 @@ void registerStorageRabbitMQ(StorageFactory & factory)
|
||||
return std::make_shared<StorageRabbitMQ>(args.table_id, args.getContext(), args.columns, args.comment, std::move(rabbitmq_settings), args.mode);
|
||||
};
|
||||
|
||||
factory.registerStorage("RabbitMQ", creator_fn, StorageFactory::StorageFeatures{ .supports_settings = true, });
|
||||
factory.registerStorage(
|
||||
"RabbitMQ",
|
||||
creator_fn,
|
||||
StorageFactory::StorageFeatures{
|
||||
.supports_settings = true,
|
||||
.source_access_type = AccessType::RABBITMQ,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -189,6 +189,9 @@ HDFS [] GLOBAL SOURCES
|
||||
S3 [] GLOBAL SOURCES
|
||||
HIVE [] GLOBAL SOURCES
|
||||
AZURE [] GLOBAL SOURCES
|
||||
KAFKA [] GLOBAL SOURCES
|
||||
NATS [] GLOBAL SOURCES
|
||||
RABBITMQ [] GLOBAL SOURCES
|
||||
SOURCES [] \N ALL
|
||||
CLUSTER [] GLOBAL ALL
|
||||
ALL ['ALL PRIVILEGES'] \N \N
|
||||
|
Loading…
Reference in New Issue
Block a user