owner = new Grantee($id, $displayName ?: $id, GranteeType::USER); return $this; } /** * Create and store a Grant with a CanonicalUser Grantee for the ACL * * @param string $permission Permission for the Grant * @param string $id Grantee identifier * @param string $displayName Grantee display name * * @return $this */ public function addGrantForUser($permission, $id, $displayName = null) { $grantee = new Grantee($id, $displayName ?: $id, GranteeType::USER); $this->addGrant($permission, $grantee); return $this; } /** * Create and store a Grant with a AmazonCustomerByEmail Grantee for the ACL * * @param string $permission Permission for the Grant * @param string $email Grantee email address * * @return $this */ public function addGrantForEmail($permission, $email) { $grantee = new Grantee($email, null, GranteeType::EMAIL); $this->addGrant($permission, $grantee); return $this; } /** * Create and store a Grant with a Group Grantee for the ACL * * @param string $permission Permission for the Grant * @param string $group Grantee group * * @return $this */ public function addGrantForGroup($permission, $group) { $grantee = new Grantee($group, null, GranteeType::GROUP); $this->addGrant($permission, $grantee); return $this; } /** * Create and store a Grant for the ACL * * @param string $permission Permission for the Grant * @param Grantee $grantee The Grantee for the Grant * * @return $this */ public function addGrant($permission, Grantee $grantee) { $this->grants[] = new Grant($grantee, $permission); return $this; } /** * Builds the ACP and returns it * * @return Acp */ public function build() { return new Acp($this->owner, $this->grants); } }