Merge pull request #2181 from constantine2nd/develop

A few features
This commit is contained in:
Simon Redfern 2023-02-02 21:30:04 +01:00 committed by GitHub
commit bbe4927272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 7 deletions

View File

@ -1212,7 +1212,7 @@ user_account_is_validated = false
retain_archive_metrics_days = 1095
# Defines the number of days we keep rows in the table "Metric" former "MappedMetric"
retain_metrics_days = 60
retain_metrics_days = 200
#if same session used for different ip address, we can show this warning, default is false.
show_ip_address_change_warning=false

View File

@ -472,7 +472,9 @@ import net.liftweb.util.Helpers._
resourceUser <- if (AuthUser.currentUser.isDefined){
//AuthUser.currentUser.get.user.foreign // this will be issue when the resource user is in remote side {
val user = AuthUser.currentUser.openOrThrowException(ErrorMessages.attemptedToOpenAnEmptyBox)
Users.users.vend.getUserByUserName(user.provider.get, user.username.get)
// In case that the provider is empty field we default to "local_identity_provider" or "hostname"
val provider = if(user.provider.get.isEmpty) Constant.localIdentityProvider else user.provider.get
Users.users.vend.getUserByUserName(provider, user.username.get)
}else if (directLogin.isDefined) // Direct Login
DirectLogin.getUser
else if (hasDirectLoginHeader(authorization)) // Direct Login Deprecated

View File

@ -47,18 +47,18 @@ object MetricsArchiveScheduler extends MdcLoggable {
def conditionalDeleteMetricsRow() = {
val currentTime = new Date()
val days = APIUtil.getPropsAsLongValue("retain_metrics_days", 60) match {
val days = APIUtil.getPropsAsLongValue("retain_metrics_days", 200) match {
case days if days > 59 => days
case _ => 60
}
val someDaysAgo: Date = new Date(currentTime.getTime - (oneDayInMillis * days))
// Get the data from the table "Metric" older than specified by retain_metrics_days
val canditateMetricRowsToMove = APIMetrics.apiMetrics.vend.getAllMetrics(List(OBPToDate(someDaysAgo)))
canditateMetricRowsToMove map { i =>
val candidateMetricRowsToMove = APIMetrics.apiMetrics.vend.getAllMetrics(List(OBPToDate(someDaysAgo)))
candidateMetricRowsToMove map { i =>
// and copy it to the table "MetricsArchive"
copyRowToMetricsArchive(i)
}
val maybeDeletedRows: List[(Boolean, Long)] = canditateMetricRowsToMove map { i =>
val maybeDeletedRows: List[(Boolean, Long)] = candidateMetricRowsToMove map { i =>
// and delete it after successful coping
MetricArchive.find(By(MetricArchive.metricId, i.getMetricId())) match {
case Full(_) => (MappedMetric.bulkDelete_!!(By(MappedMetric.id, i.getMetricId())), i.getMetricId())

View File

@ -410,6 +410,7 @@ class ConsumerRegistration extends MdcLoggable {
s"App name: ${registered.name.get} \n" +
s"App type: ${registered.appType.get} \n" +
s"App description: ${registered.description.get} \n" +
s"App Redirect Url : ${registered.redirectURL} \n" +
s"Consumer Key: ${consumerKeyOrMessage} \n" +
s"Consumer Secret : ${consumerSecretOrMessage} \n" +
s"OAuth Endpoint: ${oauthEndpointUrl} \n" +
@ -454,7 +455,8 @@ class ConsumerRegistration extends MdcLoggable {
s"Email: ${registered.developerEmail.get} \n" +
s"App name: ${registered.name.get} \n" +
s"App type: ${registered.appType.get} \n" +
s"App description: ${registered.description.get}"
s"App description: ${registered.description.get} \n" +
s"App Redirect Url : ${registered.redirectURL}"
//technically doesn't work for all valid email addresses so this will mess up if someone tries to send emails to "foo,bar"@example.com
val to = toAddressesString.split(",").toList