mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
		
			
				
	
	
		
			24 lines
		
	
	
		
			447 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			24 lines
		
	
	
		
			447 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
class Api::V1::Accounts::OauthAuthorizationController < Api::V1::Accounts::BaseController
 | 
						|
  before_action :check_authorization
 | 
						|
 | 
						|
  protected
 | 
						|
 | 
						|
  def scope
 | 
						|
    ''
 | 
						|
  end
 | 
						|
 | 
						|
  def state
 | 
						|
    Current.account.to_sgid(expires_in: 15.minutes).to_s
 | 
						|
  end
 | 
						|
 | 
						|
  def base_url
 | 
						|
    ENV.fetch('FRONTEND_URL', 'http://localhost:3000')
 | 
						|
  end
 | 
						|
 | 
						|
  private
 | 
						|
 | 
						|
  def check_authorization
 | 
						|
    raise Pundit::NotAuthorizedError unless Current.account_user.administrator?
 | 
						|
  end
 | 
						|
end
 |