Passed
Push — master ( 873501...d2df81 )
by Maxence
14:59 queued 12s
created
lib/public/Files/Notify/IChange.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,28 +29,28 @@
 block discarded – undo
29 29
  * @since 12.0.0
30 30
  */
31 31
 interface IChange {
32
-	public const ADDED = 1;
33
-	public const REMOVED = 2;
34
-	public const MODIFIED = 3;
35
-	public const RENAMED = 4;
32
+    public const ADDED = 1;
33
+    public const REMOVED = 2;
34
+    public const MODIFIED = 3;
35
+    public const RENAMED = 4;
36 36
 
37
-	/**
38
-	 * Get the type of the change
39
-	 *
40
-	 * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED
41
-	 *
42
-	 * @since 12.0.0
43
-	 */
44
-	public function getType();
37
+    /**
38
+     * Get the type of the change
39
+     *
40
+     * @return int IChange::ADDED, IChange::REMOVED, IChange::MODIFIED or IChange::RENAMED
41
+     *
42
+     * @since 12.0.0
43
+     */
44
+    public function getType();
45 45
 
46
-	/**
47
-	 * Get the path of the file that was changed relative to the root of the storage
48
-	 *
49
-	 * Note, for rename changes this path is the old path for the file
50
-	 *
51
-	 * @return mixed
52
-	 *
53
-	 * @since 12.0.0
54
-	 */
55
-	public function getPath();
46
+    /**
47
+     * Get the path of the file that was changed relative to the root of the storage
48
+     *
49
+     * Note, for rename changes this path is the old path for the file
50
+     *
51
+     * @return mixed
52
+     *
53
+     * @since 12.0.0
54
+     */
55
+    public function getPath();
56 56
 }
Please login to merge, or discard this patch.
lib/public/Files/StorageNotAvailableException.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -44,50 +44,50 @@
 block discarded – undo
44 44
  * @since 6.0.0 - since 8.2.1 based on HintException
45 45
  */
46 46
 class StorageNotAvailableException extends HintException {
47
-	public const STATUS_SUCCESS = 0;
48
-	public const STATUS_ERROR = 1;
49
-	public const STATUS_INDETERMINATE = 2;
50
-	public const STATUS_INCOMPLETE_CONF = 3;
51
-	public const STATUS_UNAUTHORIZED = 4;
52
-	public const STATUS_TIMEOUT = 5;
53
-	public const STATUS_NETWORK_ERROR = 6;
47
+    public const STATUS_SUCCESS = 0;
48
+    public const STATUS_ERROR = 1;
49
+    public const STATUS_INDETERMINATE = 2;
50
+    public const STATUS_INCOMPLETE_CONF = 3;
51
+    public const STATUS_UNAUTHORIZED = 4;
52
+    public const STATUS_TIMEOUT = 5;
53
+    public const STATUS_NETWORK_ERROR = 6;
54 54
 
55
-	/**
56
-	 * StorageNotAvailableException constructor.
57
-	 *
58
-	 * @param string $message
59
-	 * @param int $code
60
-	 * @param \Exception|null $previous
61
-	 * @since 6.0.0
62
-	 */
63
-	public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
64
-		$l = \OC::$server->getL10N('core');
65
-		parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous);
66
-	}
55
+    /**
56
+     * StorageNotAvailableException constructor.
57
+     *
58
+     * @param string $message
59
+     * @param int $code
60
+     * @param \Exception|null $previous
61
+     * @since 6.0.0
62
+     */
63
+    public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
64
+        $l = \OC::$server->getL10N('core');
65
+        parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous);
66
+    }
67 67
 
68
-	/**
69
-	 * Get the name for a status code
70
-	 *
71
-	 * @param int $code
72
-	 * @return string
73
-	 * @since 9.0.0
74
-	 */
75
-	public static function getStateCodeName($code) {
76
-		switch ($code) {
77
-			case self::STATUS_SUCCESS:
78
-				return 'ok';
79
-			case self::STATUS_ERROR:
80
-				return 'error';
81
-			case self::STATUS_INDETERMINATE:
82
-				return 'indeterminate';
83
-			case self::STATUS_UNAUTHORIZED:
84
-				return 'unauthorized';
85
-			case self::STATUS_TIMEOUT:
86
-				return 'timeout';
87
-			case self::STATUS_NETWORK_ERROR:
88
-				return 'network error';
89
-			default:
90
-				return 'unknown';
91
-		}
92
-	}
68
+    /**
69
+     * Get the name for a status code
70
+     *
71
+     * @param int $code
72
+     * @return string
73
+     * @since 9.0.0
74
+     */
75
+    public static function getStateCodeName($code) {
76
+        switch ($code) {
77
+            case self::STATUS_SUCCESS:
78
+                return 'ok';
79
+            case self::STATUS_ERROR:
80
+                return 'error';
81
+            case self::STATUS_INDETERMINATE:
82
+                return 'indeterminate';
83
+            case self::STATUS_UNAUTHORIZED:
84
+                return 'unauthorized';
85
+            case self::STATUS_TIMEOUT:
86
+                return 'timeout';
87
+            case self::STATUS_NETWORK_ERROR:
88
+                return 'network error';
89
+            default:
90
+                return 'unknown';
91
+        }
92
+    }
93 93
 }
Please login to merge, or discard this patch.
lib/public/Files/Search/ISearchBinaryOperator.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,27 +27,27 @@
 block discarded – undo
27 27
  * @since 12.0.0
28 28
  */
29 29
 interface ISearchBinaryOperator extends ISearchOperator {
30
-	public const OPERATOR_AND = 'and';
31
-	public const OPERATOR_OR = 'or';
32
-	public const OPERATOR_NOT = 'not';
30
+    public const OPERATOR_AND = 'and';
31
+    public const OPERATOR_OR = 'or';
32
+    public const OPERATOR_NOT = 'not';
33 33
 
34
-	/**
35
-	 * The type of binary operator
36
-	 *
37
-	 * One of the ISearchBinaryOperator::OPERATOR_* constants
38
-	 *
39
-	 * @return string
40
-	 * @since 12.0.0
41
-	 */
42
-	public function getType();
34
+    /**
35
+     * The type of binary operator
36
+     *
37
+     * One of the ISearchBinaryOperator::OPERATOR_* constants
38
+     *
39
+     * @return string
40
+     * @since 12.0.0
41
+     */
42
+    public function getType();
43 43
 
44
-	/**
45
-	 * The arguments for the binary operator
46
-	 *
47
-	 * One argument for the 'not' operator and two for 'and' and 'or'
48
-	 *
49
-	 * @return ISearchOperator[]
50
-	 * @since 12.0.0
51
-	 */
52
-	public function getArguments();
44
+    /**
45
+     * The arguments for the binary operator
46
+     *
47
+     * One argument for the 'not' operator and two for 'and' and 'or'
48
+     *
49
+     * @return ISearchOperator[]
50
+     * @since 12.0.0
51
+     */
52
+    public function getArguments();
53 53
 }
Please login to merge, or discard this patch.
lib/public/AppFramework/Http.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -34,63 +34,63 @@
 block discarded – undo
34 34
  * @since 6.0.0
35 35
  */
36 36
 class Http {
37
-	public const STATUS_CONTINUE = 100;
38
-	public const STATUS_SWITCHING_PROTOCOLS = 101;
39
-	public const STATUS_PROCESSING = 102;
40
-	public const STATUS_OK = 200;
41
-	public const STATUS_CREATED = 201;
42
-	public const STATUS_ACCEPTED = 202;
43
-	public const STATUS_NON_AUTHORATIVE_INFORMATION = 203;
44
-	public const STATUS_NO_CONTENT = 204;
45
-	public const STATUS_RESET_CONTENT = 205;
46
-	public const STATUS_PARTIAL_CONTENT = 206;
47
-	public const STATUS_MULTI_STATUS = 207;
48
-	public const STATUS_ALREADY_REPORTED = 208;
49
-	public const STATUS_IM_USED = 226;
50
-	public const STATUS_MULTIPLE_CHOICES = 300;
51
-	public const STATUS_MOVED_PERMANENTLY = 301;
52
-	public const STATUS_FOUND = 302;
53
-	public const STATUS_SEE_OTHER = 303;
54
-	public const STATUS_NOT_MODIFIED = 304;
55
-	public const STATUS_USE_PROXY = 305;
56
-	public const STATUS_RESERVED = 306;
57
-	public const STATUS_TEMPORARY_REDIRECT = 307;
58
-	public const STATUS_BAD_REQUEST = 400;
59
-	public const STATUS_UNAUTHORIZED = 401;
60
-	public const STATUS_PAYMENT_REQUIRED = 402;
61
-	public const STATUS_FORBIDDEN = 403;
62
-	public const STATUS_NOT_FOUND = 404;
63
-	public const STATUS_METHOD_NOT_ALLOWED = 405;
64
-	public const STATUS_NOT_ACCEPTABLE = 406;
65
-	public const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407;
66
-	public const STATUS_REQUEST_TIMEOUT = 408;
67
-	public const STATUS_CONFLICT = 409;
68
-	public const STATUS_GONE = 410;
69
-	public const STATUS_LENGTH_REQUIRED = 411;
70
-	public const STATUS_PRECONDITION_FAILED = 412;
71
-	public const STATUS_REQUEST_ENTITY_TOO_LARGE = 413;
72
-	public const STATUS_REQUEST_URI_TOO_LONG = 414;
73
-	public const STATUS_UNSUPPORTED_MEDIA_TYPE = 415;
74
-	public const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416;
75
-	public const STATUS_EXPECTATION_FAILED = 417;
76
-	public const STATUS_IM_A_TEAPOT = 418;
77
-	public const STATUS_UNPROCESSABLE_ENTITY = 422;
78
-	public const STATUS_LOCKED = 423;
79
-	public const STATUS_FAILED_DEPENDENCY = 424;
80
-	public const STATUS_UPGRADE_REQUIRED = 426;
81
-	public const STATUS_PRECONDITION_REQUIRED = 428;
82
-	public const STATUS_TOO_MANY_REQUESTS = 429;
83
-	public const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
84
-	public const STATUS_INTERNAL_SERVER_ERROR = 500;
85
-	public const STATUS_NOT_IMPLEMENTED = 501;
86
-	public const STATUS_BAD_GATEWAY = 502;
87
-	public const STATUS_SERVICE_UNAVAILABLE = 503;
88
-	public const STATUS_GATEWAY_TIMEOUT = 504;
89
-	public const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505;
90
-	public const STATUS_VARIANT_ALSO_NEGOTIATES = 506;
91
-	public const STATUS_INSUFFICIENT_STORAGE = 507;
92
-	public const STATUS_LOOP_DETECTED = 508;
93
-	public const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509;
94
-	public const STATUS_NOT_EXTENDED = 510;
95
-	public const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511;
37
+    public const STATUS_CONTINUE = 100;
38
+    public const STATUS_SWITCHING_PROTOCOLS = 101;
39
+    public const STATUS_PROCESSING = 102;
40
+    public const STATUS_OK = 200;
41
+    public const STATUS_CREATED = 201;
42
+    public const STATUS_ACCEPTED = 202;
43
+    public const STATUS_NON_AUTHORATIVE_INFORMATION = 203;
44
+    public const STATUS_NO_CONTENT = 204;
45
+    public const STATUS_RESET_CONTENT = 205;
46
+    public const STATUS_PARTIAL_CONTENT = 206;
47
+    public const STATUS_MULTI_STATUS = 207;
48
+    public const STATUS_ALREADY_REPORTED = 208;
49
+    public const STATUS_IM_USED = 226;
50
+    public const STATUS_MULTIPLE_CHOICES = 300;
51
+    public const STATUS_MOVED_PERMANENTLY = 301;
52
+    public const STATUS_FOUND = 302;
53
+    public const STATUS_SEE_OTHER = 303;
54
+    public const STATUS_NOT_MODIFIED = 304;
55
+    public const STATUS_USE_PROXY = 305;
56
+    public const STATUS_RESERVED = 306;
57
+    public const STATUS_TEMPORARY_REDIRECT = 307;
58
+    public const STATUS_BAD_REQUEST = 400;
59
+    public const STATUS_UNAUTHORIZED = 401;
60
+    public const STATUS_PAYMENT_REQUIRED = 402;
61
+    public const STATUS_FORBIDDEN = 403;
62
+    public const STATUS_NOT_FOUND = 404;
63
+    public const STATUS_METHOD_NOT_ALLOWED = 405;
64
+    public const STATUS_NOT_ACCEPTABLE = 406;
65
+    public const STATUS_PROXY_AUTHENTICATION_REQUIRED = 407;
66
+    public const STATUS_REQUEST_TIMEOUT = 408;
67
+    public const STATUS_CONFLICT = 409;
68
+    public const STATUS_GONE = 410;
69
+    public const STATUS_LENGTH_REQUIRED = 411;
70
+    public const STATUS_PRECONDITION_FAILED = 412;
71
+    public const STATUS_REQUEST_ENTITY_TOO_LARGE = 413;
72
+    public const STATUS_REQUEST_URI_TOO_LONG = 414;
73
+    public const STATUS_UNSUPPORTED_MEDIA_TYPE = 415;
74
+    public const STATUS_REQUEST_RANGE_NOT_SATISFIABLE = 416;
75
+    public const STATUS_EXPECTATION_FAILED = 417;
76
+    public const STATUS_IM_A_TEAPOT = 418;
77
+    public const STATUS_UNPROCESSABLE_ENTITY = 422;
78
+    public const STATUS_LOCKED = 423;
79
+    public const STATUS_FAILED_DEPENDENCY = 424;
80
+    public const STATUS_UPGRADE_REQUIRED = 426;
81
+    public const STATUS_PRECONDITION_REQUIRED = 428;
82
+    public const STATUS_TOO_MANY_REQUESTS = 429;
83
+    public const STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;
84
+    public const STATUS_INTERNAL_SERVER_ERROR = 500;
85
+    public const STATUS_NOT_IMPLEMENTED = 501;
86
+    public const STATUS_BAD_GATEWAY = 502;
87
+    public const STATUS_SERVICE_UNAVAILABLE = 503;
88
+    public const STATUS_GATEWAY_TIMEOUT = 504;
89
+    public const STATUS_HTTP_VERSION_NOT_SUPPORTED = 505;
90
+    public const STATUS_VARIANT_ALSO_NEGOTIATES = 506;
91
+    public const STATUS_INSUFFICIENT_STORAGE = 507;
92
+    public const STATUS_LOOP_DETECTED = 508;
93
+    public const STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509;
94
+    public const STATUS_NOT_EXTENDED = 510;
95
+    public const STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511;
96 96
 }
Please login to merge, or discard this patch.
lib/private/Remote/User.php 1 patch
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -26,114 +26,114 @@
 block discarded – undo
26 26
 use OCP\Remote\IUser;
27 27
 
28 28
 class User implements IUser {
29
-	public const EXPECTED_KEYS = [
30
-		'id',
31
-		'email',
32
-		'displayname',
33
-		'phone',
34
-		'address',
35
-		'website',
36
-		'groups',
37
-		'language',
38
-		'quota'
39
-	];
40
-
41
-	/** @var array */
42
-	private $data;
43
-
44
-	public function __construct(array $data) {
45
-		$this->data = $data;
46
-	}
47
-
48
-
49
-	/**
50
-	 * @return string
51
-	 */
52
-	public function getUserId() {
53
-		return $this->data['id'];
54
-	}
55
-
56
-	/**
57
-	 * @return string
58
-	 */
59
-	public function getEmail() {
60
-		return $this->data['email'];
61
-	}
62
-
63
-	/**
64
-	 * @return string
65
-	 */
66
-	public function getDisplayName() {
67
-		return $this->data['displayname'];
68
-	}
69
-
70
-	/**
71
-	 * @return string
72
-	 */
73
-	public function getPhone() {
74
-		return $this->data['phone'];
75
-	}
76
-
77
-	/**
78
-	 * @return string
79
-	 */
80
-	public function getAddress() {
81
-		return $this->data['address'];
82
-	}
83
-
84
-	/**
85
-	 * @return string
86
-	 */
87
-	public function getWebsite() {
88
-		return $this->data['website'];
89
-	}
90
-
91
-	/**
92
-	 * @return string
93
-	 */
94
-	public function getTwitter() {
95
-		return isset($this->data['twitter']) ? $this->data['twitter'] : '';
96
-	}
97
-
98
-	/**
99
-	 * @return string[]
100
-	 */
101
-	public function getGroups() {
102
-		return $this->data['groups'];
103
-	}
104
-
105
-	/**
106
-	 * @return string
107
-	 */
108
-	public function getLanguage() {
109
-		return $this->data['language'];
110
-	}
111
-
112
-	/**
113
-	 * @return int
114
-	 */
115
-	public function getUsedSpace() {
116
-		return $this->data['quota']['used'];
117
-	}
118
-
119
-	/**
120
-	 * @return int
121
-	 */
122
-	public function getFreeSpace() {
123
-		return $this->data['quota']['free'];
124
-	}
125
-
126
-	/**
127
-	 * @return int
128
-	 */
129
-	public function getTotalSpace() {
130
-		return $this->data['quota']['total'];
131
-	}
132
-
133
-	/**
134
-	 * @return int
135
-	 */
136
-	public function getQuota() {
137
-		return $this->data['quota']['quota'];
138
-	}
29
+    public const EXPECTED_KEYS = [
30
+        'id',
31
+        'email',
32
+        'displayname',
33
+        'phone',
34
+        'address',
35
+        'website',
36
+        'groups',
37
+        'language',
38
+        'quota'
39
+    ];
40
+
41
+    /** @var array */
42
+    private $data;
43
+
44
+    public function __construct(array $data) {
45
+        $this->data = $data;
46
+    }
47
+
48
+
49
+    /**
50
+     * @return string
51
+     */
52
+    public function getUserId() {
53
+        return $this->data['id'];
54
+    }
55
+
56
+    /**
57
+     * @return string
58
+     */
59
+    public function getEmail() {
60
+        return $this->data['email'];
61
+    }
62
+
63
+    /**
64
+     * @return string
65
+     */
66
+    public function getDisplayName() {
67
+        return $this->data['displayname'];
68
+    }
69
+
70
+    /**
71
+     * @return string
72
+     */
73
+    public function getPhone() {
74
+        return $this->data['phone'];
75
+    }
76
+
77
+    /**
78
+     * @return string
79
+     */
80
+    public function getAddress() {
81
+        return $this->data['address'];
82
+    }
83
+
84
+    /**
85
+     * @return string
86
+     */
87
+    public function getWebsite() {
88
+        return $this->data['website'];
89
+    }
90
+
91
+    /**
92
+     * @return string
93
+     */
94
+    public function getTwitter() {
95
+        return isset($this->data['twitter']) ? $this->data['twitter'] : '';
96
+    }
97
+
98
+    /**
99
+     * @return string[]
100
+     */
101
+    public function getGroups() {
102
+        return $this->data['groups'];
103
+    }
104
+
105
+    /**
106
+     * @return string
107
+     */
108
+    public function getLanguage() {
109
+        return $this->data['language'];
110
+    }
111
+
112
+    /**
113
+     * @return int
114
+     */
115
+    public function getUsedSpace() {
116
+        return $this->data['quota']['used'];
117
+    }
118
+
119
+    /**
120
+     * @return int
121
+     */
122
+    public function getFreeSpace() {
123
+        return $this->data['quota']['free'];
124
+    }
125
+
126
+    /**
127
+     * @return int
128
+     */
129
+    public function getTotalSpace() {
130
+        return $this->data['quota']['total'];
131
+    }
132
+
133
+    /**
134
+     * @return int
135
+     */
136
+    public function getQuota() {
137
+        return $this->data['quota']['quota'];
138
+    }
139 139
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Token/IToken.php 1 patch
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -30,106 +30,106 @@
 block discarded – undo
30 30
 use JsonSerializable;
31 31
 
32 32
 interface IToken extends JsonSerializable {
33
-	public const TEMPORARY_TOKEN = 0;
34
-	public const PERMANENT_TOKEN = 1;
35
-	public const WIPE_TOKEN = 2;
36
-	public const DO_NOT_REMEMBER = 0;
37
-	public const REMEMBER = 1;
38
-
39
-	/**
40
-	 * Get the token ID
41
-	 *
42
-	 * @return int
43
-	 */
44
-	public function getId(): int;
45
-
46
-	/**
47
-	 * Get the user UID
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getUID(): string;
52
-
53
-	/**
54
-	 * Get the login name used when generating the token
55
-	 *
56
-	 * @return string
57
-	 */
58
-	public function getLoginName(): string;
59
-
60
-	/**
61
-	 * Get the (encrypted) login password
62
-	 *
63
-	 * @return string|null
64
-	 */
65
-	public function getPassword();
66
-
67
-	/**
68
-	 * Get the timestamp of the last password check
69
-	 *
70
-	 * @return int
71
-	 */
72
-	public function getLastCheck(): int;
73
-
74
-	/**
75
-	 * Set the timestamp of the last password check
76
-	 *
77
-	 * @param int $time
78
-	 */
79
-	public function setLastCheck(int $time);
80
-
81
-	/**
82
-	 * Get the authentication scope for this token
83
-	 *
84
-	 * @return string
85
-	 */
86
-	public function getScope(): string;
87
-
88
-	/**
89
-	 * Get the authentication scope for this token
90
-	 *
91
-	 * @return array
92
-	 */
93
-	public function getScopeAsArray(): array;
94
-
95
-	/**
96
-	 * Set the authentication scope for this token
97
-	 *
98
-	 * @param array $scope
99
-	 */
100
-	public function setScope($scope);
101
-
102
-	/**
103
-	 * Get the name of the token
104
-	 * @return string
105
-	 */
106
-	public function getName(): string;
107
-
108
-	/**
109
-	 * Get the remember state of the token
110
-	 *
111
-	 * @return int
112
-	 */
113
-	public function getRemember(): int;
114
-
115
-	/**
116
-	 * Set the token
117
-	 *
118
-	 * @param string $token
119
-	 */
120
-	public function setToken(string $token);
121
-
122
-	/**
123
-	 * Set the password
124
-	 *
125
-	 * @param string $password
126
-	 */
127
-	public function setPassword(string $password);
128
-
129
-	/**
130
-	 * Set the expiration time of the token
131
-	 *
132
-	 * @param int|null $expires
133
-	 */
134
-	public function setExpires($expires);
33
+    public const TEMPORARY_TOKEN = 0;
34
+    public const PERMANENT_TOKEN = 1;
35
+    public const WIPE_TOKEN = 2;
36
+    public const DO_NOT_REMEMBER = 0;
37
+    public const REMEMBER = 1;
38
+
39
+    /**
40
+     * Get the token ID
41
+     *
42
+     * @return int
43
+     */
44
+    public function getId(): int;
45
+
46
+    /**
47
+     * Get the user UID
48
+     *
49
+     * @return string
50
+     */
51
+    public function getUID(): string;
52
+
53
+    /**
54
+     * Get the login name used when generating the token
55
+     *
56
+     * @return string
57
+     */
58
+    public function getLoginName(): string;
59
+
60
+    /**
61
+     * Get the (encrypted) login password
62
+     *
63
+     * @return string|null
64
+     */
65
+    public function getPassword();
66
+
67
+    /**
68
+     * Get the timestamp of the last password check
69
+     *
70
+     * @return int
71
+     */
72
+    public function getLastCheck(): int;
73
+
74
+    /**
75
+     * Set the timestamp of the last password check
76
+     *
77
+     * @param int $time
78
+     */
79
+    public function setLastCheck(int $time);
80
+
81
+    /**
82
+     * Get the authentication scope for this token
83
+     *
84
+     * @return string
85
+     */
86
+    public function getScope(): string;
87
+
88
+    /**
89
+     * Get the authentication scope for this token
90
+     *
91
+     * @return array
92
+     */
93
+    public function getScopeAsArray(): array;
94
+
95
+    /**
96
+     * Set the authentication scope for this token
97
+     *
98
+     * @param array $scope
99
+     */
100
+    public function setScope($scope);
101
+
102
+    /**
103
+     * Get the name of the token
104
+     * @return string
105
+     */
106
+    public function getName(): string;
107
+
108
+    /**
109
+     * Get the remember state of the token
110
+     *
111
+     * @return int
112
+     */
113
+    public function getRemember(): int;
114
+
115
+    /**
116
+     * Set the token
117
+     *
118
+     * @param string $token
119
+     */
120
+    public function setToken(string $token);
121
+
122
+    /**
123
+     * Set the password
124
+     *
125
+     * @param string $password
126
+     */
127
+    public function setPassword(string $password);
128
+
129
+    /**
130
+     * Set the expiration time of the token
131
+     *
132
+     * @param int|null $expires
133
+     */
134
+    public function setExpires($expires);
135 135
 }
Please login to merge, or discard this patch.
apps/encryption/lib/Session.php 1 patch
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -31,157 +31,157 @@
 block discarded – undo
31 31
 
32 32
 class Session {
33 33
 
34
-	/** @var ISession */
35
-	protected $session;
36
-
37
-	public const NOT_INITIALIZED = '0';
38
-	public const INIT_EXECUTED = '1';
39
-	public const INIT_SUCCESSFUL = '2';
40
-
41
-	/**
42
-	 * @param ISession $session
43
-	 */
44
-	public function __construct(ISession $session) {
45
-		$this->session = $session;
46
-	}
47
-
48
-	/**
49
-	 * Sets status of encryption app
50
-	 *
51
-	 * @param string $status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
52
-	 */
53
-	public function setStatus($status) {
54
-		$this->session->set('encryptionInitialized', $status);
55
-	}
56
-
57
-	/**
58
-	 * Gets status if we already tried to initialize the encryption app
59
-	 *
60
-	 * @return string init status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
61
-	 */
62
-	public function getStatus() {
63
-		$status = $this->session->get('encryptionInitialized');
64
-		if (is_null($status)) {
65
-			$status = self::NOT_INITIALIZED;
66
-		}
67
-
68
-		return $status;
69
-	}
70
-
71
-	/**
72
-	 * check if encryption was initialized successfully
73
-	 *
74
-	 * @return bool
75
-	 */
76
-	public function isReady() {
77
-		$status = $this->getStatus();
78
-		return $status === self::INIT_SUCCESSFUL;
79
-	}
80
-
81
-	/**
82
-	 * Gets user or public share private key from session
83
-	 *
84
-	 * @return string $privateKey The user's plaintext private key
85
-	 * @throws Exceptions\PrivateKeyMissingException
86
-	 */
87
-	public function getPrivateKey() {
88
-		$key = $this->session->get('privateKey');
89
-		if (is_null($key)) {
90
-			throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
91
-		}
92
-		return $key;
93
-	}
94
-
95
-	/**
96
-	 * check if private key is set
97
-	 *
98
-	 * @return boolean
99
-	 */
100
-	public function isPrivateKeySet() {
101
-		$key = $this->session->get('privateKey');
102
-		if (is_null($key)) {
103
-			return false;
104
-		}
105
-
106
-		return true;
107
-	}
108
-
109
-	/**
110
-	 * Sets user private key to session
111
-	 *
112
-	 * @param string $key users private key
113
-	 *
114
-	 * @note this should only be set on login
115
-	 */
116
-	public function setPrivateKey($key) {
117
-		$this->session->set('privateKey', $key);
118
-	}
119
-
120
-	/**
121
-	 * store data needed for the decrypt all operation in the session
122
-	 *
123
-	 * @param string $user
124
-	 * @param string $key
125
-	 */
126
-	public function prepareDecryptAll($user, $key) {
127
-		$this->session->set('decryptAll', true);
128
-		$this->session->set('decryptAllKey', $key);
129
-		$this->session->set('decryptAllUid', $user);
130
-	}
131
-
132
-	/**
133
-	 * check if we are in decrypt all mode
134
-	 *
135
-	 * @return bool
136
-	 */
137
-	public function decryptAllModeActivated() {
138
-		$decryptAll = $this->session->get('decryptAll');
139
-		return ($decryptAll === true);
140
-	}
141
-
142
-	/**
143
-	 * get uid used for decrypt all operation
144
-	 *
145
-	 * @return string
146
-	 * @throws \Exception
147
-	 */
148
-	public function getDecryptAllUid() {
149
-		$uid = $this->session->get('decryptAllUid');
150
-		if (is_null($uid) && $this->decryptAllModeActivated()) {
151
-			throw new \Exception('No uid found while in decrypt all mode');
152
-		} elseif (is_null($uid)) {
153
-			throw new \Exception('Please activate decrypt all mode first');
154
-		}
155
-
156
-		return $uid;
157
-	}
158
-
159
-	/**
160
-	 * get private key for decrypt all operation
161
-	 *
162
-	 * @return string
163
-	 * @throws PrivateKeyMissingException
164
-	 */
165
-	public function getDecryptAllKey() {
166
-		$privateKey = $this->session->get('decryptAllKey');
167
-		if (is_null($privateKey) && $this->decryptAllModeActivated()) {
168
-			throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
169
-		} elseif (is_null($privateKey)) {
170
-			throw new PrivateKeyMissingException('Please activate decrypt all mode first');
171
-		}
172
-
173
-		return $privateKey;
174
-	}
175
-
176
-	/**
177
-	 * remove keys from session
178
-	 */
179
-	public function clear() {
180
-		$this->session->remove('publicSharePrivateKey');
181
-		$this->session->remove('privateKey');
182
-		$this->session->remove('encryptionInitialized');
183
-		$this->session->remove('decryptAll');
184
-		$this->session->remove('decryptAllKey');
185
-		$this->session->remove('decryptAllUid');
186
-	}
34
+    /** @var ISession */
35
+    protected $session;
36
+
37
+    public const NOT_INITIALIZED = '0';
38
+    public const INIT_EXECUTED = '1';
39
+    public const INIT_SUCCESSFUL = '2';
40
+
41
+    /**
42
+     * @param ISession $session
43
+     */
44
+    public function __construct(ISession $session) {
45
+        $this->session = $session;
46
+    }
47
+
48
+    /**
49
+     * Sets status of encryption app
50
+     *
51
+     * @param string $status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
52
+     */
53
+    public function setStatus($status) {
54
+        $this->session->set('encryptionInitialized', $status);
55
+    }
56
+
57
+    /**
58
+     * Gets status if we already tried to initialize the encryption app
59
+     *
60
+     * @return string init status INIT_SUCCESSFUL, INIT_EXECUTED, NOT_INITIALIZED
61
+     */
62
+    public function getStatus() {
63
+        $status = $this->session->get('encryptionInitialized');
64
+        if (is_null($status)) {
65
+            $status = self::NOT_INITIALIZED;
66
+        }
67
+
68
+        return $status;
69
+    }
70
+
71
+    /**
72
+     * check if encryption was initialized successfully
73
+     *
74
+     * @return bool
75
+     */
76
+    public function isReady() {
77
+        $status = $this->getStatus();
78
+        return $status === self::INIT_SUCCESSFUL;
79
+    }
80
+
81
+    /**
82
+     * Gets user or public share private key from session
83
+     *
84
+     * @return string $privateKey The user's plaintext private key
85
+     * @throws Exceptions\PrivateKeyMissingException
86
+     */
87
+    public function getPrivateKey() {
88
+        $key = $this->session->get('privateKey');
89
+        if (is_null($key)) {
90
+            throw new Exceptions\PrivateKeyMissingException('please try to log-out and log-in again', 0);
91
+        }
92
+        return $key;
93
+    }
94
+
95
+    /**
96
+     * check if private key is set
97
+     *
98
+     * @return boolean
99
+     */
100
+    public function isPrivateKeySet() {
101
+        $key = $this->session->get('privateKey');
102
+        if (is_null($key)) {
103
+            return false;
104
+        }
105
+
106
+        return true;
107
+    }
108
+
109
+    /**
110
+     * Sets user private key to session
111
+     *
112
+     * @param string $key users private key
113
+     *
114
+     * @note this should only be set on login
115
+     */
116
+    public function setPrivateKey($key) {
117
+        $this->session->set('privateKey', $key);
118
+    }
119
+
120
+    /**
121
+     * store data needed for the decrypt all operation in the session
122
+     *
123
+     * @param string $user
124
+     * @param string $key
125
+     */
126
+    public function prepareDecryptAll($user, $key) {
127
+        $this->session->set('decryptAll', true);
128
+        $this->session->set('decryptAllKey', $key);
129
+        $this->session->set('decryptAllUid', $user);
130
+    }
131
+
132
+    /**
133
+     * check if we are in decrypt all mode
134
+     *
135
+     * @return bool
136
+     */
137
+    public function decryptAllModeActivated() {
138
+        $decryptAll = $this->session->get('decryptAll');
139
+        return ($decryptAll === true);
140
+    }
141
+
142
+    /**
143
+     * get uid used for decrypt all operation
144
+     *
145
+     * @return string
146
+     * @throws \Exception
147
+     */
148
+    public function getDecryptAllUid() {
149
+        $uid = $this->session->get('decryptAllUid');
150
+        if (is_null($uid) && $this->decryptAllModeActivated()) {
151
+            throw new \Exception('No uid found while in decrypt all mode');
152
+        } elseif (is_null($uid)) {
153
+            throw new \Exception('Please activate decrypt all mode first');
154
+        }
155
+
156
+        return $uid;
157
+    }
158
+
159
+    /**
160
+     * get private key for decrypt all operation
161
+     *
162
+     * @return string
163
+     * @throws PrivateKeyMissingException
164
+     */
165
+    public function getDecryptAllKey() {
166
+        $privateKey = $this->session->get('decryptAllKey');
167
+        if (is_null($privateKey) && $this->decryptAllModeActivated()) {
168
+            throw new PrivateKeyMissingException('No private key found while in decrypt all mode');
169
+        } elseif (is_null($privateKey)) {
170
+            throw new PrivateKeyMissingException('Please activate decrypt all mode first');
171
+        }
172
+
173
+        return $privateKey;
174
+    }
175
+
176
+    /**
177
+     * remove keys from session
178
+     */
179
+    public function clear() {
180
+        $this->session->remove('publicSharePrivateKey');
181
+        $this->session->remove('privateKey');
182
+        $this->session->remove('encryptionInitialized');
183
+        $this->session->remove('decryptAll');
184
+        $this->session->remove('decryptAllKey');
185
+        $this->session->remove('decryptAllUid');
186
+    }
187 187
 }
Please login to merge, or discard this patch.
apps/dav/lib/DAV/Sharing/Plugin.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function initialize(Server $server) {
103 103
 		$this->server = $server;
104
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
105
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
104
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}share'] = ShareRequest::class;
105
+		$this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}invite'] = Invite::class;
106 106
 
107 107
 		$this->server->on('method:POST', [$this, 'httpPost']);
108
-		$this->server->on('propFind',    [$this, 'propFind']);
108
+		$this->server->on('propFind', [$this, 'propFind']);
109 109
 	}
110 110
 
111 111
 	/**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 
149 149
 			// Dealing with the 'share' document, which modified invitees on a
150 150
 			// calendar.
151
-			case '{' . self::NS_OWNCLOUD . '}share':
151
+			case '{'.self::NS_OWNCLOUD.'}share':
152 152
 
153 153
 				// We can only deal with IShareableCalendar objects
154 154
 				if (!$node instanceof IShareable) {
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function propFind(PropFind $propFind, INode $node) {
192 192
 		if ($node instanceof IShareable) {
193
-			$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
193
+			$propFind->handle('{'.Plugin::NS_OWNCLOUD.'}invite', function() use ($node) {
194 194
 				return new Invite(
195 195
 					$node->getShares()
196 196
 				);
Please login to merge, or discard this patch.
Indentation   +171 added lines, -171 removed lines patch added patch discarded remove patch
@@ -38,175 +38,175 @@
 block discarded – undo
38 38
 use Sabre\HTTP\ResponseInterface;
39 39
 
40 40
 class Plugin extends ServerPlugin {
41
-	public const NS_OWNCLOUD = 'http://owncloud.org/ns';
42
-	public const NS_NEXTCLOUD = 'http://nextcloud.com/ns';
43
-
44
-	/** @var Auth */
45
-	private $auth;
46
-
47
-	/** @var IRequest */
48
-	private $request;
49
-
50
-	/** @var IConfig */
51
-	private $config;
52
-
53
-	/**
54
-	 * Plugin constructor.
55
-	 *
56
-	 * @param Auth $authBackEnd
57
-	 * @param IRequest $request
58
-	 * @param IConfig $config
59
-	 */
60
-	public function __construct(Auth $authBackEnd, IRequest $request, IConfig $config) {
61
-		$this->auth = $authBackEnd;
62
-		$this->request = $request;
63
-		$this->config = $config;
64
-	}
65
-
66
-	/**
67
-	 * Reference to SabreDAV server object.
68
-	 *
69
-	 * @var \Sabre\DAV\Server
70
-	 */
71
-	protected $server;
72
-
73
-	/**
74
-	 * This method should return a list of server-features.
75
-	 *
76
-	 * This is for example 'versioning' and is added to the DAV: header
77
-	 * in an OPTIONS response.
78
-	 *
79
-	 * @return string[]
80
-	 */
81
-	public function getFeatures() {
82
-		return ['oc-resource-sharing'];
83
-	}
84
-
85
-	/**
86
-	 * Returns a plugin name.
87
-	 *
88
-	 * Using this name other plugins will be able to access other plugins
89
-	 * using Sabre\DAV\Server::getPlugin
90
-	 *
91
-	 * @return string
92
-	 */
93
-	public function getPluginName() {
94
-		return 'oc-resource-sharing';
95
-	}
96
-
97
-	/**
98
-	 * This initializes the plugin.
99
-	 *
100
-	 * This function is called by Sabre\DAV\Server, after
101
-	 * addPlugin is called.
102
-	 *
103
-	 * This method should set up the required event subscriptions.
104
-	 *
105
-	 * @param Server $server
106
-	 * @return void
107
-	 */
108
-	public function initialize(Server $server) {
109
-		$this->server = $server;
110
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
111
-		$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
112
-
113
-		$this->server->on('method:POST', [$this, 'httpPost']);
114
-		$this->server->on('propFind',    [$this, 'propFind']);
115
-	}
116
-
117
-	/**
118
-	 * We intercept this to handle POST requests on a dav resource.
119
-	 *
120
-	 * @param RequestInterface $request
121
-	 * @param ResponseInterface $response
122
-	 * @return null|false
123
-	 */
124
-	public function httpPost(RequestInterface $request, ResponseInterface $response) {
125
-		$path = $request->getPath();
126
-
127
-		// Only handling xml
128
-		$contentType = $request->getHeader('Content-Type');
129
-		if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
130
-			return;
131
-		}
132
-
133
-		// Making sure the node exists
134
-		try {
135
-			$node = $this->server->tree->getNodeForPath($path);
136
-		} catch (NotFound $e) {
137
-			return;
138
-		}
139
-
140
-		$requestBody = $request->getBodyAsString();
141
-
142
-		// If this request handler could not deal with this POST request, it
143
-		// will return 'null' and other plugins get a chance to handle the
144
-		// request.
145
-		//
146
-		// However, we already requested the full body. This is a problem,
147
-		// because a body can only be read once. This is why we preemptively
148
-		// re-populated the request body with the existing data.
149
-		$request->setBody($requestBody);
150
-
151
-		$message = $this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
152
-
153
-		switch ($documentType) {
154
-
155
-			// Dealing with the 'share' document, which modified invitees on a
156
-			// calendar.
157
-			case '{' . self::NS_OWNCLOUD . '}share':
158
-
159
-				// We can only deal with IShareableCalendar objects
160
-				if (!$node instanceof IShareable) {
161
-					return;
162
-				}
163
-
164
-				$this->server->transactionType = 'post-oc-resource-share';
165
-
166
-				// Getting ACL info
167
-				$acl = $this->server->getPlugin('acl');
168
-
169
-				// If there's no ACL support, we allow everything
170
-				if ($acl) {
171
-					/** @var \Sabre\DAVACL\Plugin $acl */
172
-					$acl->checkPrivileges($path, '{DAV:}write');
173
-
174
-					$limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
175
-					$isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
176
-					if ($limitSharingToOwner && !$isOwner) {
177
-						return;
178
-					}
179
-				}
180
-
181
-				$node->updateShares($message->set, $message->remove);
182
-
183
-				$response->setStatus(200);
184
-				// Adding this because sending a response body may cause issues,
185
-				// and I wanted some type of indicator the response was handled.
186
-				$response->setHeader('X-Sabre-Status', 'everything-went-well');
187
-
188
-				// Breaking the event chain
189
-				return false;
190
-		}
191
-	}
192
-
193
-	/**
194
-	 * This event is triggered when properties are requested for a certain
195
-	 * node.
196
-	 *
197
-	 * This allows us to inject any properties early.
198
-	 *
199
-	 * @param PropFind $propFind
200
-	 * @param INode $node
201
-	 * @return void
202
-	 */
203
-	public function propFind(PropFind $propFind, INode $node) {
204
-		if ($node instanceof IShareable) {
205
-			$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
206
-				return new Invite(
207
-					$node->getShares()
208
-				);
209
-			});
210
-		}
211
-	}
41
+    public const NS_OWNCLOUD = 'http://owncloud.org/ns';
42
+    public const NS_NEXTCLOUD = 'http://nextcloud.com/ns';
43
+
44
+    /** @var Auth */
45
+    private $auth;
46
+
47
+    /** @var IRequest */
48
+    private $request;
49
+
50
+    /** @var IConfig */
51
+    private $config;
52
+
53
+    /**
54
+     * Plugin constructor.
55
+     *
56
+     * @param Auth $authBackEnd
57
+     * @param IRequest $request
58
+     * @param IConfig $config
59
+     */
60
+    public function __construct(Auth $authBackEnd, IRequest $request, IConfig $config) {
61
+        $this->auth = $authBackEnd;
62
+        $this->request = $request;
63
+        $this->config = $config;
64
+    }
65
+
66
+    /**
67
+     * Reference to SabreDAV server object.
68
+     *
69
+     * @var \Sabre\DAV\Server
70
+     */
71
+    protected $server;
72
+
73
+    /**
74
+     * This method should return a list of server-features.
75
+     *
76
+     * This is for example 'versioning' and is added to the DAV: header
77
+     * in an OPTIONS response.
78
+     *
79
+     * @return string[]
80
+     */
81
+    public function getFeatures() {
82
+        return ['oc-resource-sharing'];
83
+    }
84
+
85
+    /**
86
+     * Returns a plugin name.
87
+     *
88
+     * Using this name other plugins will be able to access other plugins
89
+     * using Sabre\DAV\Server::getPlugin
90
+     *
91
+     * @return string
92
+     */
93
+    public function getPluginName() {
94
+        return 'oc-resource-sharing';
95
+    }
96
+
97
+    /**
98
+     * This initializes the plugin.
99
+     *
100
+     * This function is called by Sabre\DAV\Server, after
101
+     * addPlugin is called.
102
+     *
103
+     * This method should set up the required event subscriptions.
104
+     *
105
+     * @param Server $server
106
+     * @return void
107
+     */
108
+    public function initialize(Server $server) {
109
+        $this->server = $server;
110
+        $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
111
+        $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
112
+
113
+        $this->server->on('method:POST', [$this, 'httpPost']);
114
+        $this->server->on('propFind',    [$this, 'propFind']);
115
+    }
116
+
117
+    /**
118
+     * We intercept this to handle POST requests on a dav resource.
119
+     *
120
+     * @param RequestInterface $request
121
+     * @param ResponseInterface $response
122
+     * @return null|false
123
+     */
124
+    public function httpPost(RequestInterface $request, ResponseInterface $response) {
125
+        $path = $request->getPath();
126
+
127
+        // Only handling xml
128
+        $contentType = $request->getHeader('Content-Type');
129
+        if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
130
+            return;
131
+        }
132
+
133
+        // Making sure the node exists
134
+        try {
135
+            $node = $this->server->tree->getNodeForPath($path);
136
+        } catch (NotFound $e) {
137
+            return;
138
+        }
139
+
140
+        $requestBody = $request->getBodyAsString();
141
+
142
+        // If this request handler could not deal with this POST request, it
143
+        // will return 'null' and other plugins get a chance to handle the
144
+        // request.
145
+        //
146
+        // However, we already requested the full body. This is a problem,
147
+        // because a body can only be read once. This is why we preemptively
148
+        // re-populated the request body with the existing data.
149
+        $request->setBody($requestBody);
150
+
151
+        $message = $this->server->xml->parse($requestBody, $request->getUrl(), $documentType);
152
+
153
+        switch ($documentType) {
154
+
155
+            // Dealing with the 'share' document, which modified invitees on a
156
+            // calendar.
157
+            case '{' . self::NS_OWNCLOUD . '}share':
158
+
159
+                // We can only deal with IShareableCalendar objects
160
+                if (!$node instanceof IShareable) {
161
+                    return;
162
+                }
163
+
164
+                $this->server->transactionType = 'post-oc-resource-share';
165
+
166
+                // Getting ACL info
167
+                $acl = $this->server->getPlugin('acl');
168
+
169
+                // If there's no ACL support, we allow everything
170
+                if ($acl) {
171
+                    /** @var \Sabre\DAVACL\Plugin $acl */
172
+                    $acl->checkPrivileges($path, '{DAV:}write');
173
+
174
+                    $limitSharingToOwner = $this->config->getAppValue('dav', 'limitAddressBookAndCalendarSharingToOwner', 'no') === 'yes';
175
+                    $isOwner = $acl->getCurrentUserPrincipal() === $node->getOwner();
176
+                    if ($limitSharingToOwner && !$isOwner) {
177
+                        return;
178
+                    }
179
+                }
180
+
181
+                $node->updateShares($message->set, $message->remove);
182
+
183
+                $response->setStatus(200);
184
+                // Adding this because sending a response body may cause issues,
185
+                // and I wanted some type of indicator the response was handled.
186
+                $response->setHeader('X-Sabre-Status', 'everything-went-well');
187
+
188
+                // Breaking the event chain
189
+                return false;
190
+        }
191
+    }
192
+
193
+    /**
194
+     * This event is triggered when properties are requested for a certain
195
+     * node.
196
+     *
197
+     * This allows us to inject any properties early.
198
+     *
199
+     * @param PropFind $propFind
200
+     * @param INode $node
201
+     * @return void
202
+     */
203
+    public function propFind(PropFind $propFind, INode $node) {
204
+        if ($node instanceof IShareable) {
205
+            $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
206
+                return new Invite(
207
+                    $node->getShares()
208
+                );
209
+            });
210
+        }
211
+    }
212 212
 }
Please login to merge, or discard this patch.
apps/dav/lib/Connector/Sabre/ShareeList.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function xmlSerialize(Writer $writer) {
54 54
 		foreach ($this->shares as $share) {
55
-			$writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee');
56
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith());
57
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName());
58
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType());
55
+			$writer->startElement('{'.self::NS_NEXTCLOUD.'}sharee');
56
+			$writer->writeElement('{'.self::NS_NEXTCLOUD.'}id', $share->getSharedWith());
57
+			$writer->writeElement('{'.self::NS_NEXTCLOUD.'}display-name', $share->getSharedWithDisplayName());
58
+			$writer->writeElement('{'.self::NS_NEXTCLOUD.'}type', $share->getShareType());
59 59
 			$writer->endElement();
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -35,28 +35,28 @@
 block discarded – undo
35 35
  * This property contains multiple "sharee" elements, each containing a share sharee
36 36
  */
37 37
 class ShareeList implements XmlSerializable {
38
-	public const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
38
+    public const NS_NEXTCLOUD = 'http://nextcloud.org/ns';
39 39
 
40
-	/** @var IShare[] */
41
-	private $shares;
40
+    /** @var IShare[] */
41
+    private $shares;
42 42
 
43
-	public function __construct(array $shares) {
44
-		$this->shares = $shares;
45
-	}
43
+    public function __construct(array $shares) {
44
+        $this->shares = $shares;
45
+    }
46 46
 
47
-	/**
48
-	 * The xmlSerialize method is called during xml writing.
49
-	 *
50
-	 * @param Writer $writer
51
-	 * @return void
52
-	 */
53
-	public function xmlSerialize(Writer $writer) {
54
-		foreach ($this->shares as $share) {
55
-			$writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee');
56
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith());
57
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName());
58
-			$writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType());
59
-			$writer->endElement();
60
-		}
61
-	}
47
+    /**
48
+     * The xmlSerialize method is called during xml writing.
49
+     *
50
+     * @param Writer $writer
51
+     * @return void
52
+     */
53
+    public function xmlSerialize(Writer $writer) {
54
+        foreach ($this->shares as $share) {
55
+            $writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee');
56
+            $writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith());
57
+            $writer->writeElement('{' . self::NS_NEXTCLOUD . '}display-name', $share->getSharedWithDisplayName());
58
+            $writer->writeElement('{' . self::NS_NEXTCLOUD . '}type', $share->getShareType());
59
+            $writer->endElement();
60
+        }
61
+    }
62 62
 }
Please login to merge, or discard this patch.