diff --git a/litecord/admin_schemas.py b/litecord/admin_schemas.py
index 18d0e50..8f2a001 100644
--- a/litecord/admin_schemas.py
+++ b/litecord/admin_schemas.py
@@ -40,3 +40,9 @@ FEATURES = {
'schema': {'coerce': lambda x: Feature(x)}
}
}
+
+USER_CREATE = {
+ 'username': {'type': 'username', 'required': True},
+ 'email': {'type': 'email', 'required': True},
+ 'password': {'type': 'string', 'minlength': 5, 'required': True},
+}
diff --git a/litecord/blueprints/admin_api/__init__.py b/litecord/blueprints/admin_api/__init__.py
index 32710ce..d27cc52 100644
--- a/litecord/blueprints/admin_api/__init__.py
+++ b/litecord/blueprints/admin_api/__init__.py
@@ -20,5 +20,7 @@ along with this program. If not, see .
from .voice import bp as voice
from .features import bp as features
from .guilds import bp as guilds
+from .users import bp as users
+from .instance_invites import bp as instance_invites
-__all__ = ['voice', 'features', 'guilds']
+__all__ = ['voice', 'features', 'guilds', 'users', 'instance_invites']
diff --git a/litecord/blueprints/admin_api/instance_invites.py b/litecord/blueprints/admin_api/instance_invites.py
new file mode 100644
index 0000000..70c6106
--- /dev/null
+++ b/litecord/blueprints/admin_api/instance_invites.py
@@ -0,0 +1,36 @@
+"""
+
+Litecord
+Copyright (C) 2018-2019 Luna Mendes
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+
+"""
+
+from quart import Blueprint, jsonify, current_app as app
+
+from litecord.auth import admin_check
+
+bp = Blueprint('instance_invites', __name__)
+
+
+@bp.route('', methods=['GET'])
+async def _all_instance_invites():
+ await admin_check()
+
+ rows = await app.db.fetch("""
+ SELECT code, created_at, uses, max_uses
+ FROM instance_invites
+ """)
+
+ return jsonify([dict(row) for row in rows])
diff --git a/litecord/blueprints/admin_api/users.py b/litecord/blueprints/admin_api/users.py
new file mode 100644
index 0000000..67690c8
--- /dev/null
+++ b/litecord/blueprints/admin_api/users.py
@@ -0,0 +1,40 @@
+"""
+
+Litecord
+Copyright (C) 2018-2019 Luna Mendes
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+
+"""
+
+from quart import Blueprint, jsonify, current_app as app, request
+
+from litecord.auth import admin_check
+from litecord.blueprints.auth import create_user
+from litecord.schemas import validate
+from litecord.admin_schemas import USER_CREATE
+
+bp = Blueprint('users_admin', __name__)
+
+@bp.route('', methods=['POST'])
+async def _create_user():
+ await admin_check()
+
+ j = validate(await request.get_json(), USER_CREATE)
+
+ user_id = await create_user(j['username'], j['email'], j['password'])
+
+ return jsonify(
+ await app.storage.get_user(user_id)
+ )
+
diff --git a/manage/cmd/migration/__init__.py b/manage/cmd/migration/__init__.py
index e2363a2..d685676 100644
--- a/manage/cmd/migration/__init__.py
+++ b/manage/cmd/migration/__init__.py
@@ -18,3 +18,5 @@ along with this program. If not, see .
"""
from .command import setup as migration
+
+__all__ = ['migration']
diff --git a/manage/cmd/users.py b/manage/cmd/users.py
index 1516673..4d37757 100644
--- a/manage/cmd/users.py
+++ b/manage/cmd/users.py
@@ -17,9 +17,6 @@ along with this program. If not, see .
"""
-import base64
-import itsdangerous
-import bcrypt
from litecord.blueprints.auth import create_user, make_token
from litecord.blueprints.users import delete_user
from litecord.enums import UserFlags
diff --git a/run.py b/run.py
index 15ce2b4..f8bf1c7 100644
--- a/run.py
+++ b/run.py
@@ -58,7 +58,7 @@ from litecord.blueprints.user.billing_job import payment_job
from litecord.blueprints.admin_api import (
voice as voice_admin, features as features_admin,
- guilds as guilds_admin
+ guilds as guilds_admin, users as users_admin, instance_invites
)
from litecord.blueprints.admin_api.voice import guild_region_check
@@ -146,7 +146,9 @@ def set_blueprints(app_):
voice_admin: '/admin/voice',
features_admin: '/admin/guilds',
- guilds_admin: '/admin/guilds'
+ guilds_admin: '/admin/guilds',
+ users_admin: '/admin/users',
+ instance_invites: '/admin/instance/invites'
}
for bp, suffix in bps.items():