图引擎服务 GES-GES自定义策略:GES自定义策略样例

时间:2024-11-01 17:19:41

GES自定义策略样例

  • 示例1:授权用户拥有查询类权限、操作图权限
    { 
        "Version": "1.1", 
        "Statement": [ 
            { 
                "Effect": "Allow", 
                "Action": [ 
                         "ges:*:get*",
                         "ges:*:list*",
                         "ges:graph:operate"
                ] 
            } 
        ] 
    }
  • 示例2:拒绝用户删除图

    拒绝策略需要同时配合其他策略使用,否则没有实际作用。用户被授予的策略中,一个授权项的作用如果同时存在Allow和Deny,则遵循Deny优先。

    如果您给用户授予GES FullAccess的系统策略,但不希望用户拥有GES FullAccess中定义的删除图权限,您可以创建一条拒绝删除独享集群的自定义策略,然后同时将GES FullAccess和拒绝策略授予用户,根据Deny优先原则,则用户可以对GES执行除了删除图外的所有操作。拒绝策略示例如下:

    { 
          "Version": "1.1", 
          "Statement": [ 
                { 
    		  "Effect": "Deny", 
                      "Action": [ 
                            "ges:graph:delete" 
                      ] 
                } 
          ] 
    }
  • 示例3:授权用户操作图名称前缀为ges_project的图(ges_project名字不区分大小写),访问图列表。
    {
        "Version": "1.1",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "ges:graph:create",
                    "ges:graph:delete",
                    "ges:graph:access",
                    "ges:graph:getDetail"
                ],
                "Resource": [
                    "ges:*:*:graphName:ges_project*"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "ges:graph:list"
                ]
            }
        ]
    }
  • 示例4:授权用户操作部分图资源,查看所有资源。

    该策略分为两部分:

    • 第一部分:授权用户操作资源名称前缀为ges_project的资源,资源包含图、备份。
    • 第二部分:授权用户查询图列表、查询备份列表、查询任务列表、查询元数据列表、查看job详情。
    {
        "Version": "1.1",
        "Statement": [
            {
                "Action": [
                    "ges:backup:delete",
                    "ges:graph:access",
                    "ges:graph:operate",
                    "ges:graph:delete",
                    "ges:graph:create",
                    "ges:backup:create",
                    "ges:graph:getDetail"
                ],
                "Resource": [
                    "ges:*:*:backupName:ges_project*",
                    "ges:*:*:graphName:ges_project*" 
                ],
                "Effect": "Allow"
            },
            {
                "Action": [
                    "ges:graph:list",
                    "ges:backup:list",
                    "ges:jobs:list",
                    "ges:metadata:list",
                    "ges:jobs:getDetail"
                ],
                "Effect": "Allow"
            }
        ]
    }
support.huaweicloud.com/usermanual-ges/ges_01_0075.html