Class: TentD::API::Apps::UpdateAppAuthorization

Inherits:
Middleware
  • Object
show all
Defined in:
lib/tentd/api/apps.rb

Instance Method Summary collapse

Methods inherited from Middleware

#call, #initialize

Methods included from TentD::API::Authorizable

#authorize_env!, #authorize_env?

Constructor Details

This class inherits a constructor from TentD::API::Middleware

Instance Method Details

#action(env) ⇒ Object



123
124
125
126
127
128
129
130
# File 'lib/tentd/api/apps.rb', line 123

def action(env)
  authorize_env!(env, :write_apps)
  if (auth = TentD::Model::AppAuthorization.first(:app_id => env.params.app_id, :id => env.params.auth_id)) &&
      auth.update_from_params(env.params.data)
    env.response = auth
  end
  env
end