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

Don't use backend directly when updating address book

This commit is contained in:
Thomas Tanghus 2013-05-18 06:57:38 +02:00
parent 0495f547e7
commit b5123ab99b

View File

@ -109,15 +109,11 @@ class AddressBookController extends BaseController {
$response = new JSONResponse();
$backend = App::getBackend('local', $this->api->getUserId());
// TODO: Check actual permissions
if(!$backend->hasAddressBookMethodFor(\OCP\PERMISSION_UPDATE)) {
throw new \Exception('Not implemented');
}
if(!$backend->updateAddressBook($params['addressbookid'], $this->request['properties'])) {
$addressBook = $app->getAddressBook($params['backend'], $params['addressbookid']);
if(!$addressBook->update($this->request['properties'])) {
$response->bailOut(App::$l10n->t('Error updating address book'));
}
$response->setParams($backend->getAddressBook($params['addressbookid']));
$response->setParams($addressBook->getMetaData());
return $response;
}