Class: TentD::API::Followers::AuthorizeReadOne

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



20
21
22
23
24
25
26
27
# File 'lib/tentd/api/followers.rb', line 20

def action(env)
  if env.params.follower_id && env.current_auth && env.current_auth.kind_of?(Model::Follower) &&
         env.current_auth.id == env.params.follower_id
    env.authorized_scopes << :self
  end
  env.full_read_authorized = authorize_env?(env, :read_followers)
  env
end