@@ -25,17 +25,17 @@ |
||
| 25 | 25 | |
| 26 | 26 | class ProviderAlreadyExistsException extends HintException { |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * ProviderAlreadyExistsException constructor. |
|
| 30 | - * |
|
| 31 | - * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | - * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | - */ |
|
| 34 | - public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | - $l = \OC::$server->getL10N('federation'); |
|
| 36 | - $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | - $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | - parent::__construct($message, $hint); |
|
| 39 | - } |
|
| 28 | + /** |
|
| 29 | + * ProviderAlreadyExistsException constructor. |
|
| 30 | + * |
|
| 31 | + * @param string $newProviderId cloud federation provider ID of the new provider |
|
| 32 | + * @param string $existingProviderName name of cloud federation provider which already use the same ID |
|
| 33 | + */ |
|
| 34 | + public function __construct($newProviderId, $existingProviderName) { |
|
| 35 | + $l = \OC::$server->getL10N('federation'); |
|
| 36 | + $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"'; |
|
| 37 | + $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]); |
|
| 38 | + parent::__construct($message, $hint); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | 41 | } |
@@ -23,22 +23,22 @@ |
||
| 23 | 23 | |
| 24 | 24 | interface ICloudFederationNotification { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * add a message to the notification |
|
| 28 | - * |
|
| 29 | - * @param string $identifier |
|
| 30 | - * @param string $message |
|
| 31 | - * |
|
| 32 | - * @since 14.0.0 |
|
| 33 | - */ |
|
| 34 | - public function setMessage($identifier, $message); |
|
| 26 | + /** |
|
| 27 | + * add a message to the notification |
|
| 28 | + * |
|
| 29 | + * @param string $identifier |
|
| 30 | + * @param string $message |
|
| 31 | + * |
|
| 32 | + * @since 14.0.0 |
|
| 33 | + */ |
|
| 34 | + public function setMessage($identifier, $message); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * get JSON encoded Message, ready to send out |
|
| 38 | - * |
|
| 39 | - * @return string |
|
| 40 | - * |
|
| 41 | - * @since 14.0.0 |
|
| 42 | - */ |
|
| 43 | - public function getMessage(); |
|
| 36 | + /** |
|
| 37 | + * get JSON encoded Message, ready to send out |
|
| 38 | + * |
|
| 39 | + * @return string |
|
| 40 | + * |
|
| 41 | + * @since 14.0.0 |
|
| 42 | + */ |
|
| 43 | + public function getMessage(); |
|
| 44 | 44 | } |
@@ -23,33 +23,33 @@ |
||
| 23 | 23 | |
| 24 | 24 | interface ICloudFederationFactory { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * get a CloudFederationShare Object to prepare a share you want to send |
|
| 28 | - * |
|
| 29 | - * @param string $shareWith |
|
| 30 | - * @param string $name resource name (e.g. document.odt) |
|
| 31 | - * @param string $description share description (optional) |
|
| 32 | - * @param string $providerId resource UID on the provider side |
|
| 33 | - * @param string $owner provider specific UID of the user who owns the resource |
|
| 34 | - * @param string $ownerDisplayName display name of the user who shared the item |
|
| 35 | - * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 36 | - * @param $sharedByDisplayName display name of the user who shared the resource |
|
| 37 | - * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 38 | - * @param string $shareType ('group' or 'user' share) |
|
| 39 | - * @param $resourceType ('file', 'calendar',...) |
|
| 40 | - * @return ICloudFederationShare |
|
| 41 | - * |
|
| 42 | - * @since 14.0.0 |
|
| 43 | - */ |
|
| 44 | - public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType); |
|
| 26 | + /** |
|
| 27 | + * get a CloudFederationShare Object to prepare a share you want to send |
|
| 28 | + * |
|
| 29 | + * @param string $shareWith |
|
| 30 | + * @param string $name resource name (e.g. document.odt) |
|
| 31 | + * @param string $description share description (optional) |
|
| 32 | + * @param string $providerId resource UID on the provider side |
|
| 33 | + * @param string $owner provider specific UID of the user who owns the resource |
|
| 34 | + * @param string $ownerDisplayName display name of the user who shared the item |
|
| 35 | + * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 36 | + * @param $sharedByDisplayName display name of the user who shared the resource |
|
| 37 | + * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 38 | + * @param string $shareType ('group' or 'user' share) |
|
| 39 | + * @param $resourceType ('file', 'calendar',...) |
|
| 40 | + * @return ICloudFederationShare |
|
| 41 | + * |
|
| 42 | + * @since 14.0.0 |
|
| 43 | + */ |
|
| 44 | + public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType); |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * get a Cloud FederationNotification object to prepare a notification you |
|
| 48 | - * want to send |
|
| 49 | - * |
|
| 50 | - * @return ICloudFederationNotification |
|
| 51 | - * |
|
| 52 | - * @since 14.0.0 |
|
| 53 | - */ |
|
| 54 | - public function getCloudFederationNotification(); |
|
| 46 | + /** |
|
| 47 | + * get a Cloud FederationNotification object to prepare a notification you |
|
| 48 | + * want to send |
|
| 49 | + * |
|
| 50 | + * @return ICloudFederationNotification |
|
| 51 | + * |
|
| 52 | + * @since 14.0.0 |
|
| 53 | + */ |
|
| 54 | + public function getCloudFederationNotification(); |
|
| 55 | 55 | } |
@@ -23,211 +23,211 @@ |
||
| 23 | 23 | |
| 24 | 24 | interface ICloudFederationShare { |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * set uid of the recipient |
|
| 28 | - * |
|
| 29 | - * @param string $user |
|
| 30 | - * |
|
| 31 | - * @since 14.0.0 |
|
| 32 | - */ |
|
| 33 | - public function setShareWith($user); |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * set resource name (e.g. file, calendar, contact,...) |
|
| 37 | - * |
|
| 38 | - * @param string $name |
|
| 39 | - * |
|
| 40 | - * @since 14.0.0 |
|
| 41 | - */ |
|
| 42 | - public function setResourceName($name); |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * set resource type (e.g. file, calendar, contact,...) |
|
| 46 | - * |
|
| 47 | - * @param string $resourceType |
|
| 48 | - * |
|
| 49 | - * @since 14.0.0 |
|
| 50 | - */ |
|
| 51 | - public function setResourceType($resourceType); |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * set resource description (optional) |
|
| 55 | - * |
|
| 56 | - * @param string $description |
|
| 57 | - * |
|
| 58 | - * @since 14.0.0 |
|
| 59 | - */ |
|
| 60 | - public function setDescription($description); |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * set provider ID (e.g. file ID) |
|
| 64 | - * |
|
| 65 | - * @param string $providerId |
|
| 66 | - * |
|
| 67 | - * @since 14.0.0 |
|
| 68 | - */ |
|
| 69 | - public function setProviderId($providerId); |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * set owner UID |
|
| 73 | - * |
|
| 74 | - * @param string $owner |
|
| 75 | - * |
|
| 76 | - * @since 14.0.0 |
|
| 77 | - */ |
|
| 78 | - public function setOwner($owner); |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * set owner display name |
|
| 82 | - * |
|
| 83 | - * @param string $ownerDisplayName |
|
| 84 | - * |
|
| 85 | - * @since 14.0.0 |
|
| 86 | - */ |
|
| 87 | - public function setOwnerDisplayName($ownerDisplayName); |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * set UID of the user who sends the share |
|
| 91 | - * |
|
| 92 | - * @param string $sharedBy |
|
| 93 | - * |
|
| 94 | - * @since 14.0.0 |
|
| 95 | - */ |
|
| 96 | - public function setSharedBy($sharedBy); |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * set display name of the user who sends the share |
|
| 100 | - * |
|
| 101 | - * @param $sharedByDisplayName |
|
| 102 | - * |
|
| 103 | - * @since 14.0.0 |
|
| 104 | - */ |
|
| 105 | - public function setSharedByDisplayName($sharedByDisplayName); |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * set protocol specification |
|
| 109 | - * |
|
| 110 | - * @param array $protocol |
|
| 111 | - * |
|
| 112 | - * @since 14.0.0 |
|
| 113 | - */ |
|
| 114 | - public function setProtocol(array $protocol); |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * share type (group or user) |
|
| 118 | - * |
|
| 119 | - * @param string $shareType |
|
| 120 | - * |
|
| 121 | - * @since 14.0.0 |
|
| 122 | - */ |
|
| 123 | - public function setShareType($shareType); |
|
| 124 | - |
|
| 125 | - /** |
|
| 126 | - * get JSON encoded share, ready to send out |
|
| 127 | - * |
|
| 128 | - * @return string |
|
| 129 | - * |
|
| 130 | - * @since 14.0.0 |
|
| 131 | - */ |
|
| 132 | - public function getShare(); |
|
| 133 | - |
|
| 134 | - /** |
|
| 135 | - * get uid of the recipient |
|
| 136 | - * |
|
| 137 | - * @return string |
|
| 138 | - * |
|
| 139 | - * @since 14.0.0 |
|
| 140 | - */ |
|
| 141 | - public function getShareWith(); |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * get resource name (e.g. file, calendar, contact,...) |
|
| 145 | - * |
|
| 146 | - * @return string |
|
| 147 | - * |
|
| 148 | - * @since 14.0.0 |
|
| 149 | - */ |
|
| 150 | - public function getResourceName(); |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * get resource type (e.g. file, calendar, contact,...) |
|
| 154 | - * |
|
| 155 | - * @return string |
|
| 156 | - * |
|
| 157 | - * @since 14.0.0 |
|
| 158 | - */ |
|
| 159 | - public function getResourceType(); |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * get resource description (optional) |
|
| 163 | - * |
|
| 164 | - * @return string |
|
| 165 | - * |
|
| 166 | - * @since 14.0.0 |
|
| 167 | - */ |
|
| 168 | - public function getDescription(); |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * get provider ID (e.g. file ID) |
|
| 172 | - * |
|
| 173 | - * @return string |
|
| 174 | - * |
|
| 175 | - * @since 14.0.0 |
|
| 176 | - */ |
|
| 177 | - public function getProviderId(); |
|
| 178 | - |
|
| 179 | - /** |
|
| 180 | - * get owner UID |
|
| 181 | - * |
|
| 182 | - * @return string |
|
| 183 | - * |
|
| 184 | - * @since 14.0.0 |
|
| 185 | - */ |
|
| 186 | - public function getOwner(); |
|
| 187 | - |
|
| 188 | - /** |
|
| 189 | - * get owner display name |
|
| 190 | - * |
|
| 191 | - * @return string |
|
| 192 | - * |
|
| 193 | - * @since 14.0.0 |
|
| 194 | - */ |
|
| 195 | - public function getOwnerDisplayName(); |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * get UID of the user who sends the share |
|
| 199 | - * |
|
| 200 | - * @return string |
|
| 201 | - * |
|
| 202 | - * @since 14.0.0 |
|
| 203 | - */ |
|
| 204 | - public function getSharedBy(); |
|
| 205 | - |
|
| 206 | - /** |
|
| 207 | - * get display name of the user who sends the share |
|
| 208 | - * |
|
| 209 | - * @return string |
|
| 210 | - * |
|
| 211 | - * @since 14.0.0 |
|
| 212 | - */ |
|
| 213 | - public function getSharedByDisplayName(); |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * get share type (group or user) |
|
| 217 | - * |
|
| 218 | - * @return string |
|
| 219 | - * |
|
| 220 | - * @since 14.0.0 |
|
| 221 | - */ |
|
| 222 | - public function getShareType(); |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * get protocol specification |
|
| 226 | - * |
|
| 227 | - * @return array |
|
| 228 | - * |
|
| 229 | - * @since 14.0.0 |
|
| 230 | - */ |
|
| 231 | - public function getProtocol(); |
|
| 26 | + /** |
|
| 27 | + * set uid of the recipient |
|
| 28 | + * |
|
| 29 | + * @param string $user |
|
| 30 | + * |
|
| 31 | + * @since 14.0.0 |
|
| 32 | + */ |
|
| 33 | + public function setShareWith($user); |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * set resource name (e.g. file, calendar, contact,...) |
|
| 37 | + * |
|
| 38 | + * @param string $name |
|
| 39 | + * |
|
| 40 | + * @since 14.0.0 |
|
| 41 | + */ |
|
| 42 | + public function setResourceName($name); |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * set resource type (e.g. file, calendar, contact,...) |
|
| 46 | + * |
|
| 47 | + * @param string $resourceType |
|
| 48 | + * |
|
| 49 | + * @since 14.0.0 |
|
| 50 | + */ |
|
| 51 | + public function setResourceType($resourceType); |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * set resource description (optional) |
|
| 55 | + * |
|
| 56 | + * @param string $description |
|
| 57 | + * |
|
| 58 | + * @since 14.0.0 |
|
| 59 | + */ |
|
| 60 | + public function setDescription($description); |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * set provider ID (e.g. file ID) |
|
| 64 | + * |
|
| 65 | + * @param string $providerId |
|
| 66 | + * |
|
| 67 | + * @since 14.0.0 |
|
| 68 | + */ |
|
| 69 | + public function setProviderId($providerId); |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * set owner UID |
|
| 73 | + * |
|
| 74 | + * @param string $owner |
|
| 75 | + * |
|
| 76 | + * @since 14.0.0 |
|
| 77 | + */ |
|
| 78 | + public function setOwner($owner); |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * set owner display name |
|
| 82 | + * |
|
| 83 | + * @param string $ownerDisplayName |
|
| 84 | + * |
|
| 85 | + * @since 14.0.0 |
|
| 86 | + */ |
|
| 87 | + public function setOwnerDisplayName($ownerDisplayName); |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * set UID of the user who sends the share |
|
| 91 | + * |
|
| 92 | + * @param string $sharedBy |
|
| 93 | + * |
|
| 94 | + * @since 14.0.0 |
|
| 95 | + */ |
|
| 96 | + public function setSharedBy($sharedBy); |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * set display name of the user who sends the share |
|
| 100 | + * |
|
| 101 | + * @param $sharedByDisplayName |
|
| 102 | + * |
|
| 103 | + * @since 14.0.0 |
|
| 104 | + */ |
|
| 105 | + public function setSharedByDisplayName($sharedByDisplayName); |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * set protocol specification |
|
| 109 | + * |
|
| 110 | + * @param array $protocol |
|
| 111 | + * |
|
| 112 | + * @since 14.0.0 |
|
| 113 | + */ |
|
| 114 | + public function setProtocol(array $protocol); |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * share type (group or user) |
|
| 118 | + * |
|
| 119 | + * @param string $shareType |
|
| 120 | + * |
|
| 121 | + * @since 14.0.0 |
|
| 122 | + */ |
|
| 123 | + public function setShareType($shareType); |
|
| 124 | + |
|
| 125 | + /** |
|
| 126 | + * get JSON encoded share, ready to send out |
|
| 127 | + * |
|
| 128 | + * @return string |
|
| 129 | + * |
|
| 130 | + * @since 14.0.0 |
|
| 131 | + */ |
|
| 132 | + public function getShare(); |
|
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * get uid of the recipient |
|
| 136 | + * |
|
| 137 | + * @return string |
|
| 138 | + * |
|
| 139 | + * @since 14.0.0 |
|
| 140 | + */ |
|
| 141 | + public function getShareWith(); |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * get resource name (e.g. file, calendar, contact,...) |
|
| 145 | + * |
|
| 146 | + * @return string |
|
| 147 | + * |
|
| 148 | + * @since 14.0.0 |
|
| 149 | + */ |
|
| 150 | + public function getResourceName(); |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * get resource type (e.g. file, calendar, contact,...) |
|
| 154 | + * |
|
| 155 | + * @return string |
|
| 156 | + * |
|
| 157 | + * @since 14.0.0 |
|
| 158 | + */ |
|
| 159 | + public function getResourceType(); |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * get resource description (optional) |
|
| 163 | + * |
|
| 164 | + * @return string |
|
| 165 | + * |
|
| 166 | + * @since 14.0.0 |
|
| 167 | + */ |
|
| 168 | + public function getDescription(); |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * get provider ID (e.g. file ID) |
|
| 172 | + * |
|
| 173 | + * @return string |
|
| 174 | + * |
|
| 175 | + * @since 14.0.0 |
|
| 176 | + */ |
|
| 177 | + public function getProviderId(); |
|
| 178 | + |
|
| 179 | + /** |
|
| 180 | + * get owner UID |
|
| 181 | + * |
|
| 182 | + * @return string |
|
| 183 | + * |
|
| 184 | + * @since 14.0.0 |
|
| 185 | + */ |
|
| 186 | + public function getOwner(); |
|
| 187 | + |
|
| 188 | + /** |
|
| 189 | + * get owner display name |
|
| 190 | + * |
|
| 191 | + * @return string |
|
| 192 | + * |
|
| 193 | + * @since 14.0.0 |
|
| 194 | + */ |
|
| 195 | + public function getOwnerDisplayName(); |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * get UID of the user who sends the share |
|
| 199 | + * |
|
| 200 | + * @return string |
|
| 201 | + * |
|
| 202 | + * @since 14.0.0 |
|
| 203 | + */ |
|
| 204 | + public function getSharedBy(); |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | + * get display name of the user who sends the share |
|
| 208 | + * |
|
| 209 | + * @return string |
|
| 210 | + * |
|
| 211 | + * @since 14.0.0 |
|
| 212 | + */ |
|
| 213 | + public function getSharedByDisplayName(); |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * get share type (group or user) |
|
| 217 | + * |
|
| 218 | + * @return string |
|
| 219 | + * |
|
| 220 | + * @since 14.0.0 |
|
| 221 | + */ |
|
| 222 | + public function getShareType(); |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * get protocol specification |
|
| 226 | + * |
|
| 227 | + * @return array |
|
| 228 | + * |
|
| 229 | + * @since 14.0.0 |
|
| 230 | + */ |
|
| 231 | + public function getProtocol(); |
|
| 232 | 232 | |
| 233 | 233 | } |
@@ -48,233 +48,233 @@ |
||
| 48 | 48 | */ |
| 49 | 49 | class ProviderFactory implements IProviderFactory { |
| 50 | 50 | |
| 51 | - /** @var IServerContainer */ |
|
| 52 | - private $serverContainer; |
|
| 53 | - /** @var DefaultShareProvider */ |
|
| 54 | - private $defaultProvider = null; |
|
| 55 | - /** @var FederatedShareProvider */ |
|
| 56 | - private $federatedProvider = null; |
|
| 57 | - /** @var ShareByMailProvider */ |
|
| 58 | - private $shareByMailProvider; |
|
| 59 | - /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | - private $shareByCircleProvider = null; |
|
| 61 | - /** @var bool */ |
|
| 62 | - private $circlesAreNotAvailable = false; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * IProviderFactory constructor. |
|
| 66 | - * |
|
| 67 | - * @param IServerContainer $serverContainer |
|
| 68 | - */ |
|
| 69 | - public function __construct(IServerContainer $serverContainer) { |
|
| 70 | - $this->serverContainer = $serverContainer; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * Create the default share provider. |
|
| 75 | - * |
|
| 76 | - * @return DefaultShareProvider |
|
| 77 | - */ |
|
| 78 | - protected function defaultShareProvider() { |
|
| 79 | - if ($this->defaultProvider === null) { |
|
| 80 | - $this->defaultProvider = new DefaultShareProvider( |
|
| 81 | - $this->serverContainer->getDatabaseConnection(), |
|
| 82 | - $this->serverContainer->getUserManager(), |
|
| 83 | - $this->serverContainer->getGroupManager(), |
|
| 84 | - $this->serverContainer->getLazyRootFolder() |
|
| 85 | - ); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - return $this->defaultProvider; |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - /** |
|
| 92 | - * Create the federated share provider |
|
| 93 | - * |
|
| 94 | - * @return FederatedShareProvider |
|
| 95 | - */ |
|
| 96 | - protected function federatedShareProvider() { |
|
| 97 | - if ($this->federatedProvider === null) { |
|
| 98 | - /* |
|
| 51 | + /** @var IServerContainer */ |
|
| 52 | + private $serverContainer; |
|
| 53 | + /** @var DefaultShareProvider */ |
|
| 54 | + private $defaultProvider = null; |
|
| 55 | + /** @var FederatedShareProvider */ |
|
| 56 | + private $federatedProvider = null; |
|
| 57 | + /** @var ShareByMailProvider */ |
|
| 58 | + private $shareByMailProvider; |
|
| 59 | + /** @var \OCA\Circles\ShareByCircleProvider */ |
|
| 60 | + private $shareByCircleProvider = null; |
|
| 61 | + /** @var bool */ |
|
| 62 | + private $circlesAreNotAvailable = false; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * IProviderFactory constructor. |
|
| 66 | + * |
|
| 67 | + * @param IServerContainer $serverContainer |
|
| 68 | + */ |
|
| 69 | + public function __construct(IServerContainer $serverContainer) { |
|
| 70 | + $this->serverContainer = $serverContainer; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * Create the default share provider. |
|
| 75 | + * |
|
| 76 | + * @return DefaultShareProvider |
|
| 77 | + */ |
|
| 78 | + protected function defaultShareProvider() { |
|
| 79 | + if ($this->defaultProvider === null) { |
|
| 80 | + $this->defaultProvider = new DefaultShareProvider( |
|
| 81 | + $this->serverContainer->getDatabaseConnection(), |
|
| 82 | + $this->serverContainer->getUserManager(), |
|
| 83 | + $this->serverContainer->getGroupManager(), |
|
| 84 | + $this->serverContainer->getLazyRootFolder() |
|
| 85 | + ); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + return $this->defaultProvider; |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + /** |
|
| 92 | + * Create the federated share provider |
|
| 93 | + * |
|
| 94 | + * @return FederatedShareProvider |
|
| 95 | + */ |
|
| 96 | + protected function federatedShareProvider() { |
|
| 97 | + if ($this->federatedProvider === null) { |
|
| 98 | + /* |
|
| 99 | 99 | * Check if the app is enabled |
| 100 | 100 | */ |
| 101 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 102 | - if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 103 | - return null; |
|
| 104 | - } |
|
| 101 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 102 | + if (!$appManager->isEnabledForUser('federatedfilesharing')) { |
|
| 103 | + return null; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /* |
|
| 106 | + /* |
|
| 107 | 107 | * TODO: add factory to federated sharing app |
| 108 | 108 | */ |
| 109 | - $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 110 | - $addressHandler = new AddressHandler( |
|
| 111 | - $this->serverContainer->getURLGenerator(), |
|
| 112 | - $l, |
|
| 113 | - $this->serverContainer->getCloudIdManager() |
|
| 114 | - ); |
|
| 115 | - $notifications = new Notifications( |
|
| 116 | - $addressHandler, |
|
| 117 | - $this->serverContainer->getHTTPClientService(), |
|
| 118 | - $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 119 | - $this->serverContainer->getJobList() |
|
| 120 | - ); |
|
| 121 | - $tokenHandler = new TokenHandler( |
|
| 122 | - $this->serverContainer->getSecureRandom() |
|
| 123 | - ); |
|
| 124 | - |
|
| 125 | - $this->federatedProvider = new FederatedShareProvider( |
|
| 126 | - $this->serverContainer->getDatabaseConnection(), |
|
| 127 | - $addressHandler, |
|
| 128 | - $notifications, |
|
| 129 | - $tokenHandler, |
|
| 130 | - $l, |
|
| 131 | - $this->serverContainer->getLogger(), |
|
| 132 | - $this->serverContainer->getLazyRootFolder(), |
|
| 133 | - $this->serverContainer->getConfig(), |
|
| 134 | - $this->serverContainer->getUserManager(), |
|
| 135 | - $this->serverContainer->getCloudIdManager(), |
|
| 136 | - $this->serverContainer->getGlobalScaleConfig() |
|
| 137 | - ); |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - return $this->federatedProvider; |
|
| 141 | - } |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Create the federated share provider |
|
| 145 | - * |
|
| 146 | - * @return ShareByMailProvider |
|
| 147 | - */ |
|
| 148 | - protected function getShareByMailProvider() { |
|
| 149 | - if ($this->shareByMailProvider === null) { |
|
| 150 | - /* |
|
| 109 | + $l = $this->serverContainer->getL10N('federatedfilessharing'); |
|
| 110 | + $addressHandler = new AddressHandler( |
|
| 111 | + $this->serverContainer->getURLGenerator(), |
|
| 112 | + $l, |
|
| 113 | + $this->serverContainer->getCloudIdManager() |
|
| 114 | + ); |
|
| 115 | + $notifications = new Notifications( |
|
| 116 | + $addressHandler, |
|
| 117 | + $this->serverContainer->getHTTPClientService(), |
|
| 118 | + $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class), |
|
| 119 | + $this->serverContainer->getJobList() |
|
| 120 | + ); |
|
| 121 | + $tokenHandler = new TokenHandler( |
|
| 122 | + $this->serverContainer->getSecureRandom() |
|
| 123 | + ); |
|
| 124 | + |
|
| 125 | + $this->federatedProvider = new FederatedShareProvider( |
|
| 126 | + $this->serverContainer->getDatabaseConnection(), |
|
| 127 | + $addressHandler, |
|
| 128 | + $notifications, |
|
| 129 | + $tokenHandler, |
|
| 130 | + $l, |
|
| 131 | + $this->serverContainer->getLogger(), |
|
| 132 | + $this->serverContainer->getLazyRootFolder(), |
|
| 133 | + $this->serverContainer->getConfig(), |
|
| 134 | + $this->serverContainer->getUserManager(), |
|
| 135 | + $this->serverContainer->getCloudIdManager(), |
|
| 136 | + $this->serverContainer->getGlobalScaleConfig() |
|
| 137 | + ); |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + return $this->federatedProvider; |
|
| 141 | + } |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Create the federated share provider |
|
| 145 | + * |
|
| 146 | + * @return ShareByMailProvider |
|
| 147 | + */ |
|
| 148 | + protected function getShareByMailProvider() { |
|
| 149 | + if ($this->shareByMailProvider === null) { |
|
| 150 | + /* |
|
| 151 | 151 | * Check if the app is enabled |
| 152 | 152 | */ |
| 153 | - $appManager = $this->serverContainer->getAppManager(); |
|
| 154 | - if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 155 | - return null; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 159 | - |
|
| 160 | - $this->shareByMailProvider = new ShareByMailProvider( |
|
| 161 | - $this->serverContainer->getDatabaseConnection(), |
|
| 162 | - $this->serverContainer->getSecureRandom(), |
|
| 163 | - $this->serverContainer->getUserManager(), |
|
| 164 | - $this->serverContainer->getLazyRootFolder(), |
|
| 165 | - $this->serverContainer->getL10N('sharebymail'), |
|
| 166 | - $this->serverContainer->getLogger(), |
|
| 167 | - $this->serverContainer->getMailer(), |
|
| 168 | - $this->serverContainer->getURLGenerator(), |
|
| 169 | - $this->serverContainer->getActivityManager(), |
|
| 170 | - $settingsManager, |
|
| 171 | - $this->serverContainer->query(Defaults::class), |
|
| 172 | - $this->serverContainer->getHasher(), |
|
| 173 | - $this->serverContainer->query(CapabilitiesManager::class) |
|
| 174 | - ); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - return $this->shareByMailProvider; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Create the circle share provider |
|
| 183 | - * |
|
| 184 | - * @return FederatedShareProvider |
|
| 185 | - * |
|
| 186 | - * @suppress PhanUndeclaredClassMethod |
|
| 187 | - */ |
|
| 188 | - protected function getShareByCircleProvider() { |
|
| 189 | - |
|
| 190 | - if ($this->circlesAreNotAvailable) { |
|
| 191 | - return null; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 195 | - !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 196 | - ) { |
|
| 197 | - $this->circlesAreNotAvailable = true; |
|
| 198 | - return null; |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - if ($this->shareByCircleProvider === null) { |
|
| 202 | - |
|
| 203 | - $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 204 | - $this->serverContainer->getDatabaseConnection(), |
|
| 205 | - $this->serverContainer->getSecureRandom(), |
|
| 206 | - $this->serverContainer->getUserManager(), |
|
| 207 | - $this->serverContainer->getLazyRootFolder(), |
|
| 208 | - $this->serverContainer->getL10N('circles'), |
|
| 209 | - $this->serverContainer->getLogger(), |
|
| 210 | - $this->serverContainer->getURLGenerator() |
|
| 211 | - ); |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - return $this->shareByCircleProvider; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - |
|
| 218 | - /** |
|
| 219 | - * @inheritdoc |
|
| 220 | - */ |
|
| 221 | - public function getProvider($id) { |
|
| 222 | - $provider = null; |
|
| 223 | - if ($id === 'ocinternal') { |
|
| 224 | - $provider = $this->defaultShareProvider(); |
|
| 225 | - } else if ($id === 'ocFederatedSharing') { |
|
| 226 | - $provider = $this->federatedShareProvider(); |
|
| 227 | - } else if ($id === 'ocMailShare') { |
|
| 228 | - $provider = $this->getShareByMailProvider(); |
|
| 229 | - } else if ($id === 'ocCircleShare') { |
|
| 230 | - $provider = $this->getShareByCircleProvider(); |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - if ($provider === null) { |
|
| 234 | - throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - return $provider; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * @inheritdoc |
|
| 242 | - */ |
|
| 243 | - public function getProviderForType($shareType) { |
|
| 244 | - $provider = null; |
|
| 245 | - |
|
| 246 | - if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 247 | - $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 248 | - $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 249 | - ) { |
|
| 250 | - $provider = $this->defaultShareProvider(); |
|
| 251 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) { |
|
| 252 | - $provider = $this->federatedShareProvider(); |
|
| 253 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 254 | - $provider = $this->getShareByMailProvider(); |
|
| 255 | - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 256 | - $provider = $this->getShareByCircleProvider(); |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - |
|
| 260 | - if ($provider === null) { |
|
| 261 | - throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - return $provider; |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - public function getAllProviders() { |
|
| 268 | - $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 269 | - $shareByMail = $this->getShareByMailProvider(); |
|
| 270 | - if ($shareByMail !== null) { |
|
| 271 | - $shares[] = $shareByMail; |
|
| 272 | - } |
|
| 273 | - $shareByCircle = $this->getShareByCircleProvider(); |
|
| 274 | - if ($shareByCircle !== null) { |
|
| 275 | - $shares[] = $shareByCircle; |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - return $shares; |
|
| 279 | - } |
|
| 153 | + $appManager = $this->serverContainer->getAppManager(); |
|
| 154 | + if (!$appManager->isEnabledForUser('sharebymail')) { |
|
| 155 | + return null; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + $settingsManager = new SettingsManager($this->serverContainer->getConfig()); |
|
| 159 | + |
|
| 160 | + $this->shareByMailProvider = new ShareByMailProvider( |
|
| 161 | + $this->serverContainer->getDatabaseConnection(), |
|
| 162 | + $this->serverContainer->getSecureRandom(), |
|
| 163 | + $this->serverContainer->getUserManager(), |
|
| 164 | + $this->serverContainer->getLazyRootFolder(), |
|
| 165 | + $this->serverContainer->getL10N('sharebymail'), |
|
| 166 | + $this->serverContainer->getLogger(), |
|
| 167 | + $this->serverContainer->getMailer(), |
|
| 168 | + $this->serverContainer->getURLGenerator(), |
|
| 169 | + $this->serverContainer->getActivityManager(), |
|
| 170 | + $settingsManager, |
|
| 171 | + $this->serverContainer->query(Defaults::class), |
|
| 172 | + $this->serverContainer->getHasher(), |
|
| 173 | + $this->serverContainer->query(CapabilitiesManager::class) |
|
| 174 | + ); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + return $this->shareByMailProvider; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Create the circle share provider |
|
| 183 | + * |
|
| 184 | + * @return FederatedShareProvider |
|
| 185 | + * |
|
| 186 | + * @suppress PhanUndeclaredClassMethod |
|
| 187 | + */ |
|
| 188 | + protected function getShareByCircleProvider() { |
|
| 189 | + |
|
| 190 | + if ($this->circlesAreNotAvailable) { |
|
| 191 | + return null; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') || |
|
| 195 | + !class_exists('\OCA\Circles\ShareByCircleProvider') |
|
| 196 | + ) { |
|
| 197 | + $this->circlesAreNotAvailable = true; |
|
| 198 | + return null; |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + if ($this->shareByCircleProvider === null) { |
|
| 202 | + |
|
| 203 | + $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider( |
|
| 204 | + $this->serverContainer->getDatabaseConnection(), |
|
| 205 | + $this->serverContainer->getSecureRandom(), |
|
| 206 | + $this->serverContainer->getUserManager(), |
|
| 207 | + $this->serverContainer->getLazyRootFolder(), |
|
| 208 | + $this->serverContainer->getL10N('circles'), |
|
| 209 | + $this->serverContainer->getLogger(), |
|
| 210 | + $this->serverContainer->getURLGenerator() |
|
| 211 | + ); |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + return $this->shareByCircleProvider; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * @inheritdoc |
|
| 220 | + */ |
|
| 221 | + public function getProvider($id) { |
|
| 222 | + $provider = null; |
|
| 223 | + if ($id === 'ocinternal') { |
|
| 224 | + $provider = $this->defaultShareProvider(); |
|
| 225 | + } else if ($id === 'ocFederatedSharing') { |
|
| 226 | + $provider = $this->federatedShareProvider(); |
|
| 227 | + } else if ($id === 'ocMailShare') { |
|
| 228 | + $provider = $this->getShareByMailProvider(); |
|
| 229 | + } else if ($id === 'ocCircleShare') { |
|
| 230 | + $provider = $this->getShareByCircleProvider(); |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + if ($provider === null) { |
|
| 234 | + throw new ProviderException('No provider with id .' . $id . ' found.'); |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + return $provider; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * @inheritdoc |
|
| 242 | + */ |
|
| 243 | + public function getProviderForType($shareType) { |
|
| 244 | + $provider = null; |
|
| 245 | + |
|
| 246 | + if ($shareType === \OCP\Share::SHARE_TYPE_USER || |
|
| 247 | + $shareType === \OCP\Share::SHARE_TYPE_GROUP || |
|
| 248 | + $shareType === \OCP\Share::SHARE_TYPE_LINK |
|
| 249 | + ) { |
|
| 250 | + $provider = $this->defaultShareProvider(); |
|
| 251 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) { |
|
| 252 | + $provider = $this->federatedShareProvider(); |
|
| 253 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { |
|
| 254 | + $provider = $this->getShareByMailProvider(); |
|
| 255 | + } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { |
|
| 256 | + $provider = $this->getShareByCircleProvider(); |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + |
|
| 260 | + if ($provider === null) { |
|
| 261 | + throw new ProviderException('No share provider for share type ' . $shareType); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + return $provider; |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + public function getAllProviders() { |
|
| 268 | + $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()]; |
|
| 269 | + $shareByMail = $this->getShareByMailProvider(); |
|
| 270 | + if ($shareByMail !== null) { |
|
| 271 | + $shares[] = $shareByMail; |
|
| 272 | + } |
|
| 273 | + $shareByCircle = $this->getShareByCircleProvider(); |
|
| 274 | + if ($shareByCircle !== null) { |
|
| 275 | + $shares[] = $shareByCircle; |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + return $shares; |
|
| 279 | + } |
|
| 280 | 280 | } |
@@ -27,37 +27,37 @@ |
||
| 27 | 27 | |
| 28 | 28 | class CloudFederationFactory implements ICloudFederationFactory { |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * get a CloudFederationShare Object to prepare a share you want to send |
|
| 32 | - * |
|
| 33 | - * @param string $shareWith |
|
| 34 | - * @param string $name resource name (e.g. document.odt) |
|
| 35 | - * @param string $description share description (optional) |
|
| 36 | - * @param string $providerId resource UID on the provider side |
|
| 37 | - * @param string $owner provider specific UID of the user who owns the resource |
|
| 38 | - * @param string $ownerDisplayName display name of the user who shared the item |
|
| 39 | - * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 40 | - * @param $sharedByDisplayName display name of the user who shared the resource |
|
| 41 | - * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 42 | - * @param string $shareType ('group' or 'user' share) |
|
| 43 | - * @param $resourceType ('file', 'calendar',...) |
|
| 44 | - * @return ICloudFederationShare |
|
| 45 | - * |
|
| 46 | - * @since 14.0.0 |
|
| 47 | - */ |
|
| 48 | - public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) { |
|
| 49 | - return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType); |
|
| 50 | - } |
|
| 30 | + /** |
|
| 31 | + * get a CloudFederationShare Object to prepare a share you want to send |
|
| 32 | + * |
|
| 33 | + * @param string $shareWith |
|
| 34 | + * @param string $name resource name (e.g. document.odt) |
|
| 35 | + * @param string $description share description (optional) |
|
| 36 | + * @param string $providerId resource UID on the provider side |
|
| 37 | + * @param string $owner provider specific UID of the user who owns the resource |
|
| 38 | + * @param string $ownerDisplayName display name of the user who shared the item |
|
| 39 | + * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 40 | + * @param $sharedByDisplayName display name of the user who shared the resource |
|
| 41 | + * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 42 | + * @param string $shareType ('group' or 'user' share) |
|
| 43 | + * @param $resourceType ('file', 'calendar',...) |
|
| 44 | + * @return ICloudFederationShare |
|
| 45 | + * |
|
| 46 | + * @since 14.0.0 |
|
| 47 | + */ |
|
| 48 | + public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType) { |
|
| 49 | + return new CloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * get a Cloud FederationNotification object to prepare a notification you |
|
| 54 | - * want to send |
|
| 55 | - * |
|
| 56 | - * @return ICloudFederationNotification |
|
| 57 | - * |
|
| 58 | - * @since 14.0.0 |
|
| 59 | - */ |
|
| 60 | - public function getCloudFederationNotification() { |
|
| 61 | - return new CloudFederationNotification(); |
|
| 62 | - } |
|
| 52 | + /** |
|
| 53 | + * get a Cloud FederationNotification object to prepare a notification you |
|
| 54 | + * want to send |
|
| 55 | + * |
|
| 56 | + * @return ICloudFederationNotification |
|
| 57 | + * |
|
| 58 | + * @since 14.0.0 |
|
| 59 | + */ |
|
| 60 | + public function getCloudFederationNotification() { |
|
| 61 | + return new CloudFederationNotification(); |
|
| 62 | + } |
|
| 63 | 63 | } |
@@ -25,312 +25,312 @@ |
||
| 25 | 25 | |
| 26 | 26 | class CloudFederationShare implements ICloudFederationShare { |
| 27 | 27 | |
| 28 | - private $share = [ |
|
| 29 | - 'shareWith' => '', |
|
| 30 | - 'shareType' => '', |
|
| 31 | - 'name' => '', |
|
| 32 | - 'resourceType' => '', |
|
| 33 | - 'description' => '', |
|
| 34 | - 'providerId' => '', |
|
| 35 | - 'owner' => '', |
|
| 36 | - 'ownerDisplayName' => '', |
|
| 37 | - 'sharedBy' => '', |
|
| 38 | - 'sharedByDisplayName' => '', |
|
| 39 | - 'protocol' => [] |
|
| 40 | - ]; |
|
| 28 | + private $share = [ |
|
| 29 | + 'shareWith' => '', |
|
| 30 | + 'shareType' => '', |
|
| 31 | + 'name' => '', |
|
| 32 | + 'resourceType' => '', |
|
| 33 | + 'description' => '', |
|
| 34 | + 'providerId' => '', |
|
| 35 | + 'owner' => '', |
|
| 36 | + 'ownerDisplayName' => '', |
|
| 37 | + 'sharedBy' => '', |
|
| 38 | + 'sharedByDisplayName' => '', |
|
| 39 | + 'protocol' => [] |
|
| 40 | + ]; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * get a CloudFederationShare Object to prepare a share you want to send |
|
| 44 | - * |
|
| 45 | - * @param string $shareWith |
|
| 46 | - * @param string $name resource name (e.g. document.odt) |
|
| 47 | - * @param string $description share description (optional) |
|
| 48 | - * @param string $providerId resource UID on the provider side |
|
| 49 | - * @param string $owner provider specific UID of the user who owns the resource |
|
| 50 | - * @param string $ownerDisplayName display name of the user who shared the item |
|
| 51 | - * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 52 | - * @param string $sharedByDisplayName display name of the user who shared the resource |
|
| 53 | - * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 54 | - * @param string $shareType ('group' or 'user' share) |
|
| 55 | - * @param $resourceType ('file', 'calendar',...) |
|
| 56 | - * |
|
| 57 | - */ |
|
| 58 | - public function __construct($shareWith = '', |
|
| 59 | - $name = '', |
|
| 60 | - $description = '', |
|
| 61 | - $providerId = '', |
|
| 62 | - $owner = '', |
|
| 63 | - $ownerDisplayName = '', |
|
| 64 | - $sharedBy = '', |
|
| 65 | - $sharedByDisplayName = '', |
|
| 66 | - $protocol = [], |
|
| 67 | - $shareType = '', |
|
| 68 | - $resourceType = '' |
|
| 69 | - ) { |
|
| 70 | - $this->setShareWith($shareWith); |
|
| 71 | - $this->setResourceName($name); |
|
| 72 | - $this->setDescription($description); |
|
| 73 | - $this->setProviderId($providerId); |
|
| 74 | - $this->setOwner($owner); |
|
| 75 | - $this->setOwnerDisplayName($ownerDisplayName); |
|
| 76 | - $this->setSharedBy($sharedBy); |
|
| 77 | - $this->setSharedByDisplayName($sharedByDisplayName); |
|
| 78 | - $this->setProtocol($protocol); |
|
| 79 | - $this->setShareType($shareType); |
|
| 80 | - $this->setResourceType($resourceType); |
|
| 42 | + /** |
|
| 43 | + * get a CloudFederationShare Object to prepare a share you want to send |
|
| 44 | + * |
|
| 45 | + * @param string $shareWith |
|
| 46 | + * @param string $name resource name (e.g. document.odt) |
|
| 47 | + * @param string $description share description (optional) |
|
| 48 | + * @param string $providerId resource UID on the provider side |
|
| 49 | + * @param string $owner provider specific UID of the user who owns the resource |
|
| 50 | + * @param string $ownerDisplayName display name of the user who shared the item |
|
| 51 | + * @param string $sharedBy provider specific UID of the user who shared the resource |
|
| 52 | + * @param string $sharedByDisplayName display name of the user who shared the resource |
|
| 53 | + * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]]) |
|
| 54 | + * @param string $shareType ('group' or 'user' share) |
|
| 55 | + * @param $resourceType ('file', 'calendar',...) |
|
| 56 | + * |
|
| 57 | + */ |
|
| 58 | + public function __construct($shareWith = '', |
|
| 59 | + $name = '', |
|
| 60 | + $description = '', |
|
| 61 | + $providerId = '', |
|
| 62 | + $owner = '', |
|
| 63 | + $ownerDisplayName = '', |
|
| 64 | + $sharedBy = '', |
|
| 65 | + $sharedByDisplayName = '', |
|
| 66 | + $protocol = [], |
|
| 67 | + $shareType = '', |
|
| 68 | + $resourceType = '' |
|
| 69 | + ) { |
|
| 70 | + $this->setShareWith($shareWith); |
|
| 71 | + $this->setResourceName($name); |
|
| 72 | + $this->setDescription($description); |
|
| 73 | + $this->setProviderId($providerId); |
|
| 74 | + $this->setOwner($owner); |
|
| 75 | + $this->setOwnerDisplayName($ownerDisplayName); |
|
| 76 | + $this->setSharedBy($sharedBy); |
|
| 77 | + $this->setSharedByDisplayName($sharedByDisplayName); |
|
| 78 | + $this->setProtocol($protocol); |
|
| 79 | + $this->setShareType($shareType); |
|
| 80 | + $this->setResourceType($resourceType); |
|
| 81 | 81 | |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * set uid of the recipient |
|
| 86 | - * |
|
| 87 | - * @param string $user |
|
| 88 | - * |
|
| 89 | - * @since 14.0.0 |
|
| 90 | - */ |
|
| 91 | - public function setShareWith($user) { |
|
| 92 | - $this->share['shareWith'] = $user; |
|
| 93 | - } |
|
| 84 | + /** |
|
| 85 | + * set uid of the recipient |
|
| 86 | + * |
|
| 87 | + * @param string $user |
|
| 88 | + * |
|
| 89 | + * @since 14.0.0 |
|
| 90 | + */ |
|
| 91 | + public function setShareWith($user) { |
|
| 92 | + $this->share['shareWith'] = $user; |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - /** |
|
| 96 | - * set resource name (e.g. document.odt) |
|
| 97 | - * |
|
| 98 | - * @param string $name |
|
| 99 | - * |
|
| 100 | - * @since 14.0.0 |
|
| 101 | - */ |
|
| 102 | - public function setResourceName($name) { |
|
| 103 | - $this->share['name'] = $name; |
|
| 104 | - } |
|
| 95 | + /** |
|
| 96 | + * set resource name (e.g. document.odt) |
|
| 97 | + * |
|
| 98 | + * @param string $name |
|
| 99 | + * |
|
| 100 | + * @since 14.0.0 |
|
| 101 | + */ |
|
| 102 | + public function setResourceName($name) { |
|
| 103 | + $this->share['name'] = $name; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * set resource type (e.g. file, calendar, contact,...) |
|
| 108 | - * |
|
| 109 | - * @param string $resourceType |
|
| 110 | - * |
|
| 111 | - * @since 14.0.0 |
|
| 112 | - */ |
|
| 113 | - public function setResourceType($resourceType) { |
|
| 114 | - $this->share['resourceType'] = $resourceType; |
|
| 115 | - } |
|
| 106 | + /** |
|
| 107 | + * set resource type (e.g. file, calendar, contact,...) |
|
| 108 | + * |
|
| 109 | + * @param string $resourceType |
|
| 110 | + * |
|
| 111 | + * @since 14.0.0 |
|
| 112 | + */ |
|
| 113 | + public function setResourceType($resourceType) { |
|
| 114 | + $this->share['resourceType'] = $resourceType; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * set resource description (optional) |
|
| 119 | - * |
|
| 120 | - * @param string $description |
|
| 121 | - * |
|
| 122 | - * @since 14.0.0 |
|
| 123 | - */ |
|
| 124 | - public function setDescription($description) { |
|
| 125 | - $this->share['description'] = $description; |
|
| 126 | - } |
|
| 117 | + /** |
|
| 118 | + * set resource description (optional) |
|
| 119 | + * |
|
| 120 | + * @param string $description |
|
| 121 | + * |
|
| 122 | + * @since 14.0.0 |
|
| 123 | + */ |
|
| 124 | + public function setDescription($description) { |
|
| 125 | + $this->share['description'] = $description; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - /** |
|
| 129 | - * set provider ID (e.g. file ID) |
|
| 130 | - * |
|
| 131 | - * @param string $providerId |
|
| 132 | - * |
|
| 133 | - * @since 14.0.0 |
|
| 134 | - */ |
|
| 135 | - public function setProviderId($providerId) { |
|
| 136 | - $this->share['providerId'] = $providerId; |
|
| 137 | - } |
|
| 128 | + /** |
|
| 129 | + * set provider ID (e.g. file ID) |
|
| 130 | + * |
|
| 131 | + * @param string $providerId |
|
| 132 | + * |
|
| 133 | + * @since 14.0.0 |
|
| 134 | + */ |
|
| 135 | + public function setProviderId($providerId) { |
|
| 136 | + $this->share['providerId'] = $providerId; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * set owner UID |
|
| 141 | - * |
|
| 142 | - * @param string $owner |
|
| 143 | - * |
|
| 144 | - * @since 14.0.0 |
|
| 145 | - */ |
|
| 146 | - public function setOwner($owner) { |
|
| 147 | - $this->share['owner'] = $owner; |
|
| 148 | - } |
|
| 139 | + /** |
|
| 140 | + * set owner UID |
|
| 141 | + * |
|
| 142 | + * @param string $owner |
|
| 143 | + * |
|
| 144 | + * @since 14.0.0 |
|
| 145 | + */ |
|
| 146 | + public function setOwner($owner) { |
|
| 147 | + $this->share['owner'] = $owner; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * set owner display name |
|
| 152 | - * |
|
| 153 | - * @param string $ownerDisplayName |
|
| 154 | - * |
|
| 155 | - * @since 14.0.0 |
|
| 156 | - */ |
|
| 157 | - public function setOwnerDisplayName($ownerDisplayName) { |
|
| 158 | - $this->share['ownerDisplayName'] = $ownerDisplayName; |
|
| 159 | - } |
|
| 150 | + /** |
|
| 151 | + * set owner display name |
|
| 152 | + * |
|
| 153 | + * @param string $ownerDisplayName |
|
| 154 | + * |
|
| 155 | + * @since 14.0.0 |
|
| 156 | + */ |
|
| 157 | + public function setOwnerDisplayName($ownerDisplayName) { |
|
| 158 | + $this->share['ownerDisplayName'] = $ownerDisplayName; |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * set UID of the user who sends the share |
|
| 163 | - * |
|
| 164 | - * @param string $sharedBy |
|
| 165 | - * |
|
| 166 | - * @since 14.0.0 |
|
| 167 | - */ |
|
| 168 | - public function setSharedBy($sharedBy) { |
|
| 169 | - $this->share['sharedBy'] = $sharedBy; |
|
| 170 | - } |
|
| 161 | + /** |
|
| 162 | + * set UID of the user who sends the share |
|
| 163 | + * |
|
| 164 | + * @param string $sharedBy |
|
| 165 | + * |
|
| 166 | + * @since 14.0.0 |
|
| 167 | + */ |
|
| 168 | + public function setSharedBy($sharedBy) { |
|
| 169 | + $this->share['sharedBy'] = $sharedBy; |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * set display name of the user who sends the share |
|
| 174 | - * |
|
| 175 | - * @param $sharedByDisplayName |
|
| 176 | - * |
|
| 177 | - * @since 14.0.0 |
|
| 178 | - */ |
|
| 179 | - public function setSharedByDisplayName($sharedByDisplayName) { |
|
| 180 | - $this->share['sharedByDisplayName'] = $sharedByDisplayName; |
|
| 181 | - } |
|
| 172 | + /** |
|
| 173 | + * set display name of the user who sends the share |
|
| 174 | + * |
|
| 175 | + * @param $sharedByDisplayName |
|
| 176 | + * |
|
| 177 | + * @since 14.0.0 |
|
| 178 | + */ |
|
| 179 | + public function setSharedByDisplayName($sharedByDisplayName) { |
|
| 180 | + $this->share['sharedByDisplayName'] = $sharedByDisplayName; |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - /** |
|
| 184 | - * set protocol specification |
|
| 185 | - * |
|
| 186 | - * @param array $protocol |
|
| 187 | - * |
|
| 188 | - * @since 14.0.0 |
|
| 189 | - */ |
|
| 190 | - public function setProtocol(array $protocol) { |
|
| 191 | - $this->share['protocol'] = $protocol; |
|
| 192 | - } |
|
| 183 | + /** |
|
| 184 | + * set protocol specification |
|
| 185 | + * |
|
| 186 | + * @param array $protocol |
|
| 187 | + * |
|
| 188 | + * @since 14.0.0 |
|
| 189 | + */ |
|
| 190 | + public function setProtocol(array $protocol) { |
|
| 191 | + $this->share['protocol'] = $protocol; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - /** |
|
| 195 | - * share type (group or user) |
|
| 196 | - * |
|
| 197 | - * @param string $shareType |
|
| 198 | - * |
|
| 199 | - * @since 14.0.0 |
|
| 200 | - */ |
|
| 201 | - public function setShareType($shareType) { |
|
| 202 | - $this->share['shareType'] = $shareType; |
|
| 203 | - } |
|
| 194 | + /** |
|
| 195 | + * share type (group or user) |
|
| 196 | + * |
|
| 197 | + * @param string $shareType |
|
| 198 | + * |
|
| 199 | + * @since 14.0.0 |
|
| 200 | + */ |
|
| 201 | + public function setShareType($shareType) { |
|
| 202 | + $this->share['shareType'] = $shareType; |
|
| 203 | + } |
|
| 204 | 204 | |
| 205 | - /** |
|
| 206 | - * get JSON encoded share, ready to send out |
|
| 207 | - * |
|
| 208 | - * @return string |
|
| 209 | - * |
|
| 210 | - * @since 14.0.0 |
|
| 211 | - */ |
|
| 212 | - public function getShare() { |
|
| 213 | - return json_encode($this->share); |
|
| 214 | - } |
|
| 205 | + /** |
|
| 206 | + * get JSON encoded share, ready to send out |
|
| 207 | + * |
|
| 208 | + * @return string |
|
| 209 | + * |
|
| 210 | + * @since 14.0.0 |
|
| 211 | + */ |
|
| 212 | + public function getShare() { |
|
| 213 | + return json_encode($this->share); |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * get uid of the recipient |
|
| 218 | - * |
|
| 219 | - * @return string |
|
| 220 | - * |
|
| 221 | - * @since 14.0.0 |
|
| 222 | - */ |
|
| 223 | - public function getShareWith() { |
|
| 224 | - return $this->share['shareWith']; |
|
| 225 | - } |
|
| 216 | + /** |
|
| 217 | + * get uid of the recipient |
|
| 218 | + * |
|
| 219 | + * @return string |
|
| 220 | + * |
|
| 221 | + * @since 14.0.0 |
|
| 222 | + */ |
|
| 223 | + public function getShareWith() { |
|
| 224 | + return $this->share['shareWith']; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - /** |
|
| 228 | - * get resource name (e.g. file, calendar, contact,...) |
|
| 229 | - * |
|
| 230 | - * @return string |
|
| 231 | - * |
|
| 232 | - * @since 14.0.0 |
|
| 233 | - */ |
|
| 234 | - public function getResourceName() { |
|
| 235 | - return $this->share['name']; |
|
| 236 | - } |
|
| 227 | + /** |
|
| 228 | + * get resource name (e.g. file, calendar, contact,...) |
|
| 229 | + * |
|
| 230 | + * @return string |
|
| 231 | + * |
|
| 232 | + * @since 14.0.0 |
|
| 233 | + */ |
|
| 234 | + public function getResourceName() { |
|
| 235 | + return $this->share['name']; |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - /** |
|
| 239 | - * get resource type (e.g. file, calendar, contact,...) |
|
| 240 | - * |
|
| 241 | - * @return string |
|
| 242 | - * |
|
| 243 | - * @since 14.0.0 |
|
| 244 | - */ |
|
| 245 | - public function getResourceType() { |
|
| 246 | - return $this->share['resourceType']; |
|
| 247 | - } |
|
| 238 | + /** |
|
| 239 | + * get resource type (e.g. file, calendar, contact,...) |
|
| 240 | + * |
|
| 241 | + * @return string |
|
| 242 | + * |
|
| 243 | + * @since 14.0.0 |
|
| 244 | + */ |
|
| 245 | + public function getResourceType() { |
|
| 246 | + return $this->share['resourceType']; |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - /** |
|
| 250 | - * get resource description (optional) |
|
| 251 | - * |
|
| 252 | - * @return string |
|
| 253 | - * |
|
| 254 | - * @since 14.0.0 |
|
| 255 | - */ |
|
| 256 | - public function getDescription() { |
|
| 257 | - return $this->share['description']; |
|
| 258 | - } |
|
| 249 | + /** |
|
| 250 | + * get resource description (optional) |
|
| 251 | + * |
|
| 252 | + * @return string |
|
| 253 | + * |
|
| 254 | + * @since 14.0.0 |
|
| 255 | + */ |
|
| 256 | + public function getDescription() { |
|
| 257 | + return $this->share['description']; |
|
| 258 | + } |
|
| 259 | 259 | |
| 260 | - /** |
|
| 261 | - * get provider ID (e.g. file ID) |
|
| 262 | - * |
|
| 263 | - * @return string |
|
| 264 | - * |
|
| 265 | - * @since 14.0.0 |
|
| 266 | - */ |
|
| 267 | - public function getProviderId() { |
|
| 268 | - return $this->share['providerId']; |
|
| 269 | - } |
|
| 260 | + /** |
|
| 261 | + * get provider ID (e.g. file ID) |
|
| 262 | + * |
|
| 263 | + * @return string |
|
| 264 | + * |
|
| 265 | + * @since 14.0.0 |
|
| 266 | + */ |
|
| 267 | + public function getProviderId() { |
|
| 268 | + return $this->share['providerId']; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * get owner UID |
|
| 273 | - * |
|
| 274 | - * @return string |
|
| 275 | - * |
|
| 276 | - * @since 14.0.0 |
|
| 277 | - */ |
|
| 278 | - public function getOwner() { |
|
| 279 | - return $this->share['owner']; |
|
| 280 | - } |
|
| 271 | + /** |
|
| 272 | + * get owner UID |
|
| 273 | + * |
|
| 274 | + * @return string |
|
| 275 | + * |
|
| 276 | + * @since 14.0.0 |
|
| 277 | + */ |
|
| 278 | + public function getOwner() { |
|
| 279 | + return $this->share['owner']; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * get owner display name |
|
| 284 | - * |
|
| 285 | - * @return string |
|
| 286 | - * |
|
| 287 | - * @since 14.0.0 |
|
| 288 | - */ |
|
| 289 | - public function getOwnerDisplayName() { |
|
| 290 | - return $this->share['ownerDisplayName']; |
|
| 291 | - } |
|
| 282 | + /** |
|
| 283 | + * get owner display name |
|
| 284 | + * |
|
| 285 | + * @return string |
|
| 286 | + * |
|
| 287 | + * @since 14.0.0 |
|
| 288 | + */ |
|
| 289 | + public function getOwnerDisplayName() { |
|
| 290 | + return $this->share['ownerDisplayName']; |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | - /** |
|
| 294 | - * get UID of the user who sends the share |
|
| 295 | - * |
|
| 296 | - * @return string |
|
| 297 | - * |
|
| 298 | - * @since 14.0.0 |
|
| 299 | - */ |
|
| 300 | - public function getSharedBy() { |
|
| 301 | - return $this->share['sharedBy']; |
|
| 302 | - } |
|
| 293 | + /** |
|
| 294 | + * get UID of the user who sends the share |
|
| 295 | + * |
|
| 296 | + * @return string |
|
| 297 | + * |
|
| 298 | + * @since 14.0.0 |
|
| 299 | + */ |
|
| 300 | + public function getSharedBy() { |
|
| 301 | + return $this->share['sharedBy']; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - /** |
|
| 305 | - * get display name of the user who sends the share |
|
| 306 | - * |
|
| 307 | - * @return string |
|
| 308 | - * |
|
| 309 | - * @since 14.0.0 |
|
| 310 | - */ |
|
| 311 | - public function getSharedByDisplayName() { |
|
| 312 | - return $this->share['sharedByDisplayName']; |
|
| 313 | - } |
|
| 304 | + /** |
|
| 305 | + * get display name of the user who sends the share |
|
| 306 | + * |
|
| 307 | + * @return string |
|
| 308 | + * |
|
| 309 | + * @since 14.0.0 |
|
| 310 | + */ |
|
| 311 | + public function getSharedByDisplayName() { |
|
| 312 | + return $this->share['sharedByDisplayName']; |
|
| 313 | + } |
|
| 314 | 314 | |
| 315 | - /** |
|
| 316 | - * get share type (group or user) |
|
| 317 | - * |
|
| 318 | - * @return string |
|
| 319 | - * |
|
| 320 | - * @since 14.0.0 |
|
| 321 | - */ |
|
| 322 | - public function getShareType() { |
|
| 323 | - return $this->share['shareType']; |
|
| 324 | - } |
|
| 315 | + /** |
|
| 316 | + * get share type (group or user) |
|
| 317 | + * |
|
| 318 | + * @return string |
|
| 319 | + * |
|
| 320 | + * @since 14.0.0 |
|
| 321 | + */ |
|
| 322 | + public function getShareType() { |
|
| 323 | + return $this->share['shareType']; |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - /** |
|
| 327 | - * get protocol specification |
|
| 328 | - * |
|
| 329 | - * @return array |
|
| 330 | - * |
|
| 331 | - * @since 14.0.0 |
|
| 332 | - */ |
|
| 333 | - public function getProtocol() { |
|
| 334 | - return $this->share['protocol']; |
|
| 335 | - } |
|
| 326 | + /** |
|
| 327 | + * get protocol specification |
|
| 328 | + * |
|
| 329 | + * @return array |
|
| 330 | + * |
|
| 331 | + * @since 14.0.0 |
|
| 332 | + */ |
|
| 333 | + public function getProtocol() { |
|
| 334 | + return $this->share['protocol']; |
|
| 335 | + } |
|
| 336 | 336 | } |
@@ -25,28 +25,28 @@ |
||
| 25 | 25 | |
| 26 | 26 | class CloudFederationNotification implements ICloudFederationNotification { |
| 27 | 27 | |
| 28 | - private $message = []; |
|
| 28 | + private $message = []; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * add a message to the notification |
|
| 32 | - * |
|
| 33 | - * @param string $identifier |
|
| 34 | - * @param string $message |
|
| 35 | - * |
|
| 36 | - * @since 14.0.0 |
|
| 37 | - */ |
|
| 38 | - public function setMessage($identifier, $message) { |
|
| 39 | - $this->message[$identifier] = $message; |
|
| 40 | - } |
|
| 30 | + /** |
|
| 31 | + * add a message to the notification |
|
| 32 | + * |
|
| 33 | + * @param string $identifier |
|
| 34 | + * @param string $message |
|
| 35 | + * |
|
| 36 | + * @since 14.0.0 |
|
| 37 | + */ |
|
| 38 | + public function setMessage($identifier, $message) { |
|
| 39 | + $this->message[$identifier] = $message; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * get JSON encoded Message, ready to send out |
|
| 44 | - * |
|
| 45 | - * @return string |
|
| 46 | - * |
|
| 47 | - * @since 14.0.0 |
|
| 48 | - */ |
|
| 49 | - public function getMessage() { |
|
| 50 | - return json_encode($this->message); |
|
| 51 | - } |
|
| 42 | + /** |
|
| 43 | + * get JSON encoded Message, ready to send out |
|
| 44 | + * |
|
| 45 | + * @return string |
|
| 46 | + * |
|
| 47 | + * @since 14.0.0 |
|
| 48 | + */ |
|
| 49 | + public function getMessage() { |
|
| 50 | + return json_encode($this->message); |
|
| 51 | + } |
|
| 52 | 52 | } |
@@ -36,47 +36,47 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $application = new Application(); |
| 38 | 38 | $application->registerRoutes($this, [ |
| 39 | - 'routes' => [ |
|
| 40 | - ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 41 | - ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 42 | - ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 43 | - ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 44 | - ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 45 | - ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 46 | - ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 47 | - ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 48 | - ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 49 | - ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 50 | - ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 51 | - ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 52 | - ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 53 | - ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 54 | - ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 55 | - ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'], |
|
| 56 | - ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 57 | - ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 58 | - ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 59 | - ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 60 | - ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 61 | - ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 62 | - ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 63 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 64 | - ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 65 | - ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 66 | - ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 67 | - ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 68 | - ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 69 | - ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 70 | - ], |
|
| 71 | - 'ocs' => [ |
|
| 72 | - ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 73 | - ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 74 | - ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 75 | - ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 76 | - ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 77 | - ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 78 | - ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 79 | - ], |
|
| 39 | + 'routes' => [ |
|
| 40 | + ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 41 | + ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 42 | + ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 43 | + ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 44 | + ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 45 | + ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 46 | + ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 47 | + ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 48 | + ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 49 | + ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 50 | + ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 51 | + ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 52 | + ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 53 | + ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 54 | + ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 55 | + ['name' => 'ClientFlowLogin#redirectPage', 'url' => '/login/flow/redirect', 'verb' => 'GET'], |
|
| 56 | + ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 57 | + ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 58 | + ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 59 | + ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 60 | + ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 61 | + ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 62 | + ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 63 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 64 | + ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 65 | + ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 66 | + ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 67 | + ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 68 | + ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 69 | + ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 70 | + ], |
|
| 71 | + 'ocs' => [ |
|
| 72 | + ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 73 | + ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 74 | + ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 75 | + ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 76 | + ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 77 | + ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 78 | + ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 79 | + ], |
|
| 80 | 80 | ]); |
| 81 | 81 | |
| 82 | 82 | // Post installation check |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | // Core ajax actions |
| 86 | 86 | // Routing |
| 87 | 87 | $this->create('core_ajax_update', '/core/ajax/update.php') |
| 88 | - ->actionInclude('core/ajax/update.php'); |
|
| 88 | + ->actionInclude('core/ajax/update.php'); |
|
| 89 | 89 | |
| 90 | 90 | // File routes |
| 91 | 91 | $this->create('files.viewcontroller.showFile', '/f/{fileid}')->action(function($urlParams) { |
| 92 | - $app = new \OCA\Files\AppInfo\Application($urlParams); |
|
| 93 | - $app->dispatch('ViewController', 'index'); |
|
| 92 | + $app = new \OCA\Files\AppInfo\Application($urlParams); |
|
| 93 | + $app->dispatch('ViewController', 'index'); |
|
| 94 | 94 | }); |
| 95 | 95 | |
| 96 | 96 | // Call routes |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | * @suppress PhanUndeclaredClassMethod |
| 100 | 100 | */ |
| 101 | 101 | $this->create('spreed.pagecontroller.showCall', '/call/{token}')->action(function($urlParams) { |
| 102 | - if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { |
|
| 103 | - $app = new \OCA\Spreed\AppInfo\Application($urlParams); |
|
| 104 | - $app->dispatch('PageController', 'index'); |
|
| 105 | - } else { |
|
| 106 | - throw new \OC\HintException('App spreed is not enabled'); |
|
| 107 | - } |
|
| 102 | + if (class_exists(\OCA\Spreed\AppInfo\Application::class, false)) { |
|
| 103 | + $app = new \OCA\Spreed\AppInfo\Application($urlParams); |
|
| 104 | + $app->dispatch('PageController', 'index'); |
|
| 105 | + } else { |
|
| 106 | + throw new \OC\HintException('App spreed is not enabled'); |
|
| 107 | + } |
|
| 108 | 108 | }); |
| 109 | 109 | |
| 110 | 110 | // OCM routes |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | * @suppress PhanUndeclaredClassMethod |
| 114 | 114 | */ |
| 115 | 115 | $this->create('cloud_federation_api.requesthandlercontroller.addShare', '/ocm/shares')->post()->action(function($urlParams) { |
| 116 | - if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 117 | - $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 118 | - $app->dispatch('RequestHandlerController', 'addShare'); |
|
| 119 | - } else { |
|
| 120 | - throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 121 | - } |
|
| 116 | + if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 117 | + $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 118 | + $app->dispatch('RequestHandlerController', 'addShare'); |
|
| 119 | + } else { |
|
| 120 | + throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 121 | + } |
|
| 122 | 122 | }); |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -126,53 +126,53 @@ discard block |
||
| 126 | 126 | * @suppress PhanUndeclaredClassMethod |
| 127 | 127 | */ |
| 128 | 128 | $this->create('cloud_federation_api.requesthandlercontroller.receiveNotification', '/ocm/notifications')->post()->action(function($urlParams) { |
| 129 | - if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 130 | - $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 131 | - $app->dispatch('RequestHandlerController', 'receiveNotification'); |
|
| 132 | - } else { |
|
| 133 | - throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 134 | - } |
|
| 129 | + if (class_exists(\OCA\CloudFederationAPI\AppInfo\Application::class, false)) { |
|
| 130 | + $app = new \OCA\CloudFederationAPI\AppInfo\Application($urlParams); |
|
| 131 | + $app->dispatch('RequestHandlerController', 'receiveNotification'); |
|
| 132 | + } else { |
|
| 133 | + throw new \OC\HintException('Cloud Federation API not enabled'); |
|
| 134 | + } |
|
| 135 | 135 | }); |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | // Sharing routes |
| 139 | 139 | $this->create('files_sharing.sharecontroller.showShare', '/s/{token}')->action(function($urlParams) { |
| 140 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 141 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 142 | - $app->dispatch('ShareController', 'showShare'); |
|
| 143 | - } else { |
|
| 144 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 145 | - } |
|
| 140 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 141 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 142 | + $app->dispatch('ShareController', 'showShare'); |
|
| 143 | + } else { |
|
| 144 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 145 | + } |
|
| 146 | 146 | }); |
| 147 | 147 | $this->create('files_sharing.sharecontroller.authenticate', '/s/{token}/authenticate/{redirect}')->post()->action(function($urlParams) { |
| 148 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 149 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 150 | - $app->dispatch('ShareController', 'authenticate'); |
|
| 151 | - } else { |
|
| 152 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 153 | - } |
|
| 148 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 149 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 150 | + $app->dispatch('ShareController', 'authenticate'); |
|
| 151 | + } else { |
|
| 152 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 153 | + } |
|
| 154 | 154 | }); |
| 155 | 155 | $this->create('files_sharing.sharecontroller.showAuthenticate', '/s/{token}/authenticate/{redirect}')->get()->action(function($urlParams) { |
| 156 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 157 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 158 | - $app->dispatch('ShareController', 'showAuthenticate'); |
|
| 159 | - } else { |
|
| 160 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 161 | - } |
|
| 156 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 157 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 158 | + $app->dispatch('ShareController', 'showAuthenticate'); |
|
| 159 | + } else { |
|
| 160 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 161 | + } |
|
| 162 | 162 | }); |
| 163 | 163 | $this->create('files_sharing.sharecontroller.downloadShare', '/s/{token}/download')->get()->action(function($urlParams) { |
| 164 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 165 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 166 | - $app->dispatch('ShareController', 'downloadShare'); |
|
| 167 | - } else { |
|
| 168 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 169 | - } |
|
| 164 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 165 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 166 | + $app->dispatch('ShareController', 'downloadShare'); |
|
| 167 | + } else { |
|
| 168 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 169 | + } |
|
| 170 | 170 | }); |
| 171 | 171 | $this->create('files_sharing.publicpreview.directLink', '/s/{token}/preview')->get()->action(function($urlParams) { |
| 172 | - if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 173 | - $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 174 | - $app->dispatch('PublicPreviewController', 'directLink'); |
|
| 175 | - } else { |
|
| 176 | - throw new \OC\HintException('App file sharing is not enabled'); |
|
| 177 | - } |
|
| 172 | + if (class_exists(\OCA\Files_Sharing\AppInfo\Application::class, false)) { |
|
| 173 | + $app = new \OCA\Files_Sharing\AppInfo\Application($urlParams); |
|
| 174 | + $app->dispatch('PublicPreviewController', 'directLink'); |
|
| 175 | + } else { |
|
| 176 | + throw new \OC\HintException('App file sharing is not enabled'); |
|
| 177 | + } |
|
| 178 | 178 | }); |