Module: Netzke::Grid::Endpoints

Extended by:
ActiveSupport::Concern
Included in:
Base, Tree::Base
Defined in:
lib/netzke/grid/endpoints.rb

Instance Method Summary collapse

Instance Method Details

#attempt_operation(op, data, client) ⇒ Object

Attempts a given operation on the data. Checks permissions first.

Parameters:

  • Operation: (Symbol)

    :create, :read, :update, or :delete

  • Workload (Array|Hash)

    of operation data

  • Object (Netzke::Core::EndpointResponse)

    collecting response to the client



89
90
91
92
93
94
95
96
# File 'lib/netzke/grid/endpoints.rb', line 89

def attempt_operation(op, data, client)
  if allowed_to?(op)
    send(op, data)
  else
    client.netzke_notify I18n.t("netzke.basepack.cannot_#{op}")
    {}
  end
end