diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-09 11:38:22 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-08-09 11:38:22 -0400 |
commit | 78cd1153f012f871935130325167759898f030ab (patch) | |
tree | 685a5fe56663e6b6087aa4f28c8f09daf1e80546 /apps/contacts/lib/vcard.php | |
parent | b830b3e24b281204344e9162352c7034f0a67187 (diff) | |
parent | f9cec1426fe639a5683e36b5fbdeb9149feacb19 (diff) | |
download | nextcloud-server-78cd1153f012f871935130325167759898f030ab.tar.gz nextcloud-server-78cd1153f012f871935130325167759898f030ab.zip |
Merge branch 'master' into share_api
Conflicts:
apps/contacts/lib/vcard.php
apps/files_sharing/sharedstorage.php
Diffstat (limited to 'apps/contacts/lib/vcard.php')
-rw-r--r-- | apps/contacts/lib/vcard.php | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index a93ca399d3a..4cc18027acf 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -282,12 +282,13 @@ class OC_Contacts_VCard{ /** * @brief Adds a card - * @param integer $aid Addressbook id - * @param OC_VObject $card vCard file - * @param string $uri the uri of the card, default based on the UID + * @param $aid integer Addressbook id + * @param $card OC_VObject vCard file + * @param $uri string the uri of the card, default based on the UID + * @param $isChecked boolean If the vCard should be checked for validity and version. * @return insertid on success or false. */ - public static function add($aid, OC_VObject $card, $uri=null, $isnew=false){ + public static function add($aid, OC_VObject $card, $uri=null, $isChecked=false){ if(is_null($card)) { OCP\Util::writeLog('contacts', 'OC_Contacts_VCard::add. No vCard supplied', OCP\Util::ERROR); return null; @@ -295,22 +296,13 @@ class OC_Contacts_VCard{ $addressbook = OC_Contacts_Addressbook::find($aid); if ($addressbook['userid'] != OCP\User::getUser()) { $sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $aid); - if (!$sharedAddressbook) { + if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_CREATE)) { return false; } - } else { - $sharedAddressbook = false; } - if(!$isnew) { - if ($sharedAddressbook && !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_UPDATE)) { - return false; - } + if(!$isChecked) { OC_Contacts_App::loadCategoriesFromVCard($card); self::updateValuesFromAdd($aid, $card); - } else { - if ($sharedAddressbook && !($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_CREATE)) { - return false; - } } $card->setString('VERSION', '3.0'); // Add product ID is missing. |