zimbra-api / soap-api

Zimbra SOAP client in PHP language
BSD 3-Clause "New" or "Revised" License
62 stars 48 forks source link

request to change permission insertion format in setRights() for folders #59

Open marco76mk opened 8 months ago

marco76mk commented 8 months ago

Hello, I suggest a change in the zimbra-api/soap-api/src/Mail/Struct/ActionGrantSelector.php file for the setRights() function.

From this:

       foreach (explode(',', $rights) as $right) {
            if (ActionGrantRight::tryFrom($right) && !in_array($right, $validRights)) {
                $validRights[] = $right;
            }
        }
        $this->rights = implode(',', $validRights);

A this:

        foreach (str_split($rights) as $right) {
            if (ActionGrantRight::tryFrom($right) && !in_array($right, $validRights)) {
                $validRights[] = $right;
            }
        }
        $this->rights = implode('', $validRights);

with this change we can pass permissions in the "natural" way they are used on zimbra bees.

for example with bees in zimbra you have to enter the permissions like this "rwixd" while here we must separate the permissions by comma "r,w,i,x,d" Is there a particular reason why it was chosen to use comma separated parameters?

If we do a get permission they are returned to us without a comma. Wouldn't it be better if the entry in setRights() was also without the comma? They can still be validated as suggested in the modification I proposed. Or am I doing something wrong?

Thank you