Skip to content

Commit 39e8ea9

Browse files
Calendar harmonization and more
Signed-off-by: SebastianKrupinski <[email protected]>
1 parent 6ccd4da commit 39e8ea9

File tree

67 files changed

+3265
-2520
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3265
-2520
lines changed

lib/Controller/UserConfigurationController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,20 @@ public function Connect(array $service): DataResponse {
106106
/**
107107
* handles disconnect click event
108108
*
109+
* @param int $sid Service id
110+
*
109111
* @return DataResponse
110112
*/
111113
#[NoAdminRequired]
112114
#[FrontpageRoute(verb: 'GET', url: '/disconnect')]
113-
public function Disconnect(): DataResponse {
115+
public function Disconnect(int $sid): DataResponse {
114116

115117
// evaluate if user id is present
116118
if ($this->userId === null) {
117119
return new DataResponse([], Http::STATUS_BAD_REQUEST);
118120
}
119121
// execute command
120-
$this->CoreService->disconnectAccount($this->userId);
122+
$this->CoreService->disconnectAccount($this->userId, $sid);
121123
// return response
122124
return new DataResponse('success');
123125

lib/Objects/BaseCollection.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* @copyright Copyright (c) 2023 Sebastian Krupinski <[email protected]>
6+
*
7+
* @author Sebastian Krupinski <[email protected]>
8+
*
9+
* @license AGPL-3.0-or-later
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License as
13+
* published by the Free Software Foundation, either version 3 of the
14+
* License, or (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
namespace OCA\JMAPC\Objects;
27+
28+
class BaseCollection extends \ArrayObject
29+
{
30+
private $type;
31+
32+
public function __construct($type, $data = []) {
33+
$this->type = $type;
34+
parent::__construct($data);
35+
}
36+
37+
private function validate($value): bool {
38+
return match ($this->type) {
39+
'string' => is_string($value),
40+
'int' => is_int($value),
41+
'float' => is_float($value),
42+
default => $value instanceof $this->type
43+
};
44+
}
45+
46+
public function append($value): void {
47+
if (!$this->validate($value)) {
48+
throw new \InvalidArgumentException('Type error');
49+
}
50+
parent::append($value);
51+
}
52+
53+
public function offsetSet($key, $value): void {
54+
if (!$this->validate($value)) {
55+
throw new \InvalidArgumentException('Type error');
56+
}
57+
parent::offsetSet($key, $value);
58+
}
59+
}

lib/Objects/ContactAddressObject.php renamed to lib/Objects/Contact/ContactAddressObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactAddressObject {
2929

lib/Objects/ContactAttachmentObject.php renamed to lib/Objects/Contact/ContactAttachmentObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactAttachmentObject {
2929

lib/Objects/ContactEmailObject.php renamed to lib/Objects/Contact/ContactEmailObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactEmailObject {
2929

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactIMPPObject {
2929

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
/**
5+
* @copyright Copyright (c) 2023 Sebastian Krupinski <[email protected]>
6+
*
7+
* @author Sebastian Krupinski <[email protected]>
8+
*
9+
* @license AGPL-3.0-or-later
10+
*
11+
* This program is free software: you can redistribute it and/or modify
12+
* it under the terms of the GNU Affero General Public License as
13+
* published by the Free Software Foundation, either version 3 of the
14+
* License, or (at your option) any later version.
15+
*
16+
* This program is distributed in the hope that it will be useful,
17+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
* GNU Affero General Public License for more details.
20+
*
21+
* You should have received a copy of the GNU Affero General Public License
22+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23+
*
24+
*/
25+
26+
namespace OCA\JMAPC\Objects\Event;
27+
28+
use OCA\JMAPC\Objects\BaseCollection;
29+
30+
class ContactMembersCollection extends BaseCollection {
31+
public function __construct($data = []) {
32+
parent::__construct('string', $data);
33+
}
34+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactNameObject {
2929

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,27 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
use DateTime;
29+
use DateTimeImmutable;
30+
use OCA\JMAPC\Objects\Event\ContactMembersCollection;
31+
use OCA\JMAPC\Objects\OriginTypes;
2932

3033
class ContactObject {
3134

32-
public ?string $Origin = null; // Source System / L - Local / R - Remote
33-
public ?string $ID = null; // Source System Id
34-
public ?string $UUID = null; // Object UUID
35-
public ?string $CID = null; // Source System Collection Id
36-
public ?string $Signature = null; // Source System Object Signature
37-
public ?DateTime $CreatedOn = null; // Source System Creation Date/Time
38-
public ?DateTime $ModifiedOn = null; // Source System Modification Date/Time
35+
public ?OriginTypes $Origin = null; // System
36+
public ?string $ID = null; // System Entity Id
37+
public ?string $CID = null; // System Collection Id
38+
public ?string $Signature = null; // System Entity Signature
39+
public ?string $CCID = null; // Correlation Collection Id
40+
public ?string $CEID = null; // Correlation Entity Id
41+
public ?string $CESN = null; // Correlation Signature
42+
public ?string $UUID = null; // Event UUID
43+
public DateTime|DateTimeImmutable|null $CreatedOn = null; // Event Creation Date/Time
44+
public DateTime|DateTimeImmutable|null $ModifiedOn = null; // Event Modification Date/Time
3945
public ?string $Label = null; // Contact Display Label
40-
public ?string $Notes = null; // Contact Notes
46+
public ?string $Description = null; // Contact Notes
4147
public ?ContactNameObject $Name = null; // Contact Name(s)
4248
public ?ContactPhotoObject $Photo = null; // Contact Photo
4349
public ?DateTime $BirthDay = null; // Contact Birth Day
@@ -58,6 +64,8 @@ class ContactObject {
5864
public ?string $Sound = null;
5965
public ?string $URI = null;
6066
public array $Attachments = [];
67+
public ?string $Language = null;
68+
public ContactMembersCollection $Members;
6169
public ?array $Other = [];
6270

6371
public function __construct() {

lib/Objects/ContactOccupationObject.php renamed to lib/Objects/Contact/ContactOccupationObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
*/
2525

26-
namespace OCA\JMAPC\Objects;
26+
namespace OCA\JMAPC\Objects\Contact;
2727

2828
class ContactOccupationObject {
2929

0 commit comments

Comments
 (0)