Sha256: e313538bf47458e34dc9b898ce2b4aeacb024f8b9543a3ed377e5eb8f54ee8f2
Contents?: true
Size: 1.05 KB
Versions: 10
Compression:
Stored size: 1.05 KB
Contents
# # Copyright 2014 Red Hat, Inc. # # This software is licensed to you under the GNU General Public # License as published by the Free Software Foundation; either version # 2 of the License (GPLv2) or (at your option) any later version. # There is NO WARRANTY for this software, express or implied, # including the implied warranties of MERCHANTABILITY, # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should # have received a copy of GPLv2 along with this software; if not, see # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. module Actions module Middleware class KeepCurrentUser < Dynflow::Middleware def plan(*args) pass(*args).tap { action.input[:current_user_id] = User.current.id } end def run(*args) restore_curent_user { pass(*args) } end def finalize restore_curent_user { pass } end private def restore_curent_user User.current = User.find(action.input[:current_user_id]) yield ensure User.current = nil end end end end
Version data entries
10 entries across 10 versions & 1 rubygems