Class: TentD::API::Followers::AuthorizeWriteOne

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

Instance Method Summary collapse

Methods inherited from Middleware

#call, #initialize

Methods included from Authorizable

#authorize_env!, #authorize_env?

Constructor Details

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

Instance Method Details

#action(env) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/tentd/api/followers.rb', line 38

def action(env)
  unless env.params.follower_id && env.current_auth && env.current_auth.kind_of?(Model::Follower) &&
         env.current_auth.id == env.params.follower_id
    authorize_env!(env, :write_followers)
  end
  env.authorized_scopes << :self
  env
end