@@ -28,56 +28,56 @@ |
||
28 | 28 | * @since 9.0.0 |
29 | 29 | */ |
30 | 30 | interface IWatcher { |
31 | - public const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | - public const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | - public const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
31 | + public const CHECK_NEVER = 0; // never check the underlying filesystem for updates |
|
32 | + public const CHECK_ONCE = 1; // check the underlying filesystem for updates once every request for each file |
|
33 | + public const CHECK_ALWAYS = 2; // always check the underlying filesystem for updates |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | - * @since 9.0.0 |
|
38 | - */ |
|
39 | - public function setPolicy($policy); |
|
35 | + /** |
|
36 | + * @param int $policy either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
37 | + * @since 9.0.0 |
|
38 | + */ |
|
39 | + public function setPolicy($policy); |
|
40 | 40 | |
41 | - /** |
|
42 | - * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | - * @since 9.0.0 |
|
44 | - */ |
|
45 | - public function getPolicy(); |
|
41 | + /** |
|
42 | + * @return int either IWatcher::CHECK_NEVER, IWatcher::CHECK_ONCE, IWatcher::CHECK_ALWAYS |
|
43 | + * @since 9.0.0 |
|
44 | + */ |
|
45 | + public function getPolicy(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * check $path for updates and update if needed |
|
49 | - * |
|
50 | - * @param string $path |
|
51 | - * @param ICacheEntry|null $cachedEntry |
|
52 | - * @return boolean true if path was updated |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function checkUpdate($path, $cachedEntry = null); |
|
47 | + /** |
|
48 | + * check $path for updates and update if needed |
|
49 | + * |
|
50 | + * @param string $path |
|
51 | + * @param ICacheEntry|null $cachedEntry |
|
52 | + * @return boolean true if path was updated |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function checkUpdate($path, $cachedEntry = null); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Update the cache for changes to $path |
|
59 | - * |
|
60 | - * @param string $path |
|
61 | - * @param ICacheEntry $cachedData |
|
62 | - * @since 9.0.0 |
|
63 | - */ |
|
64 | - public function update($path, $cachedData); |
|
57 | + /** |
|
58 | + * Update the cache for changes to $path |
|
59 | + * |
|
60 | + * @param string $path |
|
61 | + * @param ICacheEntry $cachedData |
|
62 | + * @since 9.0.0 |
|
63 | + */ |
|
64 | + public function update($path, $cachedData); |
|
65 | 65 | |
66 | - /** |
|
67 | - * Check if the cache for $path needs to be updated |
|
68 | - * |
|
69 | - * @param string $path |
|
70 | - * @param ICacheEntry $cachedData |
|
71 | - * @return bool |
|
72 | - * @since 9.0.0 |
|
73 | - */ |
|
74 | - public function needsUpdate($path, $cachedData); |
|
66 | + /** |
|
67 | + * Check if the cache for $path needs to be updated |
|
68 | + * |
|
69 | + * @param string $path |
|
70 | + * @param ICacheEntry $cachedData |
|
71 | + * @return bool |
|
72 | + * @since 9.0.0 |
|
73 | + */ |
|
74 | + public function needsUpdate($path, $cachedData); |
|
75 | 75 | |
76 | - /** |
|
77 | - * remove deleted files in $path from the cache |
|
78 | - * |
|
79 | - * @param string $path |
|
80 | - * @since 9.0.0 |
|
81 | - */ |
|
82 | - public function cleanFolder($path); |
|
76 | + /** |
|
77 | + * remove deleted files in $path from the cache |
|
78 | + * |
|
79 | + * @param string $path |
|
80 | + * @since 9.0.0 |
|
81 | + */ |
|
82 | + public function cleanFolder($path); |
|
83 | 83 | } |
@@ -29,28 +29,28 @@ |
||
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 | } |
@@ -44,50 +44,50 @@ |
||
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 | } |
@@ -27,27 +27,27 @@ |
||
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 | } |
@@ -34,63 +34,63 @@ |
||
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 | } |
@@ -26,114 +26,114 @@ |
||
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 | } |
@@ -30,106 +30,106 @@ |
||
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 | } |
@@ -26,24 +26,24 @@ |
||
26 | 26 | namespace OC\DB; |
27 | 27 | |
28 | 28 | class AdapterOCI8 extends Adapter { |
29 | - public function lastInsertId($table) { |
|
30 | - if (is_null($table)) { |
|
31 | - throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); |
|
32 | - } |
|
33 | - if ($table !== null) { |
|
34 | - $suffix = '_SEQ'; |
|
35 | - $table = '"' . $table . $suffix . '"'; |
|
36 | - } |
|
37 | - return $this->conn->realLastInsertId($table); |
|
38 | - } |
|
29 | + public function lastInsertId($table) { |
|
30 | + if (is_null($table)) { |
|
31 | + throw new \InvalidArgumentException('Oracle requires a table name to be passed into lastInsertId()'); |
|
32 | + } |
|
33 | + if ($table !== null) { |
|
34 | + $suffix = '_SEQ'; |
|
35 | + $table = '"' . $table . $suffix . '"'; |
|
36 | + } |
|
37 | + return $this->conn->realLastInsertId($table); |
|
38 | + } |
|
39 | 39 | |
40 | - public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"; |
|
40 | + public const UNIX_TIMESTAMP_REPLACEMENT = "(cast(sys_extract_utc(systimestamp) as date) - date'1970-01-01') * 86400"; |
|
41 | 41 | |
42 | - public function fixupStatement($statement) { |
|
43 | - $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); |
|
44 | - $statement = str_replace('`', '"', $statement); |
|
45 | - $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement); |
|
46 | - $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); |
|
47 | - return $statement; |
|
48 | - } |
|
42 | + public function fixupStatement($statement) { |
|
43 | + $statement = preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); |
|
44 | + $statement = str_replace('`', '"', $statement); |
|
45 | + $statement = str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement); |
|
46 | + $statement = str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); |
|
47 | + return $statement; |
|
48 | + } |
|
49 | 49 | } |
@@ -29,107 +29,107 @@ |
||
29 | 29 | * Abstract base class for user management |
30 | 30 | */ |
31 | 31 | abstract class Backend implements \OCP\GroupInterface { |
32 | - /** |
|
33 | - * error code for functions not provided by the group backend |
|
34 | - */ |
|
35 | - public const NOT_IMPLEMENTED = -501; |
|
32 | + /** |
|
33 | + * error code for functions not provided by the group backend |
|
34 | + */ |
|
35 | + public const NOT_IMPLEMENTED = -501; |
|
36 | 36 | |
37 | - protected $possibleActions = [ |
|
38 | - self::CREATE_GROUP => 'createGroup', |
|
39 | - self::DELETE_GROUP => 'deleteGroup', |
|
40 | - self::ADD_TO_GROUP => 'addToGroup', |
|
41 | - self::REMOVE_FROM_GOUP => 'removeFromGroup', |
|
42 | - self::COUNT_USERS => 'countUsersInGroup', |
|
43 | - self::GROUP_DETAILS => 'getGroupDetails', |
|
44 | - self::IS_ADMIN => 'isAdmin', |
|
45 | - ]; |
|
37 | + protected $possibleActions = [ |
|
38 | + self::CREATE_GROUP => 'createGroup', |
|
39 | + self::DELETE_GROUP => 'deleteGroup', |
|
40 | + self::ADD_TO_GROUP => 'addToGroup', |
|
41 | + self::REMOVE_FROM_GOUP => 'removeFromGroup', |
|
42 | + self::COUNT_USERS => 'countUsersInGroup', |
|
43 | + self::GROUP_DETAILS => 'getGroupDetails', |
|
44 | + self::IS_ADMIN => 'isAdmin', |
|
45 | + ]; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get all supported actions |
|
49 | - * @return int bitwise-or'ed actions |
|
50 | - * |
|
51 | - * Returns the supported actions as int to be |
|
52 | - * compared with \OC\Group\Backend::CREATE_GROUP etc. |
|
53 | - */ |
|
54 | - public function getSupportedActions() { |
|
55 | - $actions = 0; |
|
56 | - foreach ($this->possibleActions as $action => $methodName) { |
|
57 | - if (method_exists($this, $methodName)) { |
|
58 | - $actions |= $action; |
|
59 | - } |
|
60 | - } |
|
47 | + /** |
|
48 | + * Get all supported actions |
|
49 | + * @return int bitwise-or'ed actions |
|
50 | + * |
|
51 | + * Returns the supported actions as int to be |
|
52 | + * compared with \OC\Group\Backend::CREATE_GROUP etc. |
|
53 | + */ |
|
54 | + public function getSupportedActions() { |
|
55 | + $actions = 0; |
|
56 | + foreach ($this->possibleActions as $action => $methodName) { |
|
57 | + if (method_exists($this, $methodName)) { |
|
58 | + $actions |= $action; |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - return $actions; |
|
63 | - } |
|
62 | + return $actions; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * Check if backend implements actions |
|
67 | - * @param int $actions bitwise-or'ed actions |
|
68 | - * @return bool |
|
69 | - * |
|
70 | - * Returns the supported actions as int to be |
|
71 | - * compared with \OC\Group\Backend::CREATE_GROUP etc. |
|
72 | - */ |
|
73 | - public function implementsActions($actions) { |
|
74 | - return (bool)($this->getSupportedActions() & $actions); |
|
75 | - } |
|
65 | + /** |
|
66 | + * Check if backend implements actions |
|
67 | + * @param int $actions bitwise-or'ed actions |
|
68 | + * @return bool |
|
69 | + * |
|
70 | + * Returns the supported actions as int to be |
|
71 | + * compared with \OC\Group\Backend::CREATE_GROUP etc. |
|
72 | + */ |
|
73 | + public function implementsActions($actions) { |
|
74 | + return (bool)($this->getSupportedActions() & $actions); |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * is user in group? |
|
79 | - * @param string $uid uid of the user |
|
80 | - * @param string $gid gid of the group |
|
81 | - * @return bool |
|
82 | - * |
|
83 | - * Checks whether the user is member of a group or not. |
|
84 | - */ |
|
85 | - public function inGroup($uid, $gid) { |
|
86 | - return in_array($gid, $this->getUserGroups($uid)); |
|
87 | - } |
|
77 | + /** |
|
78 | + * is user in group? |
|
79 | + * @param string $uid uid of the user |
|
80 | + * @param string $gid gid of the group |
|
81 | + * @return bool |
|
82 | + * |
|
83 | + * Checks whether the user is member of a group or not. |
|
84 | + */ |
|
85 | + public function inGroup($uid, $gid) { |
|
86 | + return in_array($gid, $this->getUserGroups($uid)); |
|
87 | + } |
|
88 | 88 | |
89 | - /** |
|
90 | - * Get all groups a user belongs to |
|
91 | - * @param string $uid Name of the user |
|
92 | - * @return array an array of group names |
|
93 | - * |
|
94 | - * This function fetches all groups a user belongs to. It does not check |
|
95 | - * if the user exists at all. |
|
96 | - */ |
|
97 | - public function getUserGroups($uid) { |
|
98 | - return []; |
|
99 | - } |
|
89 | + /** |
|
90 | + * Get all groups a user belongs to |
|
91 | + * @param string $uid Name of the user |
|
92 | + * @return array an array of group names |
|
93 | + * |
|
94 | + * This function fetches all groups a user belongs to. It does not check |
|
95 | + * if the user exists at all. |
|
96 | + */ |
|
97 | + public function getUserGroups($uid) { |
|
98 | + return []; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * get a list of all groups |
|
103 | - * @param string $search |
|
104 | - * @param int $limit |
|
105 | - * @param int $offset |
|
106 | - * @return array an array of group names |
|
107 | - * |
|
108 | - * Returns a list with all groups |
|
109 | - */ |
|
101 | + /** |
|
102 | + * get a list of all groups |
|
103 | + * @param string $search |
|
104 | + * @param int $limit |
|
105 | + * @param int $offset |
|
106 | + * @return array an array of group names |
|
107 | + * |
|
108 | + * Returns a list with all groups |
|
109 | + */ |
|
110 | 110 | |
111 | - public function getGroups($search = '', $limit = -1, $offset = 0) { |
|
112 | - return []; |
|
113 | - } |
|
111 | + public function getGroups($search = '', $limit = -1, $offset = 0) { |
|
112 | + return []; |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * check if a group exists |
|
117 | - * @param string $gid |
|
118 | - * @return bool |
|
119 | - */ |
|
120 | - public function groupExists($gid) { |
|
121 | - return in_array($gid, $this->getGroups($gid, 1)); |
|
122 | - } |
|
115 | + /** |
|
116 | + * check if a group exists |
|
117 | + * @param string $gid |
|
118 | + * @return bool |
|
119 | + */ |
|
120 | + public function groupExists($gid) { |
|
121 | + return in_array($gid, $this->getGroups($gid, 1)); |
|
122 | + } |
|
123 | 123 | |
124 | - /** |
|
125 | - * get a list of all users in a group |
|
126 | - * @param string $gid |
|
127 | - * @param string $search |
|
128 | - * @param int $limit |
|
129 | - * @param int $offset |
|
130 | - * @return array an array of user ids |
|
131 | - */ |
|
132 | - public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
|
133 | - return []; |
|
134 | - } |
|
124 | + /** |
|
125 | + * get a list of all users in a group |
|
126 | + * @param string $gid |
|
127 | + * @param string $search |
|
128 | + * @param int $limit |
|
129 | + * @param int $offset |
|
130 | + * @return array an array of user ids |
|
131 | + */ |
|
132 | + public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { |
|
133 | + return []; |
|
134 | + } |
|
135 | 135 | } |