|
|
|
@ -18,7 +18,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
self.nextcloud_server = hs.config.nextcloud_server |
|
|
|
|
self.service_account_name = hs.config.service_account_name |
|
|
|
|
self.service_account_password = hs.config.service_account_password |
|
|
|
|
self.headers = self._get_headers() |
|
|
|
|
self._headers = self._get_headers() |
|
|
|
|
|
|
|
|
|
def _get_headers(self): |
|
|
|
|
return { |
|
|
|
@ -59,7 +59,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
response = await self.post_json_get_json( |
|
|
|
|
uri="{}/ocs/v1.php/cloud/groups".format(self.nextcloud_server), |
|
|
|
|
post_json={"groupid": group_name}, |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
meta = response["ocs"]["meta"] |
|
|
|
@ -85,7 +85,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
uri="{nextcloud_server}/ocs/v1.php/cloud/groups/{group_name}".format( |
|
|
|
|
nextcloud_server=self.nextcloud_server, group_name=group_name |
|
|
|
|
), |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._raise_for_status( |
|
|
|
@ -113,7 +113,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
nextcloud_server=self.nextcloud_server, user_id=username |
|
|
|
|
), |
|
|
|
|
post_json={"groupid": group_name}, |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._raise_for_status( |
|
|
|
@ -140,7 +140,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
uri="{nextcloud_server}/ocs/v1.php/cloud/users/{user_id}/groups".format( |
|
|
|
|
nextcloud_server=self.nextcloud_server, user_id=username |
|
|
|
|
), |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
json_body={"groupid": group_name}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
@ -164,7 +164,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
uri="{nextcloud_server}/ocs/v1.php/cloud/users/{user_id}".format( |
|
|
|
|
nextcloud_server=self.nextcloud_server, user_id=username |
|
|
|
|
), |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._raise_for_status( |
|
|
|
@ -196,7 +196,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
"path": path, |
|
|
|
|
"reshare": "true", |
|
|
|
|
}, |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
self._raise_for_status( |
|
|
|
@ -239,7 +239,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
uri="{}/ocs/v2.php/apps/watcha_integrator/api/v1/shares".format( |
|
|
|
|
self.nextcloud_server |
|
|
|
|
), |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
post_json={ |
|
|
|
|
"path": path, |
|
|
|
|
"shareType": 1, |
|
|
|
@ -269,7 +269,7 @@ class WatchaNextcloudClient(SimpleHttpClient): |
|
|
|
|
uri="{}/ocs/v2.php/apps/watcha_integrator/api/v1/shares/{}".format( |
|
|
|
|
self.nextcloud_server, share_id |
|
|
|
|
), |
|
|
|
|
headers=self.headers, |
|
|
|
|
headers=self._headers, |
|
|
|
|
json_body={"requester": requester}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|