@@ -894,12 +894,16 @@ paths:
894
894
/user/{sessionId}/moderator :
895
895
post :
896
896
tags : [Users]
897
- summary : Adds or removes moderator powers.
897
+ summary : Adds or removes moderator/admin powers.
898
898
description : >
899
899
Adds or removes moderator or admin permissions to a user for specific rooms, or globally on
900
900
the server.
901
901
902
902
903
+ The invoking user must have admin permissions in all of the rooms specified when adding room
904
+ mods/admins, and must have global admin permissions when adding a global moderator or admin.
905
+
906
+
903
907
Note that the given session ID does not have to exist: it is possible to grant moderator
904
908
permissions preemptively for a session ID that has never visited the server or room(s).
905
909
parameters :
@@ -922,22 +926,37 @@ paths:
922
926
invoking user must be an admin of all of the given rooms.
923
927
924
928
925
- Exclusive of `global`.
929
+ This may be set to the single-element list ['*'] to add or remove the moderator
930
+ from all rooms in which the current user has admin permissions (the call will
931
+ succeed if the calling user is an admin in at least one channel).
932
+
933
+
934
+ Exclusive of `global`. (If you want to apply both at once use two calls, e.g.
935
+ bundled in a batch request).
926
936
global :
927
937
type : boolean
928
938
description : >
929
- If true then appoint this user as a moderator or admin of the global server.
930
- The user will receive moderator/admin ability in all rooms on the server.
931
-
939
+ If true then appoint this user as a global moderator or admin of the server.
940
+ The user will receive moderator/admin ability in all rooms on the server (both
941
+ current and future).
942
+
943
+
944
+ The caller must be a global admin to add/remove a global moderator or admin.
932
945
moderator :
933
946
type : boolean
934
947
description : >
935
948
If `true` then this user will be granted moderator permission to either the
936
- listed room or the server globally.
949
+ listed room(s) or the server globally.
950
+
951
+
952
+ If `false` then this user will have their moderator *and admin* permissions
953
+ removed from the given rooms (or server). Note that removing a global moderator
954
+ only removes the global permission but does not remove individual room
955
+ moderator permissions that may also be present.
937
956
938
957
939
- If `false` then this user will have their moderator and admin permissions
940
- removed from the given rooms (or server) .
958
+ See the `admin` parameter description for information on how ` admin` and
959
+ `moderator` parameters interact .
941
960
admin :
942
961
type : boolean
943
962
description : >
@@ -947,53 +966,87 @@ paths:
947
966
pinned messages, and changing the name/description of the room.
948
967
949
968
950
- If false then this user will have their admin permission removed, but will
951
- remain a moderator (if they were previously a moderator or admin). To remove
952
- both moderator and admin status you can specify simply `moderator: false` rather
953
- than needing to specify both values as false.
969
+ If false then this user will have their admin permission removed, but will keep
970
+ moderator permissions. To remove both moderator and admin permissions specify
971
+ `moderator: false` (which implies clearing admin permissions as well).
972
+
973
+
974
+ Note that removing a global admin only removes the global permission but does not remove
975
+ individual room admin permissions that may also be present.
976
+
977
+
978
+ The `admin`/`moderator` paramters interact as follows:
979
+ - `admin=true`, `moderator` omitted: this adds admin permissions, which
980
+ automatically also implies moderator permissions.
981
+ - `admin=true, moderator=true`: exactly the same as above.
982
+ - `admin=false, moderator=true`: removes any existing admin permissions from the
983
+ rooms (or globally), if present, and adds moderator permissions to the
984
+ rooms/globally (if not already present).
985
+ - `admin=false`, `moderator` omitted: this removes admin permissions but leaves
986
+ moderator permissions, if present. (This effectively "downgrades" an admin to
987
+ a moderator). Unlike the above this does *not* add moderator permissions to
988
+ matching rooms if not already present.
989
+ - `moderator=true`, `admin` omitted: adds moderator permissions to the given
990
+ rooms (or globally), if not already present. If the user already has admin
991
+ permissions this does nothing (that is, admin permission is *not* removed,
992
+ unlike the above).
993
+ - `moderator=false`, `admin` omitted: this removes moderator *and* admin
994
+ permissions from all given rooms (or globally).
995
+ - `moderator=false, admin=false`: exactly the same as above.
996
+ - `moderator=false, admin=true`: this combination is *not* *permitted* (because
997
+ admin permissions imply moderator permissions) and will result in Bad Request
998
+ error if given.
954
999
visible :
955
1000
type : boolean
956
1001
description : >
957
- Whether this user should be a "visible" moderator in the server rooms. Visible
958
- moderators are identified to all room users (e.g. via a special status badge in
959
- Session clients).
1002
+ Whether this user should be a "visible" moderator or admin in the specified
1003
+ rooms (or globally). Visible moderators are identified to all room users (e.g.
1004
+ via a special status badge in Session clients).
960
1005
961
1006
962
1007
Invisible moderators/admins have the same permission as as visible ones, but
963
- their moderator/admin status is only visible to other moderators but not to
1008
+ their moderator/admin status is only visible to other moderators, not to
964
1009
ordinary room participants.
965
1010
966
1011
967
1012
The default if this field is omitted is true for room-specific moderators/admins
968
1013
and false for server-level global moderators/admins.
1014
+
1015
+
1016
+ If an admin or moderator has both global and room-specific moderation
1017
+ permissions then the visibility of the admin/mod for that room's moderator/admin
1018
+ list will use the room-specific visibility value, regardless of the global
1019
+ setting. (This differs from moderator/admin permissions themselves, which are
1020
+ additive).
969
1021
examples :
970
- tworooms :
971
- summary : " 1-day mute in two rooms"
1022
+ room-moderator :
1023
+ summary : " Add a moderator to a pair of rooms"
972
1024
value :
973
1025
rooms : ["session", "lokinet"]
974
- timeout : 86400
975
- write : false
976
- allow-uploads :
977
- summary : " Allow file attachments for 1 week"
1026
+ moderator : true
1027
+ global-admin :
1028
+ summary : " Add a global server admin, visible in all rooms"
978
1029
value :
979
- rooms : ["session-help"]
980
- upload : true
981
- timeout : 604800
982
- secretroom :
983
- summary : " Grant access to a restricted room"
1030
+ global : true
1031
+ admin : true
1032
+ visible : true
1033
+ hidden-mod :
1034
+ summary : " Add a hidden admin to a room"
984
1035
value :
985
- rooms : ["top-secret"]
986
- read : true
987
- write : true
988
- upload : true
1036
+ rooms : ["session"]
1037
+ admin : true
1038
+ visible : false
989
1039
responses :
990
1040
200 :
991
1041
description : Permission update applied successfully.
992
1042
content : {}
993
1043
403 :
994
1044
description : >
995
- Permission denied. The user attempting to set the permissions does not have moderator
996
- permissions for one or more of the given rooms.
1045
+ Permission denied. The user attempting to set the permissions does not have admin
1046
+ permissions for one or more of the given rooms and/or global admin permissions.
1047
+ content : {}
1048
+ 404 :
1049
+ description : Returned if one or more specified room tokens do not exist.
997
1050
content : {}
998
1051
/user/{sessionId}/deleteMessages :
999
1052
post :
0 commit comments