2   class PermissionsController < ApiController
 
   3     authorize_resource :class => false
 
   5     before_action :setup_user_auth
 
   6     before_action :set_request_formats
 
   8     # External apps that use the api are able to query which permissions
 
   9     # they have. This currently returns a list of permissions granted to the current user:
 
  10     # * if authenticated via OAuth, this list will contain all permissions granted by the user to the access_token.
 
  11     # * unauthenticated users have no permissions, so the list will be empty.
 
  13       @permissions = if doorkeeper_token.present?
 
  14                        doorkeeper_token.scopes.map { |s| :"allow_#{s}" }
 
  19       respond_to do |format|