server
server copied to clipboard
feat(dav): expose system address book
- Fixes #37797
Summary
Expose the system address book
How to test
Enable share enumeration in the backend

to see all users.
In the contacts app, the users will have the address book "system":

Disable it to see the logged in user only:
| With enumeration | Without enumeration |
|---|---|
![]() |
![]() |
You can also check the DAV url

To Do
- [ ] check if renaming address book to something else but "system" for the new user principal collection is possible to avoid naming conflicts
- [ ] Rename the principal collection Display name to "Accounts" for the sabre collection.
Checklist
- Code is properly formatted
- Sign-off message is added to all commits
- [ ] Tests (unit, integration, api and/or acceptance) are included
- [ ] https://github.com/nextcloud/documentation/issues/10021
- [ ] https://github.com/nextcloud/documentation/issues/10020
I tested this locally (without federation). I'm impressed! It works quite good.
However, the contacts in the system address book are not indicated to be read-only. The fields can't actually be edited though because saving fails. Could this be a problem with the ACLS of the system address book?
That's a good question. Can you tell me which acls get sent to the frontend? Maybe that needs a fix somewhere - the acls are set to read only in \OCA\DAV\CardDAV\AddressBook::getACL but could be that the data is lost along the way.
From @ChristophWurst for how we handle the share enumeration:
0) No checkbox checked -> Show only the same user
1) Only "Allow username autocompletion in share dialog" -> show everyone
2) "Allow username autocompletion in share dialog" + "Allow username autocompletion to users within the same groups" -> show only users in intersecting groups
3) "Allow username autocompletion in share dialog" + "Allow username autocompletion to users based on phone number integration" -> show only the same user
4) "Allow username autocompletion in share dialog" + "Allow username autocompletion to users within the same groups" + "Allow username autocompletion to users based on phone number integration" -> show only users in intersecting groups
This PR is currently blocked from merge
- [x] Requires https://github.com/nextcloud/server/pull/38048
- [ ] Requires https://github.com/nextcloud/server/pull/38013
Yesss, drone is passing
Checked current behavior with @jancborchardt
- System contacts should show in the contacts menu – they do :heavy_check_mark:
- System contacts should not show in the sharing dialogue – they do not :heavy_check_mark:
Group enumeration breaks at the moment because the User session at the time of passing the object to the AddressBookRoot is still null.
Authentication happpens when adding the Auth plugin:
https://github.com/nextcloud/server/blob/9e9133a86368cac55879e469069e10c687264dc7/apps/dav/appinfo/v1/carddav.php#L91
Which calls check() on the authBackend. Can't move the calls around as the addressbookroot is needed to be added as a node to the server.
Group enumeration breaks at the moment because the User session at the time of passing the object to the AddressBookRoot is still null.
Is it just the order of execution? Inject the IUserSession and fetch the IUser object as late as possible. Would that help?
Inject the IUserSession and fetch the IUser object as late as possible. Would that help?
Works. Changing that now.
Rebasing
Testet with contacts app:
- [x] I can delete the system adress book in the settings :upside_down_face:
- [ ] (Currently no option to disable the adressbook (same as recently contacted). Could be done in another issue but important for large sysAddBooks I think)
Integration test failure is the ususal contact menu Psalm fails randomly, possibly fixed by https://github.com/nextcloud/server/pull/38195
Cannot get help in forums, cannot get any answer here. Not sure it's worth spending any more time with this.

