Fixed issue with local vs external users. Code cleanup

This commit is contained in:
Petar Bozin 2016-01-15 18:00:41 +01:00
parent 6a05175b6c
commit c3936b3151
2 changed files with 8 additions and 13 deletions

View File

@ -282,6 +282,14 @@ class Boot extends Loggable{
// Make a transaction span the whole HTTP request
S.addAround(DB.buildLoanWrapper)
val useMessageQueue = Props.getBool("messageQueue.createBankAccounts", false)
if(useMessageQueue)
try {
BankAccountCreationListener.startListen
} catch {
case e: java.lang.ExceptionInInitializerError => logger.warn(s"BankAccountCreationListener Exception: $e")
}
Mailer.devModeSend.default.set( (m : MimeMessage) => {
logger.info("Would have sent email if not in dev mode: " + m.getContent)
})
@ -300,15 +308,6 @@ class Boot extends Loggable{
XhtmlResponse((<html> <body>Something unexpected happened while serving the page at {r.uri}</body> </html>), S.htmlProperties.docType, List("Content-Type" -> "text/html; charset=utf-8"), Nil, 500, S.legacyIeCompatibilityMode)
}
}
val useMessageQueue = Props.getBool("messageQueue.createBankAccounts", false)
if(useMessageQueue)
try {
BankAccountCreationListener.startListen
} catch {
case e: java.lang.ExceptionInInitializerError => logger.warn(s"BankAccountCreationListener Exception: $e")
}
}
def schemifyAll() = {

View File

@ -72,19 +72,15 @@ class OBPUser extends MegaProtoUser[OBPUser] with Logger {
def getProvider() = {
if(provider.get == null) {
info ("-------------------------------------------------------> NULL")
Props.get("hostname","")
} else if ( provider.get == "" || provider.get == Props.get("hostname","") ) {
info ("-------------------------------------------------------> HOST")
Props.get("hostname","")
} else {
info ("-------------------------------------------------------> EXTERNAL")
provider.get
}
}
def createUnsavedApiUser() : APIUser = {
info("[createUnsavedApiUser]===> displayName=" + displayName() + " email=" + email + " provider=" + provider)
APIUser.create
.name_(displayName())
.email(email)