CK主要通过users.xml文件做用户权限控制,主要通过用户角色、数据库账号定义、权限管理等来进行控制。
一、用户角色profile
1、重要参数解释
- profile : 每个profile相当于一个数据库用户角色,方便后续数据库账号授权时进行复用,默认为default,可自定义创建
- max_memory_usage : 内存使用大小,可通过min、max设置其上下限。
- distributed_product_mode : 分布式查询模式,默认开启。
- readonly :读写权限限制。0:不进行任何限制(默认值); 1:只拥有读权限(只能执行 SELECT、 EXISTS、 SHOW 和 DESCRIBE) ; 2:拥有读权限和设置权限(在读权限基础上,增加了 SET查询)。
- allow ddl : DDL权限。0:不允许 DDL查询; 1: 允许 DDL查询(默认值)。
2、示例
<!-- Profiles of settings. -->
<profiles>
<!-- Default settings. -->
<default> <!--默认default角色-->
<max_memory_usage>10000000000</max_memory_usage>
<use_uncompressed_cache>0</use_uncompressed_cache>
<load_balancing>random</load_balancing>
</default>
<rw_role> <!--超级读写权限角色-->
<distributed_product_mode>allow</distributed_product_mode>
<constraints>
<max_memory_usage>
<min>5000000000</min>
<max>20000000000</max>
</max_memory_usage>
</constraints>
<readonly>0</readonly>
<allow_ddl>1</allow_ddl>
</rw_role>
<ro_role> <!--拥有set权限的读权限角色-->
<distributed_product_mode>allow</distributed_product_mode>
<constraints>
<max_memo