Skip to content

Commit c4bfd2f

Browse files
tcpipukclokepJohennesrichvdh
authored
Spec for MSC4133: Update profile endpoints to support extended fields (#2071)
Signed-off-by: Tom Foster <[email protected]> Signed-off-by: Johannes Marbach <[email protected]> Co-authored-by: Patrick Cloke <[email protected]> Co-authored-by: Johannes Marbach <[email protected]> Co-authored-by: Richard van der Hoff <[email protected]>
1 parent 04f42ac commit c4bfd2f

File tree

6 files changed

+310
-135
lines changed

6 files changed

+310
-135
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Deprecate `m.set_avatar_url` and `m.set_displayname` capabilities, as per [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133).
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update user profile endpoints to handle custom fields, and add a new `m.profile_fields` capability,as per [MSC4133](https://github.com/matrix-org/matrix-spec-proposals/pull/4133).

content/client-server-api/_index.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,8 +2491,66 @@ using an `unstable` version.
24912491
When this capability is not listed, clients should use `"1"` as the
24922492
default and only stable `available` room version.
24932493

2494+
### `m.profile_fields` capability
2495+
2496+
{{% added-in v="1.16" %}}
2497+
2498+
This capability defines which [profile](#profiles) fields the user is
2499+
able to change.
2500+
2501+
The capability value has a required flag, `enabled`, and two optional lists, `allowed` and
2502+
`disallowed`.
2503+
2504+
When `enabled` is `false`, all profile fields are managed by the server
2505+
and the client is not permitted to make any changes.
2506+
2507+
When `enabled` is `true`, clients are permitted to modify profile fields,
2508+
subject to the restrictions implied by the OPTIONAL lists `allowed` and
2509+
`disallowed`.
2510+
2511+
If `allowed` is present, clients can modify only the fields
2512+
listed. They SHOULD assume all other fields to be managed by
2513+
the server. In this case, `disallowed` has no meaning and should be ignored.
2514+
2515+
If `disallowed` is present (and `allowed` is not), clients SHOULD assume
2516+
that the listed fields are managed by the server. Clients may modify any
2517+
fields that are *not* listed, provided `enabled` is `true`.
2518+
2519+
If neither `allowed` nor `disallowed` is present, clients can modify all fields
2520+
without restrictions, provided `enabled` is `true`.
2521+
2522+
When this capability is not listed, clients SHOULD assume the user is able to change
2523+
profile fields without any restrictions, provided the homeserver
2524+
advertises a specification version that includes the `m.profile_fields`
2525+
capability in the [`/versions`](/client-server-api/#get_matrixclientversions)
2526+
response.
2527+
2528+
An example of the capability API's response for this capability is:
2529+
2530+
```json
2531+
{
2532+
"capabilities": {
2533+
"m.profile_fields": {
2534+
"enabled": true,
2535+
"disallowed": ["displayname"]
2536+
}
2537+
}
2538+
}
2539+
```
2540+
24942541
### `m.set_displayname` capability
24952542

2543+
{{% boxes/note %}}
2544+
{{% changed-in v="1.16" %}}
2545+
This capability is now deprecated. Clients SHOULD use the
2546+
[`m.profile_fields`](/client-server-api/#mprofile_fields-capability)
2547+
capability instead.
2548+
2549+
For backwards compatibility, servers that forbid setting the
2550+
`displayname` profile field in the `m.profile_fields` capability
2551+
MUST still present this capability with `"enabled": false`.
2552+
{{% /boxes/note %}}
2553+
24962554
This capability has a single flag, `enabled`, to denote whether the user
24972555
is able to change their own display name via profile endpoints. Cases for
24982556
disabling might include users mapped from external identity/directory
@@ -2517,6 +2575,17 @@ An example of the capability API's response for this capability is:
25172575

25182576
### `m.set_avatar_url` capability
25192577

2578+
{{% boxes/note %}}
2579+
{{% changed-in v="1.16" %}}
2580+
This capability is now deprecated. Clients SHOULD use the
2581+
[`m.profile_fields`](/client-server-api/#mprofile_fields-capability)
2582+
capability instead.
2583+
2584+
For backwards compatibility, servers that forbid setting the
2585+
`avatar_url` profile field in the `m.profile_fields` capability
2586+
MUST still present this capability with `"enabled": false`.
2587+
{{% /boxes/note %}}
2588+
25202589
This capability has a single flag, `enabled`, to denote whether the user
25212590
is able to change their own avatar via profile endpoints. Cases for
25222591
disabling might include users mapped from external identity/directory

content/client-server-api/modules/guest_access.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ for sending events:
6363
The following API endpoints are allowed to be accessed by guest accounts
6464
for their own account maintenance:
6565

66-
* [PUT /profile/{userId}/displayname](#put_matrixclientv3profileuseriddisplayname)
66+
* [PUT /profile/{userId}/displayname](#put_matrixclientv3profileuseridkeyname). Guest users may only modify their display name; other profile fields may not be changed.
67+
* {{% added-in v="1.16" %}} [DELETE /profile/{userId}/displayname](#delete_matrixclientv3profileuseridkeyname). Again, guest users may delete their display name but not other profile fields.
6768
* [GET /devices](#get_matrixclientv3devices)
6869
* [GET /devices/{deviceId}](#get_matrixclientv3devicesdeviceid)
6970
* [PUT /devices/{deviceId}](#put_matrixclientv3devicesdeviceid)

data/api/client-server/capabilities.yaml

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,25 @@ paths:
7373
- default
7474
- available
7575
m.set_displayname:
76+
deprecated: true
7677
$ref: '#/components/schemas/booleanCapability'
77-
description: Capability to indicate if the user can change their display name.
78+
description: |
79+
**Deprecated:** Capability to indicate if the user can change their display name.
80+
Refer to `m.profile_fields` for extended profile management.
81+
82+
For backwards compatibility, servers that directly or indirectly include the
83+
`displayname` profile field in the `m.profile_fields` capability MUST also
84+
set this capability accordingly.
7885
m.set_avatar_url:
86+
deprecated: true
7987
$ref: '#/components/schemas/booleanCapability'
80-
description: Capability to indicate if the user can change their avatar.
88+
description: |
89+
**Deprecated:** Capability to indicate if the user can change their avatar.
90+
Refer to `m.profile_fields` for extended profile management.
91+
92+
For backwards compatibility, servers that directly or indirectly include the
93+
`avatar_url` profile field in the `m.profile_fields` capability MUST also
94+
set this capability accordingly.
8195
m.3pid_changes:
8296
$ref: '#/components/schemas/booleanCapability'
8397
description: Capability to indicate if the user can change 3PID associations
@@ -86,6 +100,47 @@ paths:
86100
$ref: '#/components/schemas/booleanCapability'
87101
description: Capability to indicate if the user can generate tokens to log further
88102
clients into their account.
103+
m.profile_fields:
104+
x-addedInMatrixVersion: "1.16"
105+
type: object
106+
title: ProfileFieldsCapability
107+
description: Capability to indicate if the user can set or modify extended profile fields via
108+
[`PUT /_matrix/client/v3/profile/{userId}/{keyName}`](/client-server-api/#put_matrixclientv3profileuseridkeyname).
109+
If absent, clients SHOULD assume custom profile fields are supported, provided the
110+
homeserver advertises a specification version that includes `m.profile_fields` in the
111+
[`/versions`](/client-server-api/#get_matrixclientversions) response.
112+
properties:
113+
allowed:
114+
type: array
115+
description: |
116+
If present, a list of profile fields that clients are allowed to create, modify or delete,
117+
provided `enabled` is `true`; no other profile fields may be changed.
118+
119+
If absent, clients may set all profile fields except those forbidden by the `disallowed`
120+
list, where present.
121+
items:
122+
type: string
123+
example:
124+
- "m.example_field"
125+
- "org.example.job_title"
126+
disallowed:
127+
type: array
128+
description: |
129+
This property has no meaning if `allowed` is also specified.
130+
131+
Otherwise, if present, a list of profile fields that clients are _not_ allowed to create, modify or delete.
132+
Provided `enabled` is `true`, clients MAY assume that they can set any profile field which is not
133+
included in this list.
134+
items:
135+
type: string
136+
example:
137+
- "org.example.managed_field"
138+
enabled:
139+
type: boolean
140+
description: "`true` if the user can create, update or delete any profile fields, `false` otherwise."
141+
example: true
142+
required:
143+
- enabled
89144
examples:
90145
response:
91146
value: {

0 commit comments

Comments
 (0)