Horde_Perms_Permission_Kolab::save PHP Method

save() public method

Saves the current permission values from the cache to the IMAP folder.
public save ( )
    public function save()
    {
        /* @todo: If somebody else accessed the folder before us, we will
         * overwrite the change here. */
        $current = $this->getCurrentPermissions();
        $owner = $this->_storage->getOwner();
        $elements = new Horde_Perms_Permission_Kolab_ElementIterator($this->data, $this->_groups);
        foreach ($elements as $element) {
            if ($owner == $element->getId()) {
                continue;
            }
            $this->_storage->setAcl($element->getId(), $element->fromHorde());
            $element->unsetInCurrent($current);
        }
        // Delete ACLs that have been removed
        $elements = new Horde_Perms_Permission_Kolab_ElementIterator($current, $this->_groups);
        foreach ($elements as $element) {
            if ($owner == $element->getId()) {
                continue;
            }
            $this->_storage->deleteAcl($element->getId());
        }
        // Load the permission from the folder again
        $this->data = $this->getCurrentPermissions();
    }