diff options
author | Georg Ehrke <developer@georgehrke.com> | 2020-08-04 07:57:07 +0200 |
---|---|---|
committer | Georg Ehrke <developer@georgehrke.com> | 2020-08-05 09:04:41 +0200 |
commit | b0c5457c422888f87b76f2b67f05917aed02a775 (patch) | |
tree | eb423d096287fb63d9a8a939c025ff6290b74393 /apps/dav/lib | |
parent | 1cf9f4281795610bfaf74af9e3f3f1c3c544c08c (diff) | |
download | nextcloud-server-b0c5457c422888f87b76f2b67f05917aed02a775.tar.gz nextcloud-server-b0c5457c422888f87b76f2b67f05917aed02a775.zip |
IAddressBook: add isShared and isSystemAddressBook
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/CardDAV/AddressBookImpl.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php index 6ec3fed8276..02dc7c5d015 100644 --- a/apps/dav/lib/CardDAV/AddressBookImpl.php +++ b/apps/dav/lib/CardDAV/AddressBookImpl.php @@ -281,12 +281,7 @@ class AddressBookImpl implements IAddressBook { } } - if ( - $this->addressBookInfo['principaluri'] === 'principals/system/system' && ( - $this->addressBookInfo['uri'] === 'system' || - $this->addressBookInfo['{DAV:}displayname'] === $this->urlGenerator->getBaseUrl() - ) - ) { + if ($this->isSystemAddressBook()) { $result['isLocalSystemBook'] = true; } return $result; @@ -309,4 +304,26 @@ class AddressBookImpl implements IAddressBook { return null; } + + /** + * @inheritDoc + */ + public function isShared(): bool { + if (!isset($this->addressBookInfo['{http://owncloud.org/ns}owner-principal'])) { + return false; + } + + return $this->addressBookInfo['principaluri'] + !== $this->addressBookInfo['{http://owncloud.org/ns}owner-principal']; + } + + /** + * @inheritDoc + */ + public function isSystemAddressBook(): bool { + return $this->addressBookInfo['principaluri'] === 'principals/system/system' && ( + $this->addressBookInfo['uri'] === 'system' || + $this->addressBookInfo['{DAV:}displayname'] === $this->urlGenerator->getBaseUrl() + ); + } } |