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

Don't prevent calendar and contant data deletion on user deletion because of sharing permissions.

This commit is contained in:
Thomas Tanghus 2012-10-02 23:22:29 +02:00
parent b251ab38b5
commit d9a3f56b9d
2 changed files with 4 additions and 4 deletions

View File

@ -130,7 +130,7 @@ class OC_Contacts_Addressbook {
return false;
}
$row = $result->fetchRow();
if($row['userid'] != OCP\USER::getUser()) {
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)) {
throw new Exception(
@ -231,7 +231,7 @@ class OC_Contacts_Addressbook {
public static function edit($id,$name,$description) {
// Need these ones for checking uri
$addressbook = self::find($id);
if ($addressbook['userid'] != OCP\User::getUser()) {
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)) {
throw new Exception(
@ -307,7 +307,7 @@ class OC_Contacts_Addressbook {
*/
public static function delete($id) {
$addressbook = self::find($id);
if ($addressbook['userid'] != OCP\User::getUser()) {
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)) {
throw new Exception(

View File

@ -512,7 +512,7 @@ class OC_Contacts_VCard {
);
}
if ($addressbook['userid'] != OCP\User::getUser()) {
if ($addressbook['userid'] != OCP\User::getUser() && !OC_Group::inGroup(OCP\User::getUser(), 'admin')) {
OCP\Util::writeLog('contacts', __METHOD__.', '
. $addressbook['userid'] . ' != ' . OCP\User::getUser(), OCP\Util::DEBUG);
$sharedAddressbook = OCP\Share::getItemSharedWithBySource('addressbook', $card['addressbookid'], OCP\Share::FORMAT_NONE, null, true);