添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
魁梧的啄木鸟  ·  16、Flink 的table ...·  1 年前    · 
胡子拉碴的松球  ·  Resource stopwords ...·  1 年前    · 
狂野的马克杯  ·  RDweb 2019 Server - ...·  1 年前    · 
深情的炒粉  ·  Colossal-AI 低成本复现 ...·  1 年前    · 
年轻有为的热带鱼  ·  web服务挂了 ...·  1 年前    · 

假设Bob@aliyun.com为test_project_a的项目所有者,Worker为项目中的角色。命令示例如下。

describe role Worker;
[users]
RAM$Bob@aliyun.com:Allen
Authorization Type: ACL
A       projects/test_project_a: CreateTable | CreateResource | CreateInstance | CreateFunction | List
A       projects/test_project_a/tables/bank_data: Download    
Authorization Type: Policy
A       projects/test_project_a/tables/bak*: Download
A       projects/test_project_a/tables/sale_detail: Update
A       projects/test_project_a/tables/tb_*: Download | Drop
A       projects/test_project_a/tables/view_1: Drop

查询当前用户的权限及绑定的角色信息

  • 命令格式
    show grants;
  • 查询结果会返回如下信息:
  • 项目所有者:账号信息、项目列表信息。
  • 其他用户:绑定的角色信息、ACL、Policy及Download权限信息。
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。

  • 假设当前项目的访问者为Bob,执行 show grants; 命令,返回结果如下。
    [ALIYUN$Bob@aliyun.com]
    projects/test_project_a: Project Owner
  • 假设当前项目的访问者为Allen,执行 show grants; 命令,返回结果如下。
    [roles]
    worker
    Authorization Type: ACL
    [user/RAM$Bob@aliyun.com:Allen]
    A       projects/test_project_a: CreateTable | CreateResource | CreateInstance | CreateFunction | List
    A       projects/test_project_a/packages/project_test_b.datashare: Read
    Authorization Type: Policy
    [role/worker]
    A       projects/test_project_a/tables/tb_*: Drop | Download
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。

  • 查询Bob的权限信息,命令示例如下。
    show grants for ALIYUN$Bob@aliyun.com;
    返回结果如下。
    [ALIYUN$Bob@aliyun.com]
    projects/test_project_a: Project Owner
  • 查询Allen的权限信息,命令示例如下。
    show grants for RAM$Bob@aliyun.com:Allen;
    返回结果如下。
    [roles]
    worker
    Authorization Type: ACL
    [user/RAM$Bob@aliyun.com:Allen]
    A       projects/test_project_a: CreateTable | CreateResource | CreateInstance | CreateFunction | List
    A       projects/test_project_a/packages/project_test_b.datashare: Read
    Authorization Type: Policy
    [role/worker]
    A       projects/test_project_a/tables/tb_*: Drop | Download
  • 指定待查询对象的名称。
  • 项目名称:您可以登录 MaxCompute控制台 ,左上角切换地域后,即可在 项目管理 页签获取具体的MaxCompute项目名称。查询类型为Project时,只能查询当前Project的信息。
  • 表名称:您可以通过 MaxCompute客户端 执行 show tables; 命令获取表或视图名称。
  • 资源名称:您可以通过 MaxCompute客户端 执行 list resources; 命令获取资源名称。
  • 函数名称:您可以通过 MaxCompute客户端 执行 list functions; 命令获取函数名称。
  • 实例名称:您可以通过 MaxCompute客户端 执行 show instances; 命令获取实例ID。

    查看test_project_a项目中的对象授权信息。

  • 查询项目的权限信息,命令示例如下。
    show acl for test_project_a on type project;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       role/worker(projects/test_project_a): CreateTable | CreateResource | CreateInstance | CreateFunction | List
    A       role/worker1(projects/test_project_a): CreateTable | CreateResource | CreateInstance | CreateFunction | List
    A       role/worker2(projects/test_project_a): CreateTable | CreateResource | CreateInstance | CreateFunction
  • 查询表的权限信息,命令示例如下。
    show acl for sale_detail on type table;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    AG      object_creator/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       user/RAM$Bob@aliyun.com:Allen(acs:odps:*:projects/test_project_a/tables/sale_detail/customer_id): Describe | Select
    A       user/RAM$Bob@aliyun.com:Allen(acs:odps:*:projects/test_project_a/tables/sale_detail/shop_name): Describe | Select
  • 查询资源的权限信息,命令示例如下。
    show acl for udtf.jar on type resource;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    AG      object_creator/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       user/RAM$Bob@aliyun.com:Allen(acs:odps:*:projects/test_project_a/resources/udtf.jar): Read | Write
  • 查询函数的权限信息,命令示例如下。
    show acl for UDTFResource on type function;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    AG      object_creator/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       role/worker1(acs:odps:*:projects/test_project_a/registration/functions/udtfresource): Download
    A       user/RAM$Bob@aliyun.com:Allen(acs:odps:*:projects/test_project_a/registration/functions/udtfresource): All
  • 查询实例的权限信息,命令示例如下。
    show acl for 20220105031923461ghu**** on type instance;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    AG      object_creator/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       user/RAM$Bob@aliyun.com:Allen(acs:odps:*:projects/test_project_a/instances/20220105031923461ghu****): All
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。

  • 假设当前项目的访问者为Bob,执行 show label grants; 命令,返回结果如下。
    User Label: 0
    +--------------+--------------+--------------------------+
    | TableName    | GrantedLabel | Expires                  |
    +--------------+--------------+--------------------------+
    | bank_data    | 3            | 2022-07-04T16:30:47+0800 |
    +--------------+--------------+--------------------------+
    | bank_data_pt | 4            | 2022-07-04T16:36:04+0800 |
    +--------------+--------------+--------------------------+
  • 假设当前项目的访问者为Allen,执行 show label grants; 命令,返回结果如下。
    User Label: 1
    +-------------+--------------+--------------------------+
    | TableName   | GrantedLabel | Expires                  |
    +-------------+--------------+--------------------------+
    | sale_detail | 2            | 2022-01-09T11:43:27+0800 |
    +-------------+--------------+--------------------------+
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。

  • 假设当前项目的访问者为Bob,执行命令如下。
    show label 3 grants;
    返回结果如下。
    User Label: 0
    +--------------+--------------+--------------------------+
    | TableName    | GrantedLabel | Expires                  |
    +--------------+--------------+--------------------------+
    | bank_data    | 3            | 2022-07-04T16:30:47+0800 |
    +--------------+--------------+--------------------------+
  • 假设当前项目的访问者为Allen,执行命令如下。
    show label 2 grants;
    返回结果如下。
    User Label: 1
    +-------------+--------------+--------------------------+
    | TableName   | GrantedLabel | Expires                  |
    +-------------+--------------+--------------------------+
    | sale_detail | 2            | 2022-01-09T11:43:27+0800 |
    +-------------+--------------+--------------------------+
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。查询Allen可访问的高敏感等级数据表,命令示例如下。

    show label grants for user RAM$Bob@aliyun.com:Allen;
    返回结果如下。
    User Label: 2
    +-----------+--------------+--------------------------+
    | TableName | GrantedLabel | Expires                  |
    +-----------+--------------+--------------------------+
    | bank_data | 3            | 2022-07-04T16:29:32+0800 |
    +-----------+--------------+--------------------------+

    查询指定用户可访问的指定等级的高敏感数据表

  • 命令格式
    show label <level> grants for user <user_name>;
  • 假设Bob@aliyun.com为test_project_a的项目所有者,Allen为隶属于test_project_a的RAM用户,已经被添加到test_project_a中。查询Allen可访问的高敏感等级数据表,命令示例如下。

    show label 3 grants for user RAM$Bob@aliyun.com:Allen;
    返回结果如下。
    User Label: 2
    +-----------+--------------+--------------------------+
    | TableName | GrantedLabel | Expires                  |
    +-----------+--------------+--------------------------+
    | bank_data | 3            | 2022-07-04T16:29:32+0800 |
    +-----------+--------------+--------------------------+

    查询可以访问指定敏感数据表的用户

  • 命令格式
    show label grants on table <table_name>;
  • 查询项目test_project_a中可访问高敏感数据表sale_detail的用户列表,命令示例如下。

    show label grants on table sale_detail;
    返回结果如下。
    Sensitive Label Range: [3, 4]
    +-------------------------------------------------+--------------+--------------------------+
    | UserName                                        | GrantedLabel | Expires                  |
    +-------------------------------------------------+--------------+--------------------------+
    | worker                                          | 4            | 2022-07-04T11:23:35+0800 |
    +-------------------------------------------------+--------------+--------------------------+
    | RAM$Bob@aliyun.com:Allen                        | 4            | 2022-07-04T17:54:00+0800 |
    +-------------------------------------------------+--------------+--------------------------+

    查询可以访问指定敏感数据表的指定等级的用户

  • 命令格式
    show label <level> grants on table <table_name>;
  • 查询项目test_project_a中可访问高敏感数据表sale_detail的用户列表,命令示例如下。

    show label 4 grants on table sale_detail;
    返回结果如下。
    Sensitive Label Range: [3, 4]
    +-------------------------------------------------+--------------+--------------------------+
    | UserName                                        | GrantedLabel | Expires                  |
    +-------------------------------------------------+--------------+--------------------------+
    | worker                                          | 4            | 2022-07-04T11:23:35+0800 |
    +-------------------------------------------------+--------------+--------------------------+
    | RAM$Bob@aliyun.com:Allen                        | 4            | 2022-07-04T17:54:00+0800 |
    +-------------------------------------------------+--------------+--------------------------+

    查询指定用户在指定敏感数据表中的权限

  • 命令格式
    show label [<label>] grants on table <table_name> for user <user_name>;
  • 查询项目test_project_a中Allen可访问sale_detail的数据,命令示例如下。

    show label grants on table sale_detail for user RAM$Bob@aliyun.com:Allen;
    返回结果如下。
    User Label: 2
    +-------------+--------------+--------------------------+
    | Column      | GrantedLabel | Expires                  |
    +-------------+--------------+--------------------------+
    | customer_id | 4            | 2022-07-04T17:54:00+0800 |
    +-------------+--------------+--------------------------+
    | shop_name   | 4            | 2022-07-04T17:54:00+0800 |
    +-------------+--------------+--------------------------+
    | total_price | 4            | 2022-07-04T17:54:00+0800 |
    +-------------+--------------+--------------------------+

    查询指定表中所有列的敏感等级

  • 命令格式
    describe <table_name>;
  • 查询项目test_project_a中表sale_detail及其列的敏感等级,命令示例如下。

    describe sale_detail;
    返回结果如下。
    +------------------------------------------------------------------------------------+
    | Owner: ALIYUN$Bob@aliyun.com | Project: project_test_a                             |
    | TableComment:                                                                      |
    +------------------------------------------------------------------------------------+
    | CreateTime:               2021-12-13 11:27:04                                      |
    | LastDDLTime:              2021-12-13 11:27:04                                      |
    | LastModifiedTime:         2021-12-13 11:27:26                                      |
    +------------------------------------------------------------------------------------+
    | TableLabel:               3                                                        |
    | MaxLabel:                 L4                                                       |
    +------------------------------------------------------------------------------------+
    | InternalTable: YES      | Size: 784                                                |
    +------------------------------------------------------------------------------------+
    | Native Columns:                                                                    |
    +------------------------------------------------------------------------------------+
    | Field           | Type       | Label | Comment                                     |
    +------------------------------------------------------------------------------------+
    | shop_name       | string     | 4     |                                             |
    | customer_id     | string     | 4     |                                             |
    | total_price     | double     | 3     |                                             |
    +------------------------------------------------------------------------------------+
    | Partition Columns:                                                                 |
    +------------------------------------------------------------------------------------+
    | sale_date       | string     |                                                     |
    | region          | string     |                                                     |
    +------------------------------------------------------------------------------------+

    查询指定Package的授权信息

  • 命令格式
    show acl for <project_name>.<package_name> on type package;
  • 查看test_project_b项目中安装的datashare Package的授权信息。命令示例如下。
    show acl for test_project_b.datashare on type package;
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/ALIYUN$Bob@aliyun.com: All
    AG      admin/ALIYUN$Bob@aliyun.com: All
    Authorization Type: ACL
    A       user/RAM$Amy@aliyun.com:Bella(acs:odps:*:projects/test_project_b/packages/test_project_a.datashare): Read

    查询指定Package内资源的授权信息

  • 命令格式
    show grants on <object_type> <object_name> privilegeproperties ("refobject"="true", "refproject"="<project_name>", "package"="<package
    _name>");
  • 查看安装的datashare Package中表sale_detail的授权信息。命令示例如下。
    show grants on Table sale_detail privilegeproperties ("refobject"="true", "refproject"="test_project_a", "package"="datashare");
    返回结果如下。
    Authorization Type: Implicit
    AG      project_owner/: All
    Authorization Type: InstalledObjecACL
    [datashare]
    A       user/RAM$Amy@aliyun.com:Bella(acs:odps:*:projects/test_project_a/tables/sale_detail): Select

    查询指定Package内表的Label授权信息

  • 命令格式
    show label grants on table <table_name> privilegeproperties ("refobject"="true", "refproject"="<project_name>", "package"="<package_name>");
  • 查看安装的datashare Package中表sale_detail的Label授权信息。命令示例如下。
    show label grants on table sale_detail privilegeproperties ("refobject"="true", "refproject"="test_project_a", "package"="datashare");
    返回结果如下。
    Sensitive Label Range: [2, 4]
    +-------------------------------------------------+--------------+--------------------------+
    | UserName                                        | GrantedLabel | Expires                  |
    +-------------------------------------------------+--------------+--------------------------+
    | RAM$Amy@aliyun.com:Bella                        | 3            | 2022-07-12T22:24:24+0800 |
    +-------------------------------------------------+--------------+--------------------------+