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:
parent
b251ab38b5
commit
d9a3f56b9d
@ -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(
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user