Uh oh!
There was an error while loading. Please reload this page.
enh(contacts): show/hide addressbooks for all - #38397
Conversation
JohannesGGE
commented
May 22, 2023
Due to the different implementation of the recently contacted addressbook, the call for changing the enabled property can't be executed, and an "addressbook is immutable" is thrown in Other addressbooks call As far as I can tell the only needed code is the DB update of |
JohannesGGE
commented
May 23, 2023
Recently contacted address book will be tackled in another issue. |
| } | ||
| public function propPatch(PropPatch $propPatch) { | ||
| if (isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { |
There was a problem hiding this comment.
owner-principal seems to be set if the address book is shared, system or recently contacted. Own address books don't have this prop.
There was a problem hiding this comment.
The change also surprised me.
Apparently, this was added before the CustomPropertiesBackend: 95e218b
If we throw forbidden here, the CustomPropertiesBackend::propPatch is not executed?
| ] | ||
| ], | ||
| [ | ||
| 'privilege' => '{DAV:}write-properties', |
There was a problem hiding this comment.
so this means users are now allowed to update properties of all address books, right? are there any property changes we might not want? e.g. rename.
There was a problem hiding this comment.
just tested it with renaming, and it turns out the change of the name is not stored as a user prop but changes the real name, so the owner sees the change as well. I'll have a look in the code again to check where the distinction between the props is made.
There was a problem hiding this comment.
Should be the special logic in https://github.com/nextcloud/server/blob/master/apps/dav/lib/DAV/CustomPropertiesBackend.php
There was a problem hiding this comment.
@tcitworld As far as I understand it, the propPatch() in CustomPropertiesBackend.php is just called if the prop is a user prop. So the distinction is done somewhere before
JohannesGGE
commented
Jun 2, 2023
The addressbook is now checked for sharing. If it is shared the props will be saved as userProps. So even if the addressbook is renamed by user that is not the owner (not possible in the contacts app yet), the owners addressbook name isn't changed. For the case the addressbook has a userProp name, this name is shown now. |
| // substr of addressbooks/ => path is inside the CardDAV component | ||
| // three '/' => this a addressbook (no addressbook-home nor contact object) | ||
| if (substr($path, 0, 13) === 'addressbooks/' && substr_count($path, '/') === 3) { | ||
| $allRequestedProps = $propFind->getRequestedProperties(); | ||
| $customPropertiesForShares = [ | ||
| '{DAV:}displayname', | ||
| ]; | ||
| foreach ($customPropertiesForShares as $customPropertyForShares) { | ||
| if (in_array($customPropertyForShares, $allRequestedProps)) { | ||
| $requestedProps[] = $customPropertyForShares; | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
suggestion: I think there's a way to factorize this block with the block above in a single function which takes calendars and addressbooks specifics as parameters.
556aa6b to
60c9eb5CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
60c9eb5 to
7594644Compare7594644 to
dbb174aCompareSigned-off-by: Johannes Merkel <mail@johannesgge.de>
dbb174a to
bb80295Comparekesselb
commented
Jul 18, 2023
nitpick: enh(contacts) should be feat(contacts) according to https://www.conventionalcommits.org/en/v1.0.0/ |
miaulalala
commented
Aug 16, 2023
/backport to stable27 |
Summary
TODO
Checklist