1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

Merge branch 'master' of github.com:owncloud/apps into contacts_rework

Conflicts:
	contacts/ajax/contact/details.php
	contacts/lib/addressbook.php
	contacts/lib/vcard.php
This commit is contained in:
Thomas Tanghus 2012-11-12 00:46:15 +01:00
commit 0f02508121
6 changed files with 29 additions and 29 deletions

View File

@ -55,10 +55,9 @@ if(!$lastmodified) {
$lastmodified = new DateTime();
}
$permissions = OCP\Share::PERMISSION_CREATE | OCP\Share::PERMISSION_READ
| OCP\Share::PERMISSION_UPDATE | OCP\Share::PERMISSION_DELETE
| OCP\Share::PERMISSION_SHARE;
$addressbook = OCA\Contacts\Addressbook::find($card['addressbookid']);
$permissions = OCP\PERMISSION_ALL;
$addressbook = OC_Contacts_Addressbook::find($card['addressbookid']);
if ($addressbook['userid'] != OCP\User::getUser()) {
$sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $card['addressbookid']);
if($sharedAddressbook) {

View File

@ -70,9 +70,7 @@ class Addressbook {
$addressbooks = array();
while( $row = $result->fetchRow()) {
$row['permissions'] = \OCP\Share::PERMISSION_CREATE
| \OCP\Share::PERMISSION_READ | \OCP\Share::PERMISSION_UPDATE
| \OCP\Share::PERMISSION_DELETE | \OCP\Share::PERMISSION_SHARE;
$row['permissions'] = \OCP\PERMISSION_ALL;
$addressbooks[] = $row;
}
@ -145,9 +143,10 @@ class Addressbook {
return false;
}
$row = $result->fetchRow();
if($row['userid'] != \OCP\USER::getUser() && !\OC_Group::inGroup(\OCP\User::getUser(), 'admin')) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\Share::PERMISSION_READ)) {
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ)) {
throw new Exception(
App::$l10n->t(
'You do not have the permissions to read this addressbook.'
@ -156,9 +155,7 @@ class Addressbook {
}
$row['permissions'] = $sharedAddressbook['permissions'];
} else {
$row['permissions'] = \OCP\Share::PERMISSION_CREATE
| \OCP\Share::PERMISSION_READ | \OCP\Share::PERMISSION_UPDATE
| \OCP\Share::PERMISSION_DELETE | \OCP\Share::PERMISSION_SHARE;
$row['permissions'] = OCP\PERMISSION_ALL;
}
return $row;
}
@ -261,7 +258,7 @@ class Addressbook {
$addressbook = self::find($id);
if ($addressbook['userid'] != \OCP\User::getUser() && !\OC_Group::inGroup(OCP\User::getUser(), 'admin')) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\Share::PERMISSION_UPDATE)) {
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE)) {
throw new \Exception(
App::$l10n->t(
'You do not have the permissions to update this addressbook.'
@ -348,9 +345,10 @@ class Addressbook {
*/
public static function delete($id) {
$addressbook = self::find($id);
if ($addressbook['userid'] != \OCP\User::getUser() && !\OC_Group::inGroup(OCP\User::getUser(), 'admin')) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\Share::PERMISSION_DELETE)) {
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE)) {
throw new Exception(
App::$l10n->t(
'You do not have the permissions to delete this addressbook.'

View File

@ -72,10 +72,10 @@ class OC_Connector_Sabre_CardDAV_AddressBook extends Sabre_CardDAV_AddressBook {
if($uid != OCP\USER::getUser()) {
$sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $this->addressBookInfo['id']);
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_READ)) {
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_READ)) {
$readprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_UPDATE)) {
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_UPDATE)) {
$writeprincipal = 'principals/' . OCP\USER::getUser();
}
}

View File

@ -67,10 +67,10 @@ class OC_Connector_Sabre_CardDAV_Card extends Sabre_CardDAV_Card {
if($uid != OCP\USER::getUser()) {
$sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $this->addressBookInfo['id']);
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_READ)) {
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_READ)) {
$readprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\Share::PERMISSION_UPDATE)) {
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_UPDATE)) {
$writeprincipal = 'principals/' . OCP\USER::getUser();
}
}

View File

@ -323,7 +323,7 @@ class VCard {
$addressbook = Addressbook::find($aid);
if ($addressbook['userid'] != \OCP\User::getUser()) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $aid);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\Share::PERMISSION_CREATE)) {
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE)) {
throw new \Exception(
App::$l10n->t(
'You do not have the permissions to add contacts to this addressbook.'
@ -402,10 +402,11 @@ class VCard {
if (!$oldcard) {
return false;
}
$addressbook = Addressbook::find($oldcard['addressbookid']);
if ($addressbook['userid'] != \OCP\User::getUser()) {
$sharedContact = \OCP\Share::getItemSharedWithBySource('contact', $object[0], \OCP\Share::FORMAT_NONE, null, true);
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\Share::PERMISSION_UPDATE)) {
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\PERMISSION_UPDATE)) {
return false;
}
}
@ -463,7 +464,7 @@ class VCard {
$contact_permissions = $sharedEvent['permissions'];
}
$permissions = max($addressbook_permissions, $contact_permissions);
if (!($permissions & \OCP\Share::PERMISSION_UPDATE)) {
if (!($permissions & \OCP\PERMISSION_UPDATE)) {
throw new \Exception(
App::$l10n->t(
'You do not have the permissions to edit this contact.'
@ -576,7 +577,8 @@ class VCard {
$contact_permissions = $sharedEvent['permissions'];
}
$permissions = max($addressbook_permissions, $contact_permissions);
if (!($permissions & \OCP\Share::PERMISSION_DELETE)) {
if (!($permissions & \OCP\PERMISSION_DELETE)) {
throw new \Exception(
App::$l10n->t(
'You do not have the permissions to delete this contact.'
@ -623,8 +625,9 @@ class VCard {
if (!$id) {
return false;
}
$sharedContact = \OCP\Share::getItemSharedWithBySource('contact', $id, \OCP\Share::FORMAT_NONE, null, true);
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\Share::PERMISSION_DELETE)) {
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\PERMISSION_DELETE)) {
return false;
}
}
@ -812,7 +815,7 @@ class VCard {
$addressbook = Addressbook::find($aid);
if ($addressbook['userid'] != \OCP\User::getUser()) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $aid);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\Share::PERMISSION_CREATE)) {
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE)) {
return false;
}
}
@ -825,7 +828,7 @@ class VCard {
$oldAddressbook = Addressbook::find($card['addressbookid']);
if ($oldAddressbook['userid'] != \OCP\User::getUser()) {
$sharedContact = \OCP\Share::getItemSharedWithBySource('contact', $cardId, \OCP\Share::FORMAT_NONE, null, true);
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\Share::PERMISSION_DELETE)) {
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\PERMISSION_DELETE)) {
unset($id[$index]);
}
}
@ -859,7 +862,7 @@ class VCard {
$oldAddressbook = Addressbook::find($card['addressbookid']);
if ($oldAddressbook['userid'] != \OCP\User::getUser()) {
$sharedContact = \OCP\Share::getItemSharedWithBySource('contact', $id, \OCP\Share::FORMAT_NONE, null, true);
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\Share::PERMISSION_DELETE)) {
if (!$sharedContact || !($sharedContact['permissions'] & \OCP\PERMISSION_DELETE)) {
return false;
}
}

View File

@ -16,7 +16,7 @@
data-owner="<?php echo $addressbook['userid'] ?>"
>
<td class="active">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_UPDATE) { ?>
<?php if($addressbook['permissions'] & OCP\PERMISSION_UPDATE) { ?>
<input type="checkbox" <?php echo (($addressbook['active']) == '1' ? ' checked="checked"' : ''); ?> />
<?php } ?>
</td>
@ -29,7 +29,7 @@
<a class="svg action cloud" title="<?php echo $l->t('Show read-only VCF link'); ?>"></a>
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_SHARE) { ?>
<?php if($addressbook['permissions'] & OCP\PERMISSION_SHARE) { ?>
<a class="svg action share" data-item-type="addressbook"
data-item="<?php echo $addressbook['id'] ?>"
data-possible-permissions="<?php echo $addressbook['permissions'] ?>"
@ -41,12 +41,12 @@
href="<?php echo OCP\Util::linkToAbsolute('contacts', 'export.php'); ?>?bookid=<?php echo $addressbook['id'] ?>"></a>
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_UPDATE) { ?>
<?php if($addressbook['permissions'] & OCP\PERMISSION_UPDATE) { ?>
<a class="svg action edit" title="<?php echo $l->t("Edit"); ?>"></a>
<?php } ?>
</td>
<td class="action">
<?php if($addressbook['permissions'] & OCP\Share::PERMISSION_DELETE) { ?>
<?php if($addressbook['permissions'] & OCP\PERMISSION_DELETE) { ?>
<a class="svg action delete" title="<?php echo $l->t("Delete"); ?>"></a>
<?php } ?>
</td>