def create(request): """ Create a user. This API endpoint allows authorised clients (those able to provide a valid Client ID and Client Secret) to create users in their authority. These users are created pre-activated, and are unable to log in to the web service directly. """ client = _request_client(request) schema = schemas.CreateUserAPISchema() appstruct = schema.validate(request.json_body) _check_authority(client, appstruct) appstruct['authority'] = client.authority _check_existing_user(request.db, appstruct) user_signup_service = request.find_service(name='user_signup') user = user_signup_service.signup(require_activation=False, **appstruct) return { 'authority': user.authority, 'email': user.email, 'userid': user.userid, 'username': user.username, }
def schema(self): return schemas.CreateUserAPISchema()