Merge remote-tracking branch 'UPSTREAM/develop' into v100.0.1

This commit is contained in:
tawoe 2023-03-03 14:05:46 +01:00
commit 0adfecbcf8
7 changed files with 43 additions and 7 deletions

View File

@ -22,6 +22,7 @@ Please structure git commit messages in a way as shown below:
5. performance/Something
6. test/Something
7. enhancement/Something
8. security/Something
Please also check if it also needs to be tagged (see below)

View File

@ -1132,7 +1132,7 @@ personal_data_collection_consent_country_waiver_list = Austria, Belgium, Bulgari
# Local identity provider url
# it defaults to the hostname props value
# local_identity_provider=this is the hostname of the local obp server including scheme
# local_identity_provider=strongly recomended to use top level domain name so that all nodes in the cluster share same provider name
# enable dynamic code sandbox, default is false, this will make sandbox works for code running in Future, will make performance lower than disable

View File

@ -799,6 +799,8 @@ class Boot extends MdcLoggable {
}
ApiWarnings.logWarningsRegardingProperties()
ApiWarnings.customViewNamesCheck()
ApiWarnings.systemViewNamesCheck()
//see the notes for this method:
createDefaultBankAndDefaultAccountsIfNotExisting()

View File

@ -1,6 +1,7 @@
package code.api.util
import code.util.Helper.MdcLoggable
import code.views.system.ViewDefinition
import net.liftweb.util.Props
object ApiWarnings extends MdcLoggable {
@ -17,4 +18,28 @@ object ApiWarnings extends MdcLoggable {
logger.warn(s"!!!!!!!!!!!!!! Security Consideration: consents.sca.enabled=$scaEnabled !!!!!!!!!!!!!!")
}
}
def customViewNamesCheck() = {
val incorrectViews = ViewDefinition.getCustomViews().filter { view =>
view.viewId.value.startsWith("_") == false
}
if(incorrectViews.size > 0) {
logger.warn(s"VIEW_NAME_CHECK")
logger.warn(s"!!!!!!!!!!!!!! There are ${incorrectViews.size} custom view(s) with incorrect names !!!!!!!!!!!!!!")
} else {
logger.info(s"Custom VIEW_NAME_CHECK passed")
}
}
def systemViewNamesCheck() = {
val incorrectViews = ViewDefinition.getSystemViews().filter { view =>
view.viewId.value.startsWith("_") == true
}
if(incorrectViews.size > 0) {
logger.warn(s"VIEW_NAME_CHECK")
logger.warn(s"!!!!!!!!!!!!!! There are ${incorrectViews.size} system view(s) with incorrect names !!!!!!!!!!!!!!")
} else {
logger.info(s"System VIEW_NAME_CHECK passed")
}
}
}

View File

@ -322,15 +322,13 @@ class AuthUser extends MegaProtoUser[AuthUser] with CreatedUpdated with MdcLogga
override def displayName = S.?("provider")
override val fieldId = Some(Text("txtProvider"))
override def validations = validUri(this) _ :: super.validations
override def defaultValue: String = Constant.HostName
override def defaultValue: String = Constant.localIdentityProvider
}
def getProvider() = {
if(provider.get == null) {
Constant.HostName
} else if ( provider.get == "" || provider.get == Constant.HostName ) {
Constant.HostName
if(provider.get == null || provider.get == "") {
Constant.localIdentityProvider
} else {
provider.get
}

View File

@ -69,7 +69,7 @@ class ResourceUser extends LongKeyedMapper[ResourceUser] with User with ManyToMa
override def defaultValue = ""
}
object provider_ extends MappedString(this, 100){
override def defaultValue = Constant.HostName
override def defaultValue: String = Constant.localIdentityProvider
}
/**

View File

@ -544,6 +544,11 @@ object ViewDefinition extends ViewDefinition with LongKeyedMetaMapper[ViewDefini
By(ViewDefinition.view_id, viewId),
)
}
def getSystemViews(): List[ViewDefinition] = {
ViewDefinition.findAll(
By(ViewDefinition.isSystem_, true)
)
}
def findCustomView(bankId: String, accountId: String, viewId: String): Box[ViewDefinition] = {
ViewDefinition.find(
@ -553,6 +558,11 @@ object ViewDefinition extends ViewDefinition with LongKeyedMetaMapper[ViewDefini
By(ViewDefinition.view_id, viewId),
)
}
def getCustomViews(): List[ViewDefinition] = {
ViewDefinition.findAll(
By(ViewDefinition.isSystem_, false)
)
}
@deprecated("This is method only used for migration stuff, please use @findCustomView and @findSystemView instead.","13-12-2019")
def findByUniqueKey(bankId: String, accountId: String, viewId: String): Box[ViewDefinition] = {