This commit is contained in:
babolivier 2021-06-18 14:56:12 +00:00
parent 3c7fd98b40
commit d4892a68c1
4 changed files with 18 additions and 18 deletions

View file

@ -253,32 +253,32 @@ module API's <code>register_spam_checker_callbacks</code> method. The callback f
to <code>register_spam_checker_callbacks</code> as keyword arguments, with the callback name as the to <code>register_spam_checker_callbacks</code> as keyword arguments, with the callback name as the
argument name and the function as its value. This is demonstrated in the example below.</p> argument name and the function as its value. This is demonstrated in the example below.</p>
<p>The available spam checker callbacks are:</p> <p>The available spam checker callbacks are:</p>
<pre><code class="language-python">def check_event_for_spam(event: &quot;synapse.events.EventBase&quot;) -&gt; Union[bool, str] <pre><code class="language-python">async def check_event_for_spam(event: &quot;synapse.events.EventBase&quot;) -&gt; Union[bool, str]
</code></pre> </code></pre>
<p>Called when receiving an event from a client or via federation. The module can return <p>Called when receiving an event from a client or via federation. The module can return
either a <code>bool</code> to indicate whether the event must be rejected because of spam, or a <code>str</code> either a <code>bool</code> to indicate whether the event must be rejected because of spam, or a <code>str</code>
to indicate the event must be rejected because of spam and to give a rejection reason to to indicate the event must be rejected because of spam and to give a rejection reason to
forward to clients.</p> forward to clients.</p>
<pre><code class="language-python">def user_may_invite(inviter: str, invitee: str, room_id: str) -&gt; bool <pre><code class="language-python">async def user_may_invite(inviter: str, invitee: str, room_id: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when processing an invitation. The module must return a <code>bool</code> indicating whether <p>Called when processing an invitation. The module must return a <code>bool</code> indicating whether
the inviter can invite the invitee to the given room. Both inviter and invitee are the inviter can invite the invitee to the given room. Both inviter and invitee are
represented by their Matrix user ID (i.e. <code>@alice:example.com</code>).</p> represented by their Matrix user ID (i.e. <code>@alice:example.com</code>).</p>
<pre><code class="language-python">def user_may_create_room(user: str) -&gt; bool <pre><code class="language-python">async def user_may_create_room(user: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when processing a room creation request. The module must return a <code>bool</code> indicating <p>Called when processing a room creation request. The module must return a <code>bool</code> indicating
whether the given user (represented by their Matrix user ID) is allowed to create a room.</p> whether the given user (represented by their Matrix user ID) is allowed to create a room.</p>
<pre><code class="language-python">def user_may_create_room_alias(user: str, room_alias: &quot;synapse.types.RoomAlias&quot;) -&gt; bool <pre><code class="language-python">async def user_may_create_room_alias(user: str, room_alias: &quot;synapse.types.RoomAlias&quot;) -&gt; bool
</code></pre> </code></pre>
<p>Called when trying to associate an alias with an existing room. The module must return a <p>Called when trying to associate an alias with an existing room. The module must return a
<code>bool</code> indicating whether the given user (represented by their Matrix user ID) is allowed <code>bool</code> indicating whether the given user (represented by their Matrix user ID) is allowed
to set the given alias.</p> to set the given alias.</p>
<pre><code class="language-python">def user_may_publish_room(user: str, room_id: str) -&gt; bool <pre><code class="language-python">async def user_may_publish_room(user: str, room_id: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when trying to publish a room to the homeserver's public rooms directory. The <p>Called when trying to publish a room to the homeserver's public rooms directory. The
module must return a <code>bool</code> indicating whether the given user (represented by their module must return a <code>bool</code> indicating whether the given user (represented by their
Matrix user ID) is allowed to publish the given room.</p> Matrix user ID) is allowed to publish the given room.</p>
<pre><code class="language-python">def check_username_for_spam(user_profile: Dict[str, str]) -&gt; bool <pre><code class="language-python">async def check_username_for_spam(user_profile: Dict[str, str]) -&gt; bool
</code></pre> </code></pre>
<p>Called when computing search results in the user directory. The module must return a <p>Called when computing search results in the user directory. The module must return a
<code>bool</code> indicating whether the given user profile can appear in search results. The profile <code>bool</code> indicating whether the given user profile can appear in search results. The profile
@ -290,7 +290,7 @@ is represented as a dictionary with the following keys:</p>
</ul> </ul>
<p>The module is given a copy of the original dictionary, so modifying it from within the <p>The module is given a copy of the original dictionary, so modifying it from within the
module cannot modify a user's profile when included in user directory search results.</p> module cannot modify a user's profile when included in user directory search results.</p>
<pre><code class="language-python">def check_registration_for_spam( <pre><code class="language-python">async def check_registration_for_spam(
email_threepid: Optional[dict], email_threepid: Optional[dict],
username: Optional[str], username: Optional[str],
request_info: Collection[Tuple[str, str]], request_info: Collection[Tuple[str, str]],
@ -310,7 +310,7 @@ second item is an IP address. These user agents and IP addresses are the ones th
used during the registration process.</li> used during the registration process.</li>
<li><code>auth_provider_id</code>: The identifier of the SSO authentication provider, if any.</li> <li><code>auth_provider_id</code>: The identifier of the SSO authentication provider, if any.</li>
</ul> </ul>
<pre><code class="language-python">def check_media_file_for_spam( <pre><code class="language-python">async def check_media_file_for_spam(
file_wrapper: &quot;synapse.rest.media.v1.media_storage.ReadableFileWrapper&quot;, file_wrapper: &quot;synapse.rest.media.v1.media_storage.ReadableFileWrapper&quot;,
file_info: &quot;synapse.rest.media.v1._base.FileInfo&quot; file_info: &quot;synapse.rest.media.v1._base.FileInfo&quot;
) -&gt; bool ) -&gt; bool

View file

@ -7255,32 +7255,32 @@ module API's <code>register_spam_checker_callbacks</code> method. The callback f
to <code>register_spam_checker_callbacks</code> as keyword arguments, with the callback name as the to <code>register_spam_checker_callbacks</code> as keyword arguments, with the callback name as the
argument name and the function as its value. This is demonstrated in the example below.</p> argument name and the function as its value. This is demonstrated in the example below.</p>
<p>The available spam checker callbacks are:</p> <p>The available spam checker callbacks are:</p>
<pre><code class="language-python">def check_event_for_spam(event: &quot;synapse.events.EventBase&quot;) -&gt; Union[bool, str] <pre><code class="language-python">async def check_event_for_spam(event: &quot;synapse.events.EventBase&quot;) -&gt; Union[bool, str]
</code></pre> </code></pre>
<p>Called when receiving an event from a client or via federation. The module can return <p>Called when receiving an event from a client or via federation. The module can return
either a <code>bool</code> to indicate whether the event must be rejected because of spam, or a <code>str</code> either a <code>bool</code> to indicate whether the event must be rejected because of spam, or a <code>str</code>
to indicate the event must be rejected because of spam and to give a rejection reason to to indicate the event must be rejected because of spam and to give a rejection reason to
forward to clients.</p> forward to clients.</p>
<pre><code class="language-python">def user_may_invite(inviter: str, invitee: str, room_id: str) -&gt; bool <pre><code class="language-python">async def user_may_invite(inviter: str, invitee: str, room_id: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when processing an invitation. The module must return a <code>bool</code> indicating whether <p>Called when processing an invitation. The module must return a <code>bool</code> indicating whether
the inviter can invite the invitee to the given room. Both inviter and invitee are the inviter can invite the invitee to the given room. Both inviter and invitee are
represented by their Matrix user ID (i.e. <code>@alice:example.com</code>).</p> represented by their Matrix user ID (i.e. <code>@alice:example.com</code>).</p>
<pre><code class="language-python">def user_may_create_room(user: str) -&gt; bool <pre><code class="language-python">async def user_may_create_room(user: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when processing a room creation request. The module must return a <code>bool</code> indicating <p>Called when processing a room creation request. The module must return a <code>bool</code> indicating
whether the given user (represented by their Matrix user ID) is allowed to create a room.</p> whether the given user (represented by their Matrix user ID) is allowed to create a room.</p>
<pre><code class="language-python">def user_may_create_room_alias(user: str, room_alias: &quot;synapse.types.RoomAlias&quot;) -&gt; bool <pre><code class="language-python">async def user_may_create_room_alias(user: str, room_alias: &quot;synapse.types.RoomAlias&quot;) -&gt; bool
</code></pre> </code></pre>
<p>Called when trying to associate an alias with an existing room. The module must return a <p>Called when trying to associate an alias with an existing room. The module must return a
<code>bool</code> indicating whether the given user (represented by their Matrix user ID) is allowed <code>bool</code> indicating whether the given user (represented by their Matrix user ID) is allowed
to set the given alias.</p> to set the given alias.</p>
<pre><code class="language-python">def user_may_publish_room(user: str, room_id: str) -&gt; bool <pre><code class="language-python">async def user_may_publish_room(user: str, room_id: str) -&gt; bool
</code></pre> </code></pre>
<p>Called when trying to publish a room to the homeserver's public rooms directory. The <p>Called when trying to publish a room to the homeserver's public rooms directory. The
module must return a <code>bool</code> indicating whether the given user (represented by their module must return a <code>bool</code> indicating whether the given user (represented by their
Matrix user ID) is allowed to publish the given room.</p> Matrix user ID) is allowed to publish the given room.</p>
<pre><code class="language-python">def check_username_for_spam(user_profile: Dict[str, str]) -&gt; bool <pre><code class="language-python">async def check_username_for_spam(user_profile: Dict[str, str]) -&gt; bool
</code></pre> </code></pre>
<p>Called when computing search results in the user directory. The module must return a <p>Called when computing search results in the user directory. The module must return a
<code>bool</code> indicating whether the given user profile can appear in search results. The profile <code>bool</code> indicating whether the given user profile can appear in search results. The profile
@ -7292,7 +7292,7 @@ is represented as a dictionary with the following keys:</p>
</ul> </ul>
<p>The module is given a copy of the original dictionary, so modifying it from within the <p>The module is given a copy of the original dictionary, so modifying it from within the
module cannot modify a user's profile when included in user directory search results.</p> module cannot modify a user's profile when included in user directory search results.</p>
<pre><code class="language-python">def check_registration_for_spam( <pre><code class="language-python">async def check_registration_for_spam(
email_threepid: Optional[dict], email_threepid: Optional[dict],
username: Optional[str], username: Optional[str],
request_info: Collection[Tuple[str, str]], request_info: Collection[Tuple[str, str]],
@ -7312,7 +7312,7 @@ second item is an IP address. These user agents and IP addresses are the ones th
used during the registration process.</li> used during the registration process.</li>
<li><code>auth_provider_id</code>: The identifier of the SSO authentication provider, if any.</li> <li><code>auth_provider_id</code>: The identifier of the SSO authentication provider, if any.</li>
</ul> </ul>
<pre><code class="language-python">def check_media_file_for_spam( <pre><code class="language-python">async def check_media_file_for_spam(
file_wrapper: &quot;synapse.rest.media.v1.media_storage.ReadableFileWrapper&quot;, file_wrapper: &quot;synapse.rest.media.v1.media_storage.ReadableFileWrapper&quot;,
file_info: &quot;synapse.rest.media.v1._base.FileInfo&quot; file_info: &quot;synapse.rest.media.v1._base.FileInfo&quot;
) -&gt; bool ) -&gt; bool

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long