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

Contacts: Return Return {DAV:}write for own address books. Fix #788

Propably fixes #780 and #694
This commit is contained in:
Thomas Tanghus 2013-03-17 10:31:23 +01:00
parent 2a509e39b5
commit dd00e6872b

View File

@ -74,18 +74,28 @@ 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\PERMISSION_CREATE)) {
$createprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_READ)) {
$readprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_UPDATE)) {
$writeprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook && ($sharedAddressbook['permissions'] & OCP\PERMISSION_DELETE)) {
$deleteprincipal = 'principals/' . OCP\USER::getUser();
if($sharedAddressbook) {
if(($sharedAddressbook['permissions'] & OCP\PERMISSION_CREATE)
&& ($sharedAddressbook['permissions'] & OCP\PERMISSION_UPDATE)
&& ($sharedAddressbook['permissions'] & OCP\PERMISSION_DELETE)
) {
return parent::getACL();
}
if ($sharedAddressbook['permissions'] & OCP\PERMISSION_CREATE) {
$createprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & OCP\PERMISSION_UPDATE) {
$writeprincipal = 'principals/' . OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & OCP\PERMISSION_DELETE) {
$deleteprincipal = 'principals/' . OCP\USER::getUser();
}
}
} else {
return parent::getACL();
}
return array(
@ -196,4 +206,4 @@ class OC_Connector_Sabre_CardDAV_AddressBook extends Sabre_CardDAV_AddressBook {
}
}
}