/** * @depends testPutAndGetObject */ public function testObjectAcl() { $object_name = "test.txt"; $acl = self::$fds_client->getObjectAcl(self::$bucket_name, $object_name); $this->assertNotNull($acl); // TODO(wuzesheng) Fix the delete bucket issue // $this->assertEquals(1, count($acl->getGrantList())); $acl_to_set = new AccessControlList(); $acl_to_set->addGrant(new Grant(new Grantee("test"), Permission::READ)); self::$fds_client->setObjectAcl(self::$bucket_name, $object_name, $acl_to_set); $got_acl = self::$fds_client->getObjectAcl(self::$bucket_name, $object_name); $this->assertNotNull($got_acl); $grants = $got_acl->getGrantList(); $grantees = array(); foreach ($grants as $key => $value) { $grantees[$key] = $value->getGrantee()->getId(); } $this->assertEquals(2, count($grantees)); sort($grantees); }
public function setPublic($bucket_name, $object_name) { $acl = new AccessControlList(); $grant = new Grant(new Grantee(UserGroups::ALL_USERS), Permission::READ); $grant->setType(GrantType::GROUP); $acl->addGrant($grant); $this->setObjectAcl($bucket_name, $object_name, $acl); }