app/controllers/application_controller.rb
# almost everything we do is restricted to a department so we always load_department
# feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department
feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department feel free to skip_before_filter when desired
def require_proper_template_role
    unless current_user.has_proper_role_for?(Template.find(params[:template_id])) || current_user.is_admin_of?(Template.find(params[:template_id]).department)
      error_message = "This page is only availabe to the following roles: #{Template.find(params[:template_id]).roles.to_sentence}"
      flash[:error] = error_message
      redirect_to access_denied_path
    end
    return true
  end
def require_proper_template_role unless current_user . has_proper_role_for? ( Template . find ( params [ :template_id ] ) ) || current_user . is_admin_of? ( Template . find ( params [ :template_id ] ) . department ) error_message = "This page is only availabe to the following roles: #{Template.find(params[:template_id]).roles.to_sentence}" flash [ :error ] = error_message redirect_to access_denied_path end return true end
almost everything we do is restricted to a department so we always load_department
feel free to skip_before_filter when desired
almost everything we do is restricted to a department so we always load_department feel free to skip_before_filter when desired