Skip to content

Commit

Permalink
Fix codclimate/sourcelevel issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rhruiz committed Mar 10, 2022
1 parent fec3f81 commit e61356b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/cassette/authentication.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ def ticket_user(ticket, service = config.service)

logger.info("Validation resut: #{response.inspect}")

return nil unless ticket_response.login

Cassette::Authentication::User.new(
login: ticket_response.login,
name: ticket_response.name,
authorities: ticket_response.authorities,
extra_attributes: ticket_response.extra_attributes,
ticket: ticket,
config: config
) if ticket_response.login
)
rescue => exception
logger.error "Error while authenticating ticket #{ticket}: #{exception.message}"
raise Cassette::Errors::Forbidden, exception.message
Expand Down
3 changes: 2 additions & 1 deletion lib/cassette/authentication/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class User

attr_accessor :login, :name, :authorities, :email, :ticket, :type,
:extra_attributes

def_delegators :@authorities, :has_role?, :has_raw_role?

def initialize(attrs = {})
Expand All @@ -23,7 +24,7 @@ def initialize(attrs = {})
@extra_attributes = attrs[:extra_attributes]
@authorities = Cassette::Authentication::Authorities
.parse(attrs.fetch(:authorities, '[]'),
config && config.base_authority)
config&.base_authority)
end

%w(customer employee).each do |type|
Expand Down

0 comments on commit e61356b

Please sign in to comment.