server icon indicating copy to clipboard operation
server copied to clipboard

feat(dav): expose system address book

Open miaulalala opened this issue 2 years ago • 2 comments
trafficstars

  • Fixes #37797

Summary

Expose the system address book

How to test

Enable share enumeration in the backend

image

to see all users.

In the contacts app, the users will have the address book "system":

image

Disable it to see the logged in user only:

With enumeration Without enumeration
image image

You can also check the DAV url /remote.php/dav/addressbooks/users/ to see the new system address book:

image

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

miaulalala avatar Apr 14 '23 12:04 miaulalala

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.

miaulalala avatar Apr 26 '23 09:04 miaulalala

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

miaulalala avatar Apr 26 '23 10:04 miaulalala

This PR is currently blocked from merge

  • [x] Requires https://github.com/nextcloud/server/pull/38048
  • [ ] Requires https://github.com/nextcloud/server/pull/38013

ChristophWurst avatar May 05 '23 11:05 ChristophWurst

Yesss, drone is passing

miaulalala avatar May 08 '23 14:05 miaulalala

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:

ChristophWurst avatar May 10 '23 14:05 ChristophWurst

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.

miaulalala avatar May 10 '23 20:05 miaulalala

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?

ChristophWurst avatar May 11 '23 06:05 ChristophWurst

Inject the IUserSession and fetch the IUser object as late as possible. Would that help?

Works. Changing that now.

ChristophWurst avatar May 11 '23 08:05 ChristophWurst

Rebasing

ChristophWurst avatar May 11 '23 11:05 ChristophWurst

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)

JohannesGGE avatar May 11 '23 13:05 JohannesGGE

Integration test failure is the ususal contact menu Psalm fails randomly, possibly fixed by https://github.com/nextcloud/server/pull/38195

ChristophWurst avatar May 12 '23 06:05 ChristophWurst

Cannot get help in forums, cannot get any answer here. Not sure it's worth spending any more time with this.

dac2020 avatar Aug 29 '23 22:08 dac2020