Sha256: d7900a58e4774a10eb770fb35e52ddcca61c61e6df7ca8cef1db8a839d9e6316

Contents?: true

Size: 437 Bytes

Versions: 6

Compression:

Stored size: 437 Bytes

Contents

module TheRoleController
  private

  def role_access_denied
    flash[:error] = t('the_role.access_denied')
    redirect_to '/'
  end

  def role_required
    role_access_denied unless current_user.has_role?(controller_path, action_name)
  end

  def owner_required
    # TheRole: You should define OWNER CHECK OBJECT
    # When editable object was found
    role_access_denied unless current_user.owner?(@owner_check_object)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
the_role-2.1.1 app/controllers/the_role_controller.rb
the_role-2.1.0 app/controllers/the_role_controller.rb
the_role-2.0.4 app/controllers/the_role_controller.rb
the_role-2.0.3 app/controllers/the_role_controller.rb
the_role-2.0.2 app/controllers/the_role_controller.rb
the_role-2.0.1 app/controllers/the_role_controller.rb