def _get_user(self): user = User.get_or_404(request.view_args['user_id'], is_deleted=False) if not is_legacy_signed_url_valid(user, request.full_path): raise BadRequest('Invalid signature') if user.is_blocked: raise BadRequest('User blocked') return user
def undo_impersonate_user(): """Undo an admin impersonation login and revert to the old user.""" from indico.modules.auth import logger from indico.modules.users import User try: entry = session.pop('login_as_orig_user') except KeyError: # The user probably already switched back from another tab return user = User.get_or_404(entry['user_id']) logger.info('Admin %r stopped impersonating user %r', user, session.user) session.set_session_user(user) session.update(entry['session_data'])
def _process_args(self, undo, user_id): RHAdminBase._process_args(self) self.user = None if undo else User.get_or_404(user_id, is_deleted=False)
def _process_args(self): RHManageCategoryRole._process_args(self) self.user = User.get_or_404(request.view_args['user_id'])
def _process_args(self): RHUserBase._process_args(self) self.fav_user = (User.get_or_404(request.view_args['fav_user_id']) if 'fav_user_id' in request.view_args else None)
def _process_args(self): self.user = User.get_or_404(request.view_args['user_id'], is_deleted=False)
def _process(self): source = User.get_or_404(request.args['source']) target = User.get_or_404(request.args['target']) errors, warnings = _get_merge_problems(source, target) return jsonify(errors=errors, warnings=warnings)
def _process_args(self): self.user = User.get_or_404( request.view_args['user_id'] ) if 'user_id' in request.view_args else None