@@ -51,7 +51,15 @@ class Collection(Iterable[T_co], Container[T_co], Sized): # type: ignore
51
51
52
52
class Requester (
53
53
namedtuple (
54
- "Requester" , ["user" , "access_token_id" , "is_guest" , "device_id" , "app_service" ]
54
+ "Requester" ,
55
+ [
56
+ "user" ,
57
+ "access_token_id" ,
58
+ "is_guest" ,
59
+ "shadow_banned" ,
60
+ "device_id" ,
61
+ "app_service" ,
62
+ ],
55
63
)
56
64
):
57
65
"""
@@ -62,6 +70,7 @@ class Requester(
62
70
access_token_id (int|None): *ID* of the access token used for this
63
71
request, or None if it came via the appservice API or similar
64
72
is_guest (bool): True if the user making this request is a guest user
73
+ shadow_banned (bool): True if the user making this request has been shadow-banned.
65
74
device_id (str|None): device_id which was set at authentication time
66
75
app_service (ApplicationService|None): the AS requesting on behalf of the user
67
76
"""
@@ -77,6 +86,7 @@ def serialize(self):
77
86
"user_id" : self .user .to_string (),
78
87
"access_token_id" : self .access_token_id ,
79
88
"is_guest" : self .is_guest ,
89
+ "shadow_banned" : self .shadow_banned ,
80
90
"device_id" : self .device_id ,
81
91
"app_server_id" : self .app_service .id if self .app_service else None ,
82
92
}
@@ -101,13 +111,19 @@ def deserialize(store, input):
101
111
user = UserID .from_string (input ["user_id" ]),
102
112
access_token_id = input ["access_token_id" ],
103
113
is_guest = input ["is_guest" ],
114
+ shadow_banned = input ["shadow_banned" ],
104
115
device_id = input ["device_id" ],
105
116
app_service = appservice ,
106
117
)
107
118
108
119
109
120
def create_requester (
110
- user_id , access_token_id = None , is_guest = False , device_id = None , app_service = None
121
+ user_id ,
122
+ access_token_id = None ,
123
+ is_guest = False ,
124
+ shadow_banned = False ,
125
+ device_id = None ,
126
+ app_service = None ,
111
127
):
112
128
"""
113
129
Create a new ``Requester`` object
@@ -117,6 +133,7 @@ def create_requester(
117
133
access_token_id (int|None): *ID* of the access token used for this
118
134
request, or None if it came via the appservice API or similar
119
135
is_guest (bool): True if the user making this request is a guest user
136
+ shadow_banned (bool): True if the user making this request is shadow-banned.
120
137
device_id (str|None): device_id which was set at authentication time
121
138
app_service (ApplicationService|None): the AS requesting on behalf of the user
122
139
@@ -125,7 +142,9 @@ def create_requester(
125
142
"""
126
143
if not isinstance (user_id , UserID ):
127
144
user_id = UserID .from_string (user_id )
128
- return Requester (user_id , access_token_id , is_guest , device_id , app_service )
145
+ return Requester (
146
+ user_id , access_token_id , is_guest , shadow_banned , device_id , app_service
147
+ )
129
148
130
149
131
150
def get_domain_from_id (string ):
0 commit comments