# HACK HACK HACK -- how to do attr_accessible from here?
# prevents a user from submitting a crafted form that bypasses activation
# anything else you want your user to change should be added here.
- attr_accessible :login, :email, :name, :password, :password_confirmation, :external_identity, :external_identity_provider, :user_local
- attr_accessor :token_authenticated, :external_identity, :external_identity_provider, :user_local
+ attr_accessible :login, :email, :name, :password, :password_confirmation
+ attr_accessor :token_authenticated
####
# As now dates are saved in long they should be no more automatically managed by Rails
write_attribute :email, (value && value.downcase)
end
- def external_identity=(value)
- write_attribute :external_identity, value
- end
-
- def external_identity_provider=(value)
- write_attribute :external_identity_provider, value
- end
-
- def user_local=(value)
- write_attribute :user_local, value
- end
-
# SCM accounts should also contain login and email
def full_scm_accounts
new_scm_accounts = self.scm_accounts.split(/\r?\n/).reject { |c| c.empty? } if self.scm_accounts
return nil if !Api::Utils.java_facade.getSettings().getBoolean('sonar.authenticator.createUsers')
# Automatically create a user in the sonar db if authentication has been successfully done
user = User.new(:login => username, :name => username, :email => '', :created_at => now, :updated_at => now)
- user.external_identity = username
- user.external_identity_provider = 'sonarqube'
- user.user_local = false
+ user.external_identity= username
+ user.external_identity_provider= 'sonarqube'
+ user.user_local= false
if details
user.name = details.getName()
user.email = details.getEmail()
end
+ # Update external identity and local info for existing users
+ user.external_identity= username
+ user.external_identity_provider= 'sonarqube'
+ user.user_local= false
+
# Force the update of updated_at in order to execute an SQL update to block other session
user.updated_at = now
end