Passed
Push — master ( f1b940...81ea28 )
by Joas
14:36 queued 15s
created
lib/public/Federation/ICloudFederationNotification.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@
 block discarded – undo
30 30
  */
31 31
 interface ICloudFederationNotification {
32 32
 
33
-	/**
34
-	 * add a message to the notification
35
-	 *
36
-	 * @param string $notificationType (e.g. SHARE_ACCEPTED)
37
-	 * @param string $resourceType (e.g. file, calendar, contact,...)
38
-	 * @param $providerId id of the share
39
-	 * @param array $notification , payload of the notification
40
-	 *
41
-	 * @since 14.0.0
42
-	 */
43
-	public function setMessage($notificationType, $resourceType, $providerId, array $notification);
33
+    /**
34
+     * add a message to the notification
35
+     *
36
+     * @param string $notificationType (e.g. SHARE_ACCEPTED)
37
+     * @param string $resourceType (e.g. file, calendar, contact,...)
38
+     * @param $providerId id of the share
39
+     * @param array $notification , payload of the notification
40
+     *
41
+     * @since 14.0.0
42
+     */
43
+    public function setMessage($notificationType, $resourceType, $providerId, array $notification);
44 44
 
45
-	/**
46
-	 * get message, ready to send out
47
-	 *
48
-	 * @return array
49
-	 *
50
-	 * @since 14.0.0
51
-	 */
52
-	public function getMessage();
45
+    /**
46
+     * get message, ready to send out
47
+     *
48
+     * @return array
49
+     *
50
+     * @since 14.0.0
51
+     */
52
+    public function getMessage();
53 53
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationShare.php 1 patch
Indentation   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -30,221 +30,221 @@
 block discarded – undo
30 30
  */
31 31
 interface ICloudFederationShare {
32 32
 
33
-	/**
34
-	 * set uid of the recipient
35
-	 *
36
-	 * @param string $user
37
-	 *
38
-	 * @since 14.0.0
39
-	 */
40
-	public function setShareWith($user);
41
-
42
-	/**
43
-	 * set resource name (e.g. file, calendar, contact,...)
44
-	 *
45
-	 * @param string $name
46
-	 *
47
-	 * @since 14.0.0
48
-	 */
49
-	public function setResourceName($name);
50
-
51
-	/**
52
-	 * set resource type (e.g. file, calendar, contact,...)
53
-	 *
54
-	 * @param string $resourceType
55
-	 *
56
-	 * @since 14.0.0
57
-	 */
58
-	public function setResourceType($resourceType);
59
-
60
-	/**
61
-	 * set resource description (optional)
62
-	 *
63
-	 * @param string $description
64
-	 *
65
-	 * @since 14.0.0
66
-	 */
67
-	public function setDescription($description);
68
-
69
-	/**
70
-	 * set provider ID (e.g. file ID)
71
-	 *
72
-	 * @param string $providerId
73
-	 *
74
-	 * @since 14.0.0
75
-	 */
76
-	public function setProviderId($providerId);
77
-
78
-	/**
79
-	 * set owner UID
80
-	 *
81
-	 * @param string $owner
82
-	 *
83
-	 * @since 14.0.0
84
-	 */
85
-	public function setOwner($owner);
86
-
87
-	/**
88
-	 * set owner display name
89
-	 *
90
-	 * @param string $ownerDisplayName
91
-	 *
92
-	 * @since 14.0.0
93
-	 */
94
-	public function setOwnerDisplayName($ownerDisplayName);
95
-
96
-	/**
97
-	 * set UID of the user who sends the share
98
-	 *
99
-	 * @param string $sharedBy
100
-	 *
101
-	 * @since 14.0.0
102
-	 */
103
-	public function setSharedBy($sharedBy);
104
-
105
-	/**
106
-	 * set display name of the user who sends the share
107
-	 *
108
-	 * @param $sharedByDisplayName
109
-	 *
110
-	 * @since 14.0.0
111
-	 */
112
-	public function setSharedByDisplayName($sharedByDisplayName);
113
-
114
-	/**
115
-	 * set protocol specification
116
-	 *
117
-	 * @param array $protocol
118
-	 *
119
-	 * @since 14.0.0
120
-	 */
121
-	public function setProtocol(array $protocol);
122
-
123
-	/**
124
-	 * share type (group or user)
125
-	 *
126
-	 * @param string $shareType
127
-	 *
128
-	 * @since 14.0.0
129
-	 */
130
-	public function setShareType($shareType);
131
-
132
-	/**
133
-	 * get the whole share, ready to send out
134
-	 *
135
-	 * @return array
136
-	 *
137
-	 * @since 14.0.0
138
-	 */
139
-	public function getShare();
140
-
141
-	/**
142
-	 * get uid of the recipient
143
-	 *
144
-	 * @return string
145
-	 *
146
-	 * @since 14.0.0
147
-	 */
148
-	public function getShareWith();
149
-
150
-	/**
151
-	 * get resource name (e.g. file, calendar, contact,...)
152
-	 *
153
-	 * @return string
154
-	 *
155
-	 * @since 14.0.0
156
-	 */
157
-	public function getResourceName();
158
-
159
-	/**
160
-	 * get resource type (e.g. file, calendar, contact,...)
161
-	 *
162
-	 * @return string
163
-	 *
164
-	 * @since 14.0.0
165
-	 */
166
-	public function getResourceType();
167
-
168
-	/**
169
-	 * get resource description (optional)
170
-	 *
171
-	 * @return string
172
-	 *
173
-	 * @since 14.0.0
174
-	 */
175
-	public function getDescription();
176
-
177
-	/**
178
-	 * get provider ID (e.g. file ID)
179
-	 *
180
-	 * @return string
181
-	 *
182
-	 * @since 14.0.0
183
-	 */
184
-	public function getProviderId();
185
-
186
-	/**
187
-	 * get owner UID
188
-	 *
189
-	 * @return string
190
-	 *
191
-	 * @since 14.0.0
192
-	 */
193
-	public function getOwner();
194
-
195
-	/**
196
-	 * get owner display name
197
-	 *
198
-	 * @return string
199
-	 *
200
-	 * @since 14.0.0
201
-	 */
202
-	public function getOwnerDisplayName();
203
-
204
-	/**
205
-	 * get UID of the user who sends the share
206
-	 *
207
-	 * @return string
208
-	 *
209
-	 * @since 14.0.0
210
-	 */
211
-	public function getSharedBy();
212
-
213
-	/**
214
-	 * get display name of the user who sends the share
215
-	 *
216
-	 * @return string
217
-	 *
218
-	 * @since 14.0.0
219
-	 */
220
-	public function getSharedByDisplayName();
221
-
222
-	/**
223
-	 * get share type (group or user)
224
-	 *
225
-	 * @return string
226
-	 *
227
-	 * @since 14.0.0
228
-	 */
229
-	public function getShareType();
230
-
231
-	/**
232
-	 * get share Secret
233
-	 *
234
-	 * @return string
235
-	 *
236
-	 * @since 14.0.0
237
-	 */
238
-	public function getShareSecret();
239
-
240
-
241
-	/**
242
-	 * get protocol specification
243
-	 *
244
-	 * @return array
245
-	 *
246
-	 * @since 14.0.0
247
-	 */
248
-	public function getProtocol();
33
+    /**
34
+     * set uid of the recipient
35
+     *
36
+     * @param string $user
37
+     *
38
+     * @since 14.0.0
39
+     */
40
+    public function setShareWith($user);
41
+
42
+    /**
43
+     * set resource name (e.g. file, calendar, contact,...)
44
+     *
45
+     * @param string $name
46
+     *
47
+     * @since 14.0.0
48
+     */
49
+    public function setResourceName($name);
50
+
51
+    /**
52
+     * set resource type (e.g. file, calendar, contact,...)
53
+     *
54
+     * @param string $resourceType
55
+     *
56
+     * @since 14.0.0
57
+     */
58
+    public function setResourceType($resourceType);
59
+
60
+    /**
61
+     * set resource description (optional)
62
+     *
63
+     * @param string $description
64
+     *
65
+     * @since 14.0.0
66
+     */
67
+    public function setDescription($description);
68
+
69
+    /**
70
+     * set provider ID (e.g. file ID)
71
+     *
72
+     * @param string $providerId
73
+     *
74
+     * @since 14.0.0
75
+     */
76
+    public function setProviderId($providerId);
77
+
78
+    /**
79
+     * set owner UID
80
+     *
81
+     * @param string $owner
82
+     *
83
+     * @since 14.0.0
84
+     */
85
+    public function setOwner($owner);
86
+
87
+    /**
88
+     * set owner display name
89
+     *
90
+     * @param string $ownerDisplayName
91
+     *
92
+     * @since 14.0.0
93
+     */
94
+    public function setOwnerDisplayName($ownerDisplayName);
95
+
96
+    /**
97
+     * set UID of the user who sends the share
98
+     *
99
+     * @param string $sharedBy
100
+     *
101
+     * @since 14.0.0
102
+     */
103
+    public function setSharedBy($sharedBy);
104
+
105
+    /**
106
+     * set display name of the user who sends the share
107
+     *
108
+     * @param $sharedByDisplayName
109
+     *
110
+     * @since 14.0.0
111
+     */
112
+    public function setSharedByDisplayName($sharedByDisplayName);
113
+
114
+    /**
115
+     * set protocol specification
116
+     *
117
+     * @param array $protocol
118
+     *
119
+     * @since 14.0.0
120
+     */
121
+    public function setProtocol(array $protocol);
122
+
123
+    /**
124
+     * share type (group or user)
125
+     *
126
+     * @param string $shareType
127
+     *
128
+     * @since 14.0.0
129
+     */
130
+    public function setShareType($shareType);
131
+
132
+    /**
133
+     * get the whole share, ready to send out
134
+     *
135
+     * @return array
136
+     *
137
+     * @since 14.0.0
138
+     */
139
+    public function getShare();
140
+
141
+    /**
142
+     * get uid of the recipient
143
+     *
144
+     * @return string
145
+     *
146
+     * @since 14.0.0
147
+     */
148
+    public function getShareWith();
149
+
150
+    /**
151
+     * get resource name (e.g. file, calendar, contact,...)
152
+     *
153
+     * @return string
154
+     *
155
+     * @since 14.0.0
156
+     */
157
+    public function getResourceName();
158
+
159
+    /**
160
+     * get resource type (e.g. file, calendar, contact,...)
161
+     *
162
+     * @return string
163
+     *
164
+     * @since 14.0.0
165
+     */
166
+    public function getResourceType();
167
+
168
+    /**
169
+     * get resource description (optional)
170
+     *
171
+     * @return string
172
+     *
173
+     * @since 14.0.0
174
+     */
175
+    public function getDescription();
176
+
177
+    /**
178
+     * get provider ID (e.g. file ID)
179
+     *
180
+     * @return string
181
+     *
182
+     * @since 14.0.0
183
+     */
184
+    public function getProviderId();
185
+
186
+    /**
187
+     * get owner UID
188
+     *
189
+     * @return string
190
+     *
191
+     * @since 14.0.0
192
+     */
193
+    public function getOwner();
194
+
195
+    /**
196
+     * get owner display name
197
+     *
198
+     * @return string
199
+     *
200
+     * @since 14.0.0
201
+     */
202
+    public function getOwnerDisplayName();
203
+
204
+    /**
205
+     * get UID of the user who sends the share
206
+     *
207
+     * @return string
208
+     *
209
+     * @since 14.0.0
210
+     */
211
+    public function getSharedBy();
212
+
213
+    /**
214
+     * get display name of the user who sends the share
215
+     *
216
+     * @return string
217
+     *
218
+     * @since 14.0.0
219
+     */
220
+    public function getSharedByDisplayName();
221
+
222
+    /**
223
+     * get share type (group or user)
224
+     *
225
+     * @return string
226
+     *
227
+     * @since 14.0.0
228
+     */
229
+    public function getShareType();
230
+
231
+    /**
232
+     * get share Secret
233
+     *
234
+     * @return string
235
+     *
236
+     * @since 14.0.0
237
+     */
238
+    public function getShareSecret();
239
+
240
+
241
+    /**
242
+     * get protocol specification
243
+     *
244
+     * @return array
245
+     *
246
+     * @since 14.0.0
247
+     */
248
+    public function getProtocol();
249 249
 
250 250
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -33,19 +33,19 @@
 block discarded – undo
33 33
  */
34 34
 class ProviderCouldNotAddShareException extends HintException {
35 35
 
36
-	/**
37
-	 * ProviderCouldNotAddShareException constructor.
38
-	 *
39
-	 * @since 14.0.0
40
-	 *
41
-	 * @param string $message
42
-	 * @param string $hint
43
-	 * @param int $code
44
-	 * @param \Exception|null $previous
45
-	 */
46
-	public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
47
-		parent::__construct($message, $hint, $code, $previous);
48
-	}
36
+    /**
37
+     * ProviderCouldNotAddShareException constructor.
38
+     *
39
+     * @since 14.0.0
40
+     *
41
+     * @param string $message
42
+     * @param string $hint
43
+     * @param int $code
44
+     * @param \Exception|null $previous
45
+     */
46
+    public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
47
+        parent::__construct($message, $hint, $code, $previous);
48
+    }
49 49
 
50 50
 
51 51
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationFactory.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -30,33 +30,33 @@
 block discarded – undo
30 30
  */
31 31
 interface ICloudFederationFactory {
32 32
 
33
-	/**
34
-	 * get a CloudFederationShare Object to prepare a share you want to send
35
-	 *
36
-	 * @param string $shareWith
37
-	 * @param string $name resource name (e.g. document.odt)
38
-	 * @param string $description share description (optional)
39
-	 * @param string $providerId resource UID on the provider side
40
-	 * @param string $owner provider specific UID of the user who owns the resource
41
-	 * @param string $ownerDisplayName display name of the user who shared the item
42
-	 * @param string $sharedBy provider specific UID of the user who shared the resource
43
-	 * @param string $sharedByDisplayName display name of the user who shared the resource
44
-	 * @param string $sharedSecret used to authenticate requests across servers
45
-	 * @param string $shareType ('group' or 'user' share)
46
-	 * @param $resourceType ('file', 'calendar',...)
47
-	 * @return ICloudFederationShare
48
-	 *
49
-	 * @since 14.0.0
50
-	 */
51
-	public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType);
33
+    /**
34
+     * get a CloudFederationShare Object to prepare a share you want to send
35
+     *
36
+     * @param string $shareWith
37
+     * @param string $name resource name (e.g. document.odt)
38
+     * @param string $description share description (optional)
39
+     * @param string $providerId resource UID on the provider side
40
+     * @param string $owner provider specific UID of the user who owns the resource
41
+     * @param string $ownerDisplayName display name of the user who shared the item
42
+     * @param string $sharedBy provider specific UID of the user who shared the resource
43
+     * @param string $sharedByDisplayName display name of the user who shared the resource
44
+     * @param string $sharedSecret used to authenticate requests across servers
45
+     * @param string $shareType ('group' or 'user' share)
46
+     * @param $resourceType ('file', 'calendar',...)
47
+     * @return ICloudFederationShare
48
+     *
49
+     * @since 14.0.0
50
+     */
51
+    public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $sharedSecret, $shareType, $resourceType);
52 52
 
53
-	/**
54
-	 * get a Cloud FederationNotification object to prepare a notification you
55
-	 * want to send
56
-	 *
57
-	 * @return ICloudFederationNotification
58
-	 *
59
-	 * @since 14.0.0
60
-	 */
61
-	public function getCloudFederationNotification();
53
+    /**
54
+     * get a Cloud FederationNotification object to prepare a notification you
55
+     * want to send
56
+     *
57
+     * @return ICloudFederationNotification
58
+     *
59
+     * @since 14.0.0
60
+     */
61
+    public function getCloudFederationNotification();
62 62
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/AuthenticationFailedException.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@
 block discarded – undo
32 32
  */
33 33
 class AuthenticationFailedException extends HintException {
34 34
 
35
-	/**
36
-	 * BadRequestException constructor.
37
-	 *
38
-	 * @since 14.0.0
39
-	 *
40
-	 */
41
-	public function __construct() {
42
-		$l = \OC::$server->getL10N('federation');
43
-		$message = 'Authentication failed, wrong token or provider ID given';
44
-		$hint = $l->t('Authentication failed, wrong token or provider ID given');
45
-		parent::__construct($message, $hint);
46
-	}
35
+    /**
36
+     * BadRequestException constructor.
37
+     *
38
+     * @since 14.0.0
39
+     *
40
+     */
41
+    public function __construct() {
42
+        $l = \OC::$server->getL10N('federation');
43
+        $message = 'Authentication failed, wrong token or provider ID given';
44
+        $hint = $l->t('Authentication failed, wrong token or provider ID given');
45
+        parent::__construct($message, $hint);
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Http/StrictInlineContentSecurityPolicy.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@
 block discarded – undo
42 42
  */
43 43
 class StrictInlineContentSecurityPolicy extends ContentSecurityPolicy {
44 44
 
45
-	/**
46
-	 * @since 14.0.0
47
-	 */
48
-	public function __construct() {
49
-		$this->inlineStyleAllowed = false;
50
-	}
45
+    /**
46
+     * @since 14.0.0
47
+     */
48
+    public function __construct() {
49
+        $this->inlineStyleAllowed = false;
50
+    }
51 51
 }
Please login to merge, or discard this patch.
lib/private/Repair/AddCleanupUpdaterBackupsJob.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,19 +30,19 @@
 block discarded – undo
30 30
 
31 31
 class AddCleanupUpdaterBackupsJob implements IRepairStep {
32 32
 
33
-	/** @var IJobList */
34
-	protected $jobList;
33
+    /** @var IJobList */
34
+    protected $jobList;
35 35
 
36
-	public function __construct(IJobList $jobList) {
37
-		$this->jobList = $jobList;
38
-	}
36
+    public function __construct(IJobList $jobList) {
37
+        $this->jobList = $jobList;
38
+    }
39 39
 
40
-	public function getName() {
41
-		return 'Queue a one-time job to cleanup old backups of the updater';
42
-	}
40
+    public function getName() {
41
+        return 'Queue a one-time job to cleanup old backups of the updater';
42
+    }
43 43
 
44
-	public function run(IOutput $output) {
45
-		$this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class);
46
-	}
44
+    public function run(IOutput $output) {
45
+        $this->jobList->add(BackgroundCleanupUpdaterBackupsJob::class);
46
+    }
47 47
 }
48 48
 
Please login to merge, or discard this patch.
lib/private/Authentication/Token/PublicKeyToken.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
 		if (is_array($scope)) {
185 185
 			parent::setScope(json_encode($scope));
186 186
 		} else {
187
-			parent::setScope((string)$scope);
187
+			parent::setScope((string) $scope);
188 188
 		}
189 189
 	}
190 190
 
Please login to merge, or discard this patch.
Indentation   +184 added lines, -184 removed lines patch added patch discarded remove patch
@@ -47,188 +47,188 @@
 block discarded – undo
47 47
  * @method bool getPasswordInvalid()
48 48
  */
49 49
 class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
50
-	public const VERSION = 2;
51
-
52
-	/** @var string user UID */
53
-	protected $uid;
54
-
55
-	/** @var string login name used for generating the token */
56
-	protected $loginName;
57
-
58
-	/** @var string encrypted user password */
59
-	protected $password;
60
-
61
-	/** @var string token name (e.g. browser/OS) */
62
-	protected $name;
63
-
64
-	/** @var string */
65
-	protected $token;
66
-
67
-	/** @var int */
68
-	protected $type;
69
-
70
-	/** @var int */
71
-	protected $remember;
72
-
73
-	/** @var int */
74
-	protected $lastActivity;
75
-
76
-	/** @var int */
77
-	protected $lastCheck;
78
-
79
-	/** @var string */
80
-	protected $scope;
81
-
82
-	/** @var int */
83
-	protected $expires;
84
-
85
-	/** @var string */
86
-	protected $privateKey;
87
-
88
-	/** @var string */
89
-	protected $publicKey;
90
-
91
-	/** @var int */
92
-	protected $version;
93
-
94
-	/** @var bool */
95
-	protected $passwordInvalid;
96
-
97
-	public function __construct() {
98
-		$this->addType('uid', 'string');
99
-		$this->addType('loginName', 'string');
100
-		$this->addType('password', 'string');
101
-		$this->addType('name', 'string');
102
-		$this->addType('token', 'string');
103
-		$this->addType('type', 'int');
104
-		$this->addType('remember', 'int');
105
-		$this->addType('lastActivity', 'int');
106
-		$this->addType('lastCheck', 'int');
107
-		$this->addType('scope', 'string');
108
-		$this->addType('expires', 'int');
109
-		$this->addType('publicKey', 'string');
110
-		$this->addType('privateKey', 'string');
111
-		$this->addType('version', 'int');
112
-		$this->addType('passwordInvalid', 'bool');
113
-	}
114
-
115
-	public function getId(): int {
116
-		return $this->id;
117
-	}
118
-
119
-	public function getUID(): string {
120
-		return $this->uid;
121
-	}
122
-
123
-	/**
124
-	 * Get the login name used when generating the token
125
-	 *
126
-	 * @return string
127
-	 */
128
-	public function getLoginName(): string {
129
-		return parent::getLoginName();
130
-	}
131
-
132
-	/**
133
-	 * Get the (encrypted) login password
134
-	 *
135
-	 * @return string|null
136
-	 */
137
-	public function getPassword() {
138
-		return parent::getPassword();
139
-	}
140
-
141
-	public function jsonSerialize(): array {
142
-		return [
143
-			'id' => $this->id,
144
-			'name' => $this->name,
145
-			'lastActivity' => $this->lastActivity,
146
-			'type' => $this->type,
147
-			'scope' => $this->getScopeAsArray()
148
-		];
149
-	}
150
-
151
-	/**
152
-	 * Get the timestamp of the last password check
153
-	 *
154
-	 * @return int
155
-	 */
156
-	public function getLastCheck(): int {
157
-		return parent::getLastCheck();
158
-	}
159
-
160
-	/**
161
-	 * Get the timestamp of the last password check
162
-	 *
163
-	 * @param int $time
164
-	 */
165
-	public function setLastCheck(int $time) {
166
-		parent::setLastCheck($time);
167
-	}
168
-
169
-	public function getScope(): string {
170
-		$scope = parent::getScope();
171
-		if ($scope === null) {
172
-			return '';
173
-		}
174
-
175
-		return $scope;
176
-	}
177
-
178
-	public function getScopeAsArray(): array {
179
-		$scope = json_decode($this->getScope(), true);
180
-		if (!$scope) {
181
-			return [
182
-				'filesystem' => true
183
-			];
184
-		}
185
-		return $scope;
186
-	}
187
-
188
-	public function setScope($scope) {
189
-		if (is_array($scope)) {
190
-			parent::setScope(json_encode($scope));
191
-		} else {
192
-			parent::setScope((string)$scope);
193
-		}
194
-	}
195
-
196
-	public function getName(): string {
197
-		return parent::getName();
198
-	}
199
-
200
-	public function setName(string $name): void {
201
-		parent::setName($name);
202
-	}
203
-
204
-	public function getRemember(): int {
205
-		return parent::getRemember();
206
-	}
207
-
208
-	public function setToken(string $token) {
209
-		parent::setToken($token);
210
-	}
211
-
212
-	public function setPassword(string $password = null) {
213
-		parent::setPassword($password);
214
-	}
215
-
216
-	public function setExpires($expires) {
217
-		parent::setExpires($expires);
218
-	}
219
-
220
-	/**
221
-	 * @return int|null
222
-	 */
223
-	public function getExpires() {
224
-		return parent::getExpires();
225
-	}
226
-
227
-	public function setPasswordInvalid(bool $invalid) {
228
-		parent::setPasswordInvalid($invalid);
229
-	}
230
-
231
-	public function wipe(): void {
232
-		parent::setType(IToken::WIPE_TOKEN);
233
-	}
50
+    public const VERSION = 2;
51
+
52
+    /** @var string user UID */
53
+    protected $uid;
54
+
55
+    /** @var string login name used for generating the token */
56
+    protected $loginName;
57
+
58
+    /** @var string encrypted user password */
59
+    protected $password;
60
+
61
+    /** @var string token name (e.g. browser/OS) */
62
+    protected $name;
63
+
64
+    /** @var string */
65
+    protected $token;
66
+
67
+    /** @var int */
68
+    protected $type;
69
+
70
+    /** @var int */
71
+    protected $remember;
72
+
73
+    /** @var int */
74
+    protected $lastActivity;
75
+
76
+    /** @var int */
77
+    protected $lastCheck;
78
+
79
+    /** @var string */
80
+    protected $scope;
81
+
82
+    /** @var int */
83
+    protected $expires;
84
+
85
+    /** @var string */
86
+    protected $privateKey;
87
+
88
+    /** @var string */
89
+    protected $publicKey;
90
+
91
+    /** @var int */
92
+    protected $version;
93
+
94
+    /** @var bool */
95
+    protected $passwordInvalid;
96
+
97
+    public function __construct() {
98
+        $this->addType('uid', 'string');
99
+        $this->addType('loginName', 'string');
100
+        $this->addType('password', 'string');
101
+        $this->addType('name', 'string');
102
+        $this->addType('token', 'string');
103
+        $this->addType('type', 'int');
104
+        $this->addType('remember', 'int');
105
+        $this->addType('lastActivity', 'int');
106
+        $this->addType('lastCheck', 'int');
107
+        $this->addType('scope', 'string');
108
+        $this->addType('expires', 'int');
109
+        $this->addType('publicKey', 'string');
110
+        $this->addType('privateKey', 'string');
111
+        $this->addType('version', 'int');
112
+        $this->addType('passwordInvalid', 'bool');
113
+    }
114
+
115
+    public function getId(): int {
116
+        return $this->id;
117
+    }
118
+
119
+    public function getUID(): string {
120
+        return $this->uid;
121
+    }
122
+
123
+    /**
124
+     * Get the login name used when generating the token
125
+     *
126
+     * @return string
127
+     */
128
+    public function getLoginName(): string {
129
+        return parent::getLoginName();
130
+    }
131
+
132
+    /**
133
+     * Get the (encrypted) login password
134
+     *
135
+     * @return string|null
136
+     */
137
+    public function getPassword() {
138
+        return parent::getPassword();
139
+    }
140
+
141
+    public function jsonSerialize(): array {
142
+        return [
143
+            'id' => $this->id,
144
+            'name' => $this->name,
145
+            'lastActivity' => $this->lastActivity,
146
+            'type' => $this->type,
147
+            'scope' => $this->getScopeAsArray()
148
+        ];
149
+    }
150
+
151
+    /**
152
+     * Get the timestamp of the last password check
153
+     *
154
+     * @return int
155
+     */
156
+    public function getLastCheck(): int {
157
+        return parent::getLastCheck();
158
+    }
159
+
160
+    /**
161
+     * Get the timestamp of the last password check
162
+     *
163
+     * @param int $time
164
+     */
165
+    public function setLastCheck(int $time) {
166
+        parent::setLastCheck($time);
167
+    }
168
+
169
+    public function getScope(): string {
170
+        $scope = parent::getScope();
171
+        if ($scope === null) {
172
+            return '';
173
+        }
174
+
175
+        return $scope;
176
+    }
177
+
178
+    public function getScopeAsArray(): array {
179
+        $scope = json_decode($this->getScope(), true);
180
+        if (!$scope) {
181
+            return [
182
+                'filesystem' => true
183
+            ];
184
+        }
185
+        return $scope;
186
+    }
187
+
188
+    public function setScope($scope) {
189
+        if (is_array($scope)) {
190
+            parent::setScope(json_encode($scope));
191
+        } else {
192
+            parent::setScope((string)$scope);
193
+        }
194
+    }
195
+
196
+    public function getName(): string {
197
+        return parent::getName();
198
+    }
199
+
200
+    public function setName(string $name): void {
201
+        parent::setName($name);
202
+    }
203
+
204
+    public function getRemember(): int {
205
+        return parent::getRemember();
206
+    }
207
+
208
+    public function setToken(string $token) {
209
+        parent::setToken($token);
210
+    }
211
+
212
+    public function setPassword(string $password = null) {
213
+        parent::setPassword($password);
214
+    }
215
+
216
+    public function setExpires($expires) {
217
+        parent::setExpires($expires);
218
+    }
219
+
220
+    /**
221
+     * @return int|null
222
+     */
223
+    public function getExpires() {
224
+        return parent::getExpires();
225
+    }
226
+
227
+    public function setPasswordInvalid(bool $invalid) {
228
+        parent::setPasswordInvalid($invalid);
229
+    }
230
+
231
+    public function wipe(): void {
232
+        parent::setType(IToken::WIPE_TOKEN);
233
+    }
234 234
 }
Please login to merge, or discard this patch.
lib/public/Calendar/Resource/IResource.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -31,50 +31,50 @@
 block discarded – undo
31 31
  */
32 32
 interface IResource {
33 33
 
34
-	/**
35
-	 * get the resource id
36
-	 *
37
-	 * This id has to be unique within the backend
38
-	 *
39
-	 * @return string
40
-	 * @since 14.0.0
41
-	 */
42
-	public function getId():string;
34
+    /**
35
+     * get the resource id
36
+     *
37
+     * This id has to be unique within the backend
38
+     *
39
+     * @return string
40
+     * @since 14.0.0
41
+     */
42
+    public function getId():string;
43 43
 
44
-	/**
45
-	 * get the display name for a resource
46
-	 *
47
-	 * @return string
48
-	 * @since 14.0.0
49
-	 */
50
-	public function getDisplayName():string;
44
+    /**
45
+     * get the display name for a resource
46
+     *
47
+     * @return string
48
+     * @since 14.0.0
49
+     */
50
+    public function getDisplayName():string;
51 51
 
52
-	/**
53
-	 * Get a list of groupIds that are allowed to access this resource
54
-	 *
55
-	 * If an empty array is returned, no group restrictions are
56
-	 * applied.
57
-	 *
58
-	 * @return string[]
59
-	 * @since 14.0.0
60
-	 */
61
-	public function getGroupRestrictions():array;
52
+    /**
53
+     * Get a list of groupIds that are allowed to access this resource
54
+     *
55
+     * If an empty array is returned, no group restrictions are
56
+     * applied.
57
+     *
58
+     * @return string[]
59
+     * @since 14.0.0
60
+     */
61
+    public function getGroupRestrictions():array;
62 62
 
63
-	/**
64
-	 * get email-address for resource
65
-	 *
66
-	 * The email address has to be globally unique
67
-	 *
68
-	 * @return string
69
-	 * @since 14.0.0
70
-	 */
71
-	public function getEMail():string;
63
+    /**
64
+     * get email-address for resource
65
+     *
66
+     * The email address has to be globally unique
67
+     *
68
+     * @return string
69
+     * @since 14.0.0
70
+     */
71
+    public function getEMail():string;
72 72
 
73
-	/**
74
-	 * Get corresponding backend object
75
-	 *
76
-	 * @return IBackend
77
-	 * @since 14.0.0
78
-	 */
79
-	public function getBackend():IBackend;
73
+    /**
74
+     * Get corresponding backend object
75
+     *
76
+     * @return IBackend
77
+     * @since 14.0.0
78
+     */
79
+    public function getBackend():IBackend;
80 80
 }
Please login to merge, or discard this patch.