def update(user, request): """ Update a user. This API endpoint allows authorised clients (those able to provide a valid Client ID and Client Secret) to update users in their authority. """ schema = UpdateUserAPISchema() appstruct = schema.validate(_json_payload(request)) _update_user(user, appstruct) presenter = UserJSONPresenter(user) return presenter.asdict()
def update(user, request): """ Update a user. This API endpoint allows authorised clients (those able to provide a valid Client ID and Client Secret) to update users in their authority. """ schema = UpdateUserAPISchema() appstruct = schema.validate(_json_payload(request)) user_update_service = request.find_service(name="user_update") user = user_update_service.update(user, **appstruct) presenter = TrustedUserJSONPresenter(user) return presenter.asdict()
def update(user, request): """ Update a user. This API endpoint allows authorised clients (those able to provide a valid Client ID and Client Secret) to update users in their authority. """ schema = UpdateUserAPISchema() appstruct = schema.validate(_json_payload(request)) user_update_service = request.find_service(name="user_update") user = user_update_service.update(user, **appstruct) presenter = UserJSONPresenter(user) return presenter.asdict()
def update(request): """ Update a user. This API endpoint allows authorised clients (those able to provide a valid Client ID and Client Secret) to update users in their authority. """ client = request_auth_client(request) user_svc = request.find_service(name='user') user = user_svc.fetch(request.matchdict['username'], client.authority) if user is None: raise HTTPNotFound() schema = UpdateUserAPISchema() appstruct = schema.validate(_json_payload(request)) _update_user(user, appstruct) presenter = UserJSONPresenter(user) return presenter.asdict()
def schema(self): return UpdateUserAPISchema()