Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
e5ea6dd0
Commit
e5ea6dd0
authored
7 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Add client apis
parent
cccfcfa7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/federation/transport/client.py
+187
-9
187 additions, 9 deletions
synapse/federation/transport/client.py
synapse/handlers/groups_local.py
+1
-1
1 addition, 1 deletion
synapse/handlers/groups_local.py
with
188 additions
and
10 deletions
synapse/federation/transport/client.py
+
187
−
9
View file @
e5ea6dd0
...
@@ -476,10 +476,10 @@ class TransportLayerClient(object):
...
@@ -476,10 +476,10 @@ class TransportLayerClient(object):
def
get_group_profile
(
self
,
destination
,
group_id
,
requester_user_id
):
def
get_group_profile
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/profile
"
%
(
group_id
,)
path
=
PREFIX
+
"
/groups/%s/profile
"
%
(
group_id
,)
return
self
.
client
.
pos
t_json
(
return
self
.
client
.
ge
t_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
data
=
{
"
requester_user_id
"
:
requester_user_id
},
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -487,10 +487,10 @@ class TransportLayerClient(object):
...
@@ -487,10 +487,10 @@ class TransportLayerClient(object):
def
get_group_summary
(
self
,
destination
,
group_id
,
requester_user_id
):
def
get_group_summary
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/summary
"
%
(
group_id
,)
path
=
PREFIX
+
"
/groups/%s/summary
"
%
(
group_id
,)
return
self
.
client
.
pos
t_json
(
return
self
.
client
.
ge
t_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
data
=
{
"
requester_user_id
"
:
requester_user_id
},
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -498,10 +498,22 @@ class TransportLayerClient(object):
...
@@ -498,10 +498,22 @@ class TransportLayerClient(object):
def
get_group_rooms
(
self
,
destination
,
group_id
,
requester_user_id
):
def
get_group_rooms
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/rooms
"
%
(
group_id
,)
path
=
PREFIX
+
"
/groups/%s/rooms
"
%
(
group_id
,)
return
self
.
client
.
get_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
def
add_room_to_group
(
self
,
destination
,
group_id
,
requester_user_id
,
room_id
,
content
):
path
=
PREFIX
+
"
/groups/%s/room/%s
"
%
(
group_id
,
room_id
,)
return
self
.
client
.
post_json
(
return
self
.
client
.
post_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
data
=
{
"
requester_user_id
"
:
requester_user_id
},
args
=
{
"
requester_user_id
"
:
requester_user_id
},
data
=
content
,
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -509,10 +521,10 @@ class TransportLayerClient(object):
...
@@ -509,10 +521,10 @@ class TransportLayerClient(object):
def
get_group_users
(
self
,
destination
,
group_id
,
requester_user_id
):
def
get_group_users
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/users
"
%
(
group_id
,)
path
=
PREFIX
+
"
/groups/%s/users
"
%
(
group_id
,)
return
self
.
client
.
pos
t_json
(
return
self
.
client
.
ge
t_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
data
=
{
"
requester_user_id
"
:
requester_user_id
},
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -528,12 +540,13 @@ class TransportLayerClient(object):
...
@@ -528,12 +540,13 @@ class TransportLayerClient(object):
)
)
@log_function
@log_function
def
invite_to_group
(
self
,
destination
,
group_id
,
user_id
,
content
):
def
invite_to_group
(
self
,
destination
,
group_id
,
user_id
,
requester_user_id
,
content
):
path
=
PREFIX
+
"
/groups/%s/users/%s/invite
"
%
(
group_id
,
user_id
)
path
=
PREFIX
+
"
/groups/%s/users/%s/invite
"
%
(
group_id
,
user_id
)
return
self
.
client
.
post_json
(
return
self
.
client
.
post_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
args
=
requester_user_id
,
data
=
content
,
data
=
content
,
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -554,12 +567,14 @@ class TransportLayerClient(object):
...
@@ -554,12 +567,14 @@ class TransportLayerClient(object):
)
)
@log_function
@log_function
def
remove_user_from_group
(
self
,
destination
,
group_id
,
user_id
,
content
):
def
remove_user_from_group
(
self
,
destination
,
group_id
,
requester_user_id
,
user_id
,
content
):
path
=
PREFIX
+
"
/groups/%s/users/%s/remove
"
%
(
group_id
,
user_id
)
path
=
PREFIX
+
"
/groups/%s/users/%s/remove
"
%
(
group_id
,
user_id
)
return
self
.
client
.
post_json
(
return
self
.
client
.
post_json
(
destination
=
destination
,
destination
=
destination
,
path
=
path
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
data
=
content
,
data
=
content
,
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
...
@@ -594,3 +609,166 @@ class TransportLayerClient(object):
...
@@ -594,3 +609,166 @@ class TransportLayerClient(object):
data
=
content
,
data
=
content
,
ignore_backoff
=
True
,
ignore_backoff
=
True
,
)
)
@log_function
def
update_group_summary_room
(
self
,
destination
,
group_id
,
user_id
,
room_id
,
category_id
,
content
):
if
category_id
:
path
=
PREFIX
+
"
/groups/%s/summary/categories/%s/rooms/%s
"
%
(
group_id
,
category_id
,
room_id
,
)
else
:
path
=
PREFIX
+
"
/groups/%s/summary/rooms/%s
"
%
(
group_id
,
room_id
,)
return
self
.
client
.
post_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
user_id
},
data
=
content
,
ignore_backoff
=
True
,
)
@log_function
def
delete_group_summary_room
(
self
,
destination
,
group_id
,
user_id
,
room_id
,
category_id
):
if
category_id
:
path
=
PREFIX
+
"
/groups/%s/summary/categories/%s/rooms/%s
"
%
(
group_id
,
category_id
,
room_id
,
)
else
:
path
=
PREFIX
+
"
/groups/%s/summary/rooms/%s
"
%
(
group_id
,
room_id
,)
return
self
.
client
.
delete_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
user_id
},
ignore_backoff
=
True
,
)
@log_function
def
get_group_categories
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/categories
"
%
(
group_id
,)
return
self
.
client
.
get_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
get_group_category
(
self
,
destination
,
group_id
,
requester_user_id
,
category_id
):
path
=
PREFIX
+
"
/groups/%s/categories/%s
"
%
(
group_id
,
category_id
,)
return
self
.
client
.
get_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
update_group_category
(
self
,
destination
,
group_id
,
requester_user_id
,
category_id
,
content
):
path
=
PREFIX
+
"
/groups/%s/categories/%s
"
%
(
group_id
,
category_id
,)
return
self
.
client
.
post_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
data
=
content
,
ignore_backoff
=
True
,
)
@log_function
def
delete_group_category
(
self
,
destination
,
group_id
,
requester_user_id
,
category_id
):
path
=
PREFIX
+
"
/groups/%s/categories/%s
"
%
(
group_id
,
category_id
,)
return
self
.
client
.
delete_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
get_group_roles
(
self
,
destination
,
group_id
,
requester_user_id
):
path
=
PREFIX
+
"
/groups/%s/roles
"
%
(
group_id
,)
return
self
.
client
.
get_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
get_group_role
(
self
,
destination
,
group_id
,
requester_user_id
,
role_id
):
path
=
PREFIX
+
"
/groups/%s/roles/%s
"
%
(
group_id
,
role_id
,)
return
self
.
client
.
get_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
update_group_role
(
self
,
destination
,
group_id
,
requester_user_id
,
role_id
,
content
):
path
=
PREFIX
+
"
/groups/%s/roles/%s
"
%
(
group_id
,
role_id
,)
return
self
.
client
.
post_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
data
=
content
,
ignore_backoff
=
True
,
)
@log_function
def
delete_group_role
(
self
,
destination
,
group_id
,
requester_user_id
,
role_id
):
path
=
PREFIX
+
"
/groups/%s/roles/%s
"
%
(
group_id
,
role_id
,)
return
self
.
client
.
delete_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
@log_function
def
update_group_summary_user
(
self
,
destination
,
group_id
,
requester_user_id
,
user_id
,
role_id
,
content
):
if
role_id
:
path
=
PREFIX
+
"
/groups/%s/summary/roles/%s/users/%s
"
%
(
group_id
,
role_id
,
user_id
,
)
else
:
path
=
PREFIX
+
"
/groups/%s/summary/users/%s
"
%
(
group_id
,
user_id
,)
return
self
.
client
.
post_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
data
=
content
,
ignore_backoff
=
True
,
)
@log_function
def
delete_group_summary_user
(
self
,
destination
,
group_id
,
requester_user_id
,
user_id
,
role_id
):
if
role_id
:
path
=
PREFIX
+
"
/groups/%s/summary/roles/%s/users/%s
"
%
(
group_id
,
role_id
,
user_id
,
)
else
:
path
=
PREFIX
+
"
/groups/%s/summary/users/%s
"
%
(
group_id
,
user_id
,)
return
self
.
client
.
delete_json
(
destination
=
destination
,
path
=
path
,
args
=
{
"
requester_user_id
"
:
requester_user_id
},
ignore_backoff
=
True
,
)
This diff is collapsed.
Click to expand it.
synapse/handlers/groups_local.py
+
1
−
1
View file @
e5ea6dd0
...
@@ -224,7 +224,7 @@ class GroupsLocalHandler(object):
...
@@ -224,7 +224,7 @@ class GroupsLocalHandler(object):
)
)
else
:
else
:
res
=
yield
self
.
transport_client
.
invite_to_group
(
res
=
yield
self
.
transport_client
.
invite_to_group
(
group_id
,
user_id
,
content
,
group_id
,
user_id
,
requester_user_id
,
content
,
)
)
defer
.
returnValue
(
res
)
defer
.
returnValue
(
res
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment