-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
enh(contacts): show/hide addressbooks for all #38397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
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 |
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this dropped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change also surprised me.
Apparently, this was added before the CustomPropertiesBackend: 95e218b
If we throw forbidden here, the CustomPropertiesBackend::propPatch is not executed?
apps/dav/lib/CardDAV/AddressBook.php
Outdated
| ] | ||
| ], | ||
| [ | ||
| 'privilege' => '{DAV:}write-properties', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
60c9eb5
Compare
60c9eb5 to
7594644
Compare
7594644 to
dbb174a
Compare
Signed-off-by: Johannes Merkel <[email protected]>
dbb174a to
bb80295
Compare
|
nitpick: enh(contacts) should be feat(contacts) according to https://www.conventionalcommits.org/en/v1.0.0/ |
kesselb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done 🎉
|
/backport to stable27 |
Summary
TODO
Checklist