Skip to content

Commit

Permalink
Fix pass set rights
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Jan 15, 2024
1 parent 20334a3 commit fa5a9bc
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## 3.0.2 - 2024-01-15
[Full Changelog](https://github.com/zimbra-api/soap-api/compare/3.0.1...3.0.2)

* Fix pass set rights

## 3.0.1 - 2023-10-03
[Full Changelog](https://github.com/zimbra-api/soap-api/compare/3.0.0...3.0.1)

Expand Down
4 changes: 2 additions & 2 deletions src/Mail/Struct/ActionGrantSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ public function getRights(): string
public function setRights(string $rights): self
{
$validRights = [];
foreach (explode(',', $rights) as $right) {
foreach (str_split($rights) as $right) {
if (ActionGrantRight::tryFrom($right) && !in_array($right, $validRights)) {
$validRights[] = $right;
}
}
$this->rights = implode(',', $validRights);
$this->rights = implode($validRights);
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mail/Struct/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ public function getPerm(): string
public function setPerm(string $perm): self
{
$validRights = [];
foreach (explode(',', $perm) as $right) {
foreach (str_split($perm) as $right) {
if (ActionGrantRight::tryFrom($right) && !in_array($right, $validRights)) {
$validRights[] = $right;
}
}
$this->perm = implode(',', $validRights);
$this->perm = implode($validRights);
return $this;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Mail/MailApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ public function testCreateFolder()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [\Zimbra\Common\Enum\ActionGrantRight::READ->value, \Zimbra\Common\Enum\ActionGrantRight::WRITE->value]);
$grantRight = implode([\Zimbra\Common\Enum\ActionGrantRight::READ->value, \Zimbra\Common\Enum\ActionGrantRight::WRITE->value]);
$granteeType = \Zimbra\Common\Enum\GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down Expand Up @@ -3034,7 +3034,7 @@ public function testGetFolder()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [\Zimbra\Common\Enum\ActionGrantRight::READ->value, \Zimbra\Common\Enum\ActionGrantRight::WRITE->value]);
$grantRight = implode([\Zimbra\Common\Enum\ActionGrantRight::READ->value, \Zimbra\Common\Enum\ActionGrantRight::WRITE->value]);
$granteeType = \Zimbra\Common\Enum\GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
4 changes: 2 additions & 2 deletions tests/Mail/Message/CreateFolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testCreateFolder()
$color = $this->faker->numberBetween(0, 127);
$rgb = $this->faker->hexcolor;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantType = GranteeType::USR;
$zimbraId = $this->faker->uuid;
$displayName = $this->faker->name;
Expand Down Expand Up @@ -75,7 +75,7 @@ public function testCreateFolder()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantRight = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Message/DocumentActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testDocumentAction()
$zimbraId = $this->faker->uuid;
$grantType = GranteeType::USR;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$expiry = $this->faker->randomNumber;
$displayName = $this->faker->name;
$args = $this->faker->word;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Message/FolderActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testFolderAction()
$nonExistentIds = $this->faker->uuid;
$newlyCreatedIds = $this->faker->uuid;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$displayName = $this->faker->name;
$args = $this->faker->word;
$password = $this->faker->word;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Message/GetFolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function testGetFolder()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantRight = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/AclTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function testAcl()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$perm = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$perm = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/ActionGrantSelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ActionGrantSelectorTest extends ZimbraTestCase
{
public function testActionGrantSelector()
{
$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantType = GranteeType::USR;
$zimbraId = $this->faker->uuid;
$displayName = $this->faker->name;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/CommonDocumentInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testCommonDocumentInfo()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantRight = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/DocumentActionGrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DocumentActionGrantTest extends ZimbraTestCase
{
public function testDocumentActionGrant()
{
$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantType = GranteeType::USR;
$expiry = $this->faker->randomNumber;
$zimbraId = $this->faker->uuid;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/DocumentActionSelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testDocumentActionSelector()
$zimbraId = $this->faker->uuid;
$grantType = GranteeType::USR;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$expiry = $this->faker->randomNumber;
$displayName = $this->faker->name;
$args = $this->faker->word;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/FolderActionSelectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testFolderActionSelector()
$view = $this->faker->word;
$numDays = $this->faker->randomNumber;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$displayName = $this->faker->name;
$args = $this->faker->word;
$password = $this->faker->word;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/FolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testFolder()
$internalGrantExpiry = $this->faker->randomNumber;
$guestGrantExpiry = $this->faker->randomNumber;

$grantRight = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantRight = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/GrantTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class GrantTest extends ZimbraTestCase
{
public function testGrant()
{
$perm = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$perm = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$granteeType = GrantGranteeType::USR;
$granteeId = $this->faker->uuid;
$expiry = $this->faker->unixTime;
Expand Down
2 changes: 1 addition & 1 deletion tests/Mail/Struct/NewFolderSpecTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function testNewFolderSpec()
$rgb = $this->faker->hexcolor;
$url = $this->faker->word;

$rights = implode(',', [ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$rights = implode([ActionGrantRight::READ->value, ActionGrantRight::WRITE->value]);
$grantType = GranteeType::USR;
$zimbraId = $this->faker->uuid;
$displayName = $this->faker->name;
Expand Down

0 comments on commit fa5a9bc

Please sign in to comment.