summaryrefslogtreecommitdiffstats
path: root/apps/contacts/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-03 11:11:01 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-03 11:11:01 -0400
commit4185bd629259bfb0618143d0474e192e969daf96 (patch)
tree4c11d087652a0d84bda93fbdfe72462c8c2f6008 /apps/contacts/lib
parent77b582e4e6629d228344e11a24954507f8854979 (diff)
downloadnextcloud-server-4185bd629259bfb0618143d0474e192e969daf96.tar.gz
nextcloud-server-4185bd629259bfb0618143d0474e192e969daf96.zip
Load shared addressbooks inside OC_Contacts_Addressbook instead of the index, add public functions getItemShared(With)BySource() for contacts app
Diffstat (limited to 'apps/contacts/lib')
-rw-r--r--apps/contacts/lib/addressbook.php2
-rw-r--r--apps/contacts/lib/app.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 86a41b18cf3..afbf1d59201 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -58,7 +58,7 @@ class OC_Contacts_Addressbook{
while( $row = $result->fetchRow()){
$addressbooks[] = $row;
}
-
+ $addressbooks = array_merge($addressbooks, OCP\Share::getItemsSharedWith('addressbook', OC_Contacts_Share::FORMAT_ADDRESSBOOKS));
return $addressbooks;
}
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 29428763d60..ce66624c8f9 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -24,7 +24,7 @@ class OC_Contacts_App {
public static function getAddressbook($id) {
$addressbook = OC_Contacts_Addressbook::find( $id );
- if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
+ if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser() && !OCP\Share::getItemSharedWithBySource('addressbook', $id)) {
if ($addressbook === false) {
OCP\Util::writeLog('contacts', 'Addressbook not found: '. $id, OCP\Util::ERROR);
OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));