Allow denying or shadow banning registrations via the spam checker (#8034)

This commit is contained in:
Patrick Cloke 2020-08-20 15:42:58 -04:00 committed by GitHub
parent e259d63f73
commit 3f91638da6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 258 additions and 18 deletions

View file

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from enum import Enum
from twisted.internet import defer
@ -25,6 +26,16 @@ if MYPY:
logger = logging.getLogger(__name__)
class RegistrationBehaviour(Enum):
"""
Enum to define whether a registration request should allowed, denied, or shadow-banned.
"""
ALLOW = "allow"
SHADOW_BAN = "shadow_ban"
DENY = "deny"
class SpamCheckerApi(object):
"""A proxy object that gets passed to spam checkers so they can get
access to rooms and other relevant information.