mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-02-12 06:54:28 +01:00
Only check Contact permissions on save/update/delete.
This commit is contained in:
parent
7d9194e066
commit
85c2e3229e
@ -88,7 +88,7 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
case 'displayname':
|
case 'displayname':
|
||||||
case 'fullname':
|
case 'fullname':
|
||||||
$this->props['displayname'] = $value;
|
$this->props['displayname'] = $value;
|
||||||
//$this->FN = $value;
|
$this->FN = $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -412,9 +412,6 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
* @throws @see getPropertyByChecksum
|
* @throws @see getPropertyByChecksum
|
||||||
*/
|
*/
|
||||||
public function unsetPropertyByChecksum($checksum) {
|
public function unsetPropertyByChecksum($checksum) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
$idx = $this->getPropertyIndexByChecksum($checksum);
|
$idx = $this->getPropertyIndexByChecksum($checksum);
|
||||||
unset($this->children[$idx]);
|
unset($this->children[$idx]);
|
||||||
$this->setSaved(false);
|
$this->setSaved(false);
|
||||||
@ -432,9 +429,6 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
* @return string new checksum
|
* @return string new checksum
|
||||||
*/
|
*/
|
||||||
public function setPropertyByChecksum($checksum, $name, $value, $parameters=array()) {
|
public function setPropertyByChecksum($checksum, $name, $value, $parameters=array()) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
if($checksum === 'new') {
|
if($checksum === 'new') {
|
||||||
$property = Property::create($name);
|
$property = Property::create($name);
|
||||||
$this->add($property);
|
$this->add($property);
|
||||||
@ -488,9 +482,6 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function setPropertyByName($name, $value, $parameters=array()) {
|
public function setPropertyByName($name, $value, $parameters=array()) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
// TODO: parameters are ignored for now.
|
// TODO: parameters are ignored for now.
|
||||||
switch($name) {
|
switch($name) {
|
||||||
case 'BDAY':
|
case 'BDAY':
|
||||||
@ -591,9 +582,6 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
*/
|
*/
|
||||||
public function mergeFromArray(array $data) {
|
public function mergeFromArray(array $data) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
foreach($data as $name => $properties) {
|
foreach($data as $name => $properties) {
|
||||||
if(in_array($name, array('PHOTO', 'UID'))) {
|
if(in_array($name, array('PHOTO', 'UID'))) {
|
||||||
continue;
|
continue;
|
||||||
@ -658,17 +646,11 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function __set($key, $value) {
|
public function __set($key, $value) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
parent::__set($key, $value);
|
parent::__set($key, $value);
|
||||||
$this->setSaved(false);
|
$this->setSaved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __unset($key) {
|
public function __unset($key) {
|
||||||
if(!$this->hasPermission(\OCP\PERMISSION_UPDATE)) {
|
|
||||||
throw new \Exception('Access denied');
|
|
||||||
}
|
|
||||||
parent::__unset($key);
|
parent::__unset($key);
|
||||||
$this->setSaved(false);
|
$this->setSaved(false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user