[#1677] Extract NewUser::DossiersController#owns_dossier?

This commit is contained in:
Frederic Merizen 2018-03-29 15:59:04 +02:00
parent baf881a38b
commit b606afee3f

View file

@ -103,7 +103,7 @@ module NewUser
end
def ensure_ownership!
if dossier.user_id != current_user.id
if !owns_dossier?
forbidden!
end
end
@ -127,6 +127,10 @@ module NewUser
params.require(:dossier).permit(:autorisation_donnees)
end
def owns_dossier?
dossier.user_id == current_user.id
end
def draft?
params[:submit_action] == 'draft'
end