管理访问

管理访问

  • 用户具有账户角色。例如,一个具有管理员角色的用户具有对所有容器和对象的完全访问权限。可以在容器级别设置访问控制(AVLs), 具体通过设置``X-Container-Read`` 和 X-Container-Write 请求头提供读写权限。

    To give a user read access, use the swift post command with the -r parameter. To give a user write access, use the -w parameter.

  • 以下是`read`容器的ACLs的示例:

    带有任意HTTP referer请求头的请求可以读取容器内容:

    $ swift post CONTAINER -r ".r:*"
    

    带有任意HTTP referer请求头的请求可以读取并列出容器内容:

    $ swift post CONTAINER -r ".r:*,.rlistings"
    

    用于读取容器内容的合法的HTTP referer 请求头列表:

    $ swift post CONTAINER -r \
      ".r:openstack.example.com,.r:swift.example.com,.r:storage.example.com"
    

    用于读取容器内容的非法的HTTP referer 请求头列表:

    $ swift post CONTAINER -r \
      ".r:*,.r:-openstack.example.com,.r:-swift.example.com,.r:-storage.example.com"
    

    project1中的所有用户都可以读取容器内容:

    $ swift post CONTAINER -r "project1:*"
    

    project1中的User1可以读取容器内容:

    $ swift post CONTAINER -r "project1:user1"
    

    允许读取容器内容用户和项目:

    $ swift post CONTAINER -r \
      "project1:user1,project1:user2,project3:*,project4:user1"
    
  • 以下是容器的write` ACLs示例:

    project1中的所有用户都可以写入容器内容:

    $ swift post CONTAINER -w "project1:*"
    

    project1中的User1可以写入容器内容:

    $ swift post CONTAINER -w "project1:user1"
    

    允许写入容器的特定用户和项目的列表:

    $ swift post CONTAINER -w \
      "project1:user1,project1:user2,project3:*,project4:user1"
    

注解

要成功写入容器,用户除对容器具有写权限外还要有读权限。前面的所有读写ACL的例子中,项目名和用户名均可替换为项目或用户的UUID, 即``<project_uuid>:<user_uuid>``. 如果使用多个keystone域,必须采用UUID格式。

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.