fix: API error when using SuperAdmin token (#8739)

- Fixes the issue in release 3.5.0, which causes SuperAdmin tokens to throw error during API calls

Fixes: #8719
This commit is contained in:
Sojan Jose
2024-01-18 18:49:32 +04:00
committed by GitHub
parent aacf326ca1
commit ce8190dacf
2 changed files with 27 additions and 1 deletions

View File

@@ -14,7 +14,14 @@ module AccessTokenAuthHelper
render_unauthorized('Invalid Access Token') && return if @access_token.blank?
@resource = @access_token.owner
Current.user = @resource if [User, AgentBot].include?(@resource.class)
Current.user = @resource if allowed_current_user_type?(@resource)
end
def allowed_current_user_type?(resource)
return true if resource.is_a?(User)
return true if resource.is_a?(AgentBot)
false
end
def validate_bot_access_token!