mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 19:16:53 +00:00
Merge pull request #2202 from hongwei1/develop
refactor/used view_id instead of view_fx for the UniqueIndex of AccountAccess table
This commit is contained in:
commit
924b632d3e
@ -1428,7 +1428,7 @@ def restoreSomeSessions(): Unit = {
|
||||
accountId = newBankAccountId.accountId
|
||||
newBankAccount = accountsHeld.find(cbsAccount =>cbsAccount.bankId == bankId.value && cbsAccount.accountId == accountId.value)
|
||||
viewId <- newBankAccount.map(_.viewsToGenerate).getOrElse(List.empty[String])
|
||||
view <- Views.views.vend.getOrCreateAccountView(newBankAccountId, viewId)//this method will return both system views and custom views back.
|
||||
view <- Views.views.vend.getOrCreateSystemViewFromCbs(viewId)//this method will return both system views and custom views back.
|
||||
} yield {
|
||||
UserRefreshes.UserRefreshes.vend.createOrUpdateRefreshUser(user.userId)
|
||||
if (view.isSystem)//if the view is a system view, we will call `grantAccessToSystemView`
|
||||
@ -1460,7 +1460,7 @@ def restoreSomeSessions(): Unit = {
|
||||
_ = if(csbNewViewsForAccount.nonEmpty){
|
||||
for{
|
||||
newViewForAccount <- csbNewViewsForAccount
|
||||
view <- Views.views.vend.getOrCreateAccountView(bankAccountId, newViewForAccount) //this method will return both system views and custom views back.
|
||||
view <- Views.views.vend.getOrCreateSystemViewFromCbs(newViewForAccount) //this method will return both system views and custom views back.
|
||||
}yield{
|
||||
if (view.isSystem)//if the view is a system view, we will call `grantAccessToSystemView`
|
||||
Views.views.vend.grantAccessToSystemView(bankAccountId.bankId, bankAccountId.accountId, view, user)
|
||||
|
||||
@ -6,8 +6,6 @@ import code.views.system.AccountAccess
|
||||
import code.views.{RemotedataViewsCaseClasses, Views}
|
||||
import com.openbankproject.commons.model.{UpdateViewJSON, _}
|
||||
import net.liftweb.common.Box
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import scala.concurrent.Future
|
||||
|
||||
|
||||
@ -132,8 +130,8 @@ object RemotedataViews extends ObpActorInit with Views {
|
||||
(actor ? cc.getOwners(view)).mapTo[Set[User]]
|
||||
)
|
||||
|
||||
def getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String): Box[View] = getValueFromFuture(
|
||||
(actor ? cc.getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String)).mapTo[Box[View]]
|
||||
def getOrCreateSystemViewFromCbs(viewId: String): Box[View] = getValueFromFuture(
|
||||
(actor ? cc.getOrCreateSystemViewFromCbs(viewId: String)).mapTo[Box[View]]
|
||||
)
|
||||
|
||||
def getOrCreateSystemView(viewId: String) : Box[View] = getValueFromFuture(
|
||||
@ -144,14 +142,6 @@ object RemotedataViews extends ObpActorInit with Views {
|
||||
(actor ? cc.getOrCreatePublicPublicView(bankId, accountId, description)).mapTo[Box[View]]
|
||||
)
|
||||
|
||||
def getOrCreateAccountantsView(bankId: BankId, accountId: AccountId, description: String) : Box[View] = getValueFromFuture(
|
||||
(actor ? cc.getOrCreateAccountantsView(bankId, accountId, description)).mapTo[Box[View]]
|
||||
)
|
||||
|
||||
def getOrCreateAuditorsView(bankId: BankId, accountId: AccountId, description: String) : Box[View] = getValueFromFuture(
|
||||
(actor ? cc.getOrCreateAuditorsView(bankId, accountId, description)).mapTo[Box[View]]
|
||||
)
|
||||
|
||||
def createCustomRandomView(bankId: BankId, accountId: AccountId) : Box[View] = getValueFromFuture(
|
||||
(actor ? cc.createRandomView(bankId, accountId)).mapTo[Box[View]]
|
||||
)
|
||||
|
||||
@ -136,10 +136,6 @@ class RemotedataViewsActor extends Actor with ObpActorHelper with MdcLoggable {
|
||||
case cc.publicViewsForBank(bankId: BankId) =>
|
||||
logger.debug("publicViews()")
|
||||
sender ! (mapper.publicViewsForBank(bankId: BankId))
|
||||
|
||||
case cc.getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String) =>
|
||||
logger.debug("getOrCreateAccountView(" + BankIdAccountId +", "+ viewId +")")
|
||||
sender ! (mapper.getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String))
|
||||
|
||||
case cc.getOrCreateSystemView(name) =>
|
||||
logger.debug("getOrCreateSystemOwnerView(" + name +")")
|
||||
@ -149,14 +145,6 @@ class RemotedataViewsActor extends Actor with ObpActorHelper with MdcLoggable {
|
||||
logger.debug("getOrCreatePublicPublicView(" + bankId +", "+ accountId +", "+ description +")")
|
||||
sender ! (mapper.getOrCreateCustomPublicView(bankId, accountId, description))
|
||||
|
||||
case cc.getOrCreateAccountantsView(bankId, accountId, description) =>
|
||||
logger.debug("getOrCreateAccountantsView(" + bankId +", "+ accountId +", "+ description +")")
|
||||
sender ! (mapper.getOrCreateAccountantsView(bankId, accountId, description))
|
||||
|
||||
case cc.getOrCreateAuditorsView(bankId, accountId, description) =>
|
||||
logger.debug("getOrCreateAuditorsView(" + bankId +", "+ accountId +", "+ description +")")
|
||||
sender ! (mapper.getOrCreateAuditorsView(bankId, accountId, description))
|
||||
|
||||
case cc.createRandomView(bankId, accountId) =>
|
||||
logger.debug("createRandomView(" + bankId +", "+ accountId +")")
|
||||
sender ! (mapper.createCustomRandomView(bankId, accountId))
|
||||
|
||||
@ -603,12 +603,9 @@ object MapperViews extends Views with MdcLoggable {
|
||||
}
|
||||
|
||||
|
||||
def getOrCreateAccountView(bankIdAccountId: BankIdAccountId, viewId: String): Box[View] = {
|
||||
def getOrCreateSystemViewFromCbs(viewId: String): Box[View] = {
|
||||
|
||||
val bankId = bankIdAccountId.bankId
|
||||
val accountId = bankIdAccountId.accountId
|
||||
val ownerView = SYSTEM_OWNER_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val publicView = CUSTOM_PUBLIC_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val accountantsView = SYSTEM_ACCOUNTANT_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val auditorsView = SYSTEM_AUDITOR_VIEW_ID.equals(viewId.toLowerCase)
|
||||
val standardView = SYSTEM_STANDARD_VIEW_ID.equals(viewId.toLowerCase)
|
||||
@ -617,8 +614,6 @@ object MapperViews extends Views with MdcLoggable {
|
||||
val theView =
|
||||
if (ownerView)
|
||||
getOrCreateSystemView(SYSTEM_OWNER_VIEW_ID)
|
||||
else if (publicView)
|
||||
getOrCreateCustomPublicView(bankId, accountId, "Public View")
|
||||
else if (accountantsView)
|
||||
getOrCreateSystemView(SYSTEM_ACCOUNTANT_VIEW_ID)
|
||||
else if (auditorsView)
|
||||
@ -660,144 +655,129 @@ object MapperViews extends Views with MdcLoggable {
|
||||
|
||||
def getOrCreateCustomPublicView(bankId: BankId, accountId: AccountId, description: String = "Public View") : Box[View] = {
|
||||
getExistingCustomView(bankId, accountId, CUSTOM_PUBLIC_VIEW_ID) match {
|
||||
case Empty=> createDefaultPublicView(bankId, accountId, description)
|
||||
case Empty=> createDefaultCustomPublicView(bankId, accountId, description)
|
||||
case Full(v)=> Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case ParamFailure(x,y,z,q) => ParamFailure(x,y,z,q)
|
||||
}
|
||||
}
|
||||
|
||||
def getOrCreateAccountantsView(bankId: BankId, accountId: AccountId, description: String = "Accountants View") : Box[View] = {
|
||||
getExistingCustomView(bankId, accountId, SYSTEM_ACCOUNTANT_VIEW_ID) match {
|
||||
case Empty => createDefaultAccountantsView(bankId, accountId, description)
|
||||
case Full(v) => Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case ParamFailure(x,y,z,q) => ParamFailure(x,y,z,q)
|
||||
}
|
||||
}
|
||||
|
||||
def getOrCreateAuditorsView(bankId: BankId, accountId: AccountId, description: String = "Auditors View") : Box[View] = {
|
||||
getExistingCustomView(bankId, accountId, SYSTEM_AUDITOR_VIEW_ID) match {
|
||||
case Empty => createDefaultAuditorsView(bankId, accountId, description)
|
||||
case Full(v) => Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case ParamFailure(x,y,z,q) => ParamFailure(x,y,z,q)
|
||||
}
|
||||
}
|
||||
|
||||
//Note: this method is only for scala-test,
|
||||
/**
|
||||
* This is only for scala tests.
|
||||
*/
|
||||
def createCustomRandomView(bankId: BankId, accountId: AccountId) : Box[View] = {
|
||||
val entity = ViewDefinition.create.
|
||||
isSystem_(false).
|
||||
isFirehose_(false).
|
||||
name_("_" + randomString(5)).
|
||||
metadataView_(SYSTEM_OWNER_VIEW_ID).
|
||||
description_(randomString(3)).
|
||||
view_id("_" + randomString(3)).
|
||||
isPublic_(false).
|
||||
bank_id(bankId.value).
|
||||
account_id(accountId.value).
|
||||
usePrivateAliasIfOneExists_(false).
|
||||
usePublicAliasIfOneExists_(false).
|
||||
hideOtherAccountMetadataIfAlias_(false).
|
||||
canSeeTransactionThisBankAccount_(true).
|
||||
canSeeTransactionOtherBankAccount_(true).
|
||||
canSeeTransactionMetadata_(true).
|
||||
canSeeTransactionDescription_(true).
|
||||
canSeeTransactionAmount_(true).
|
||||
canSeeTransactionType_(true).
|
||||
canSeeTransactionCurrency_(true).
|
||||
canSeeTransactionStartDate_(true).
|
||||
canSeeTransactionFinishDate_(true).
|
||||
canSeeTransactionBalance_(true).
|
||||
canSeeComments_(true).
|
||||
canSeeOwnerComment_(true).
|
||||
canSeeTags_(true).
|
||||
canSeeImages_(true).
|
||||
canSeeBankAccountOwners_(true).
|
||||
canSeeBankAccountType_(true).
|
||||
canSeeBankAccountBalance_(true).
|
||||
canSeeBankAccountCurrency_(true).
|
||||
canSeeBankAccountLabel_(true).
|
||||
canSeeBankAccountNationalIdentifier_(true).
|
||||
canSeeBankAccountSwift_bic_(true).
|
||||
canSeeBankAccountIban_(true).
|
||||
canSeeBankAccountNumber_(true).
|
||||
canSeeBankAccountBankName_(true).
|
||||
canSeeBankAccountBankPermalink_(true).
|
||||
canSeeOtherAccountNationalIdentifier_(true).
|
||||
canSeeOtherAccountSWIFT_BIC_(true).
|
||||
canSeeOtherAccountIBAN_(true).
|
||||
canSeeOtherAccountBankName_(true).
|
||||
canSeeOtherAccountNumber_(true)
|
||||
//we set the length is to 40, try to be difficult for scala tests create the same viewName.
|
||||
val viewName = "_" + randomString(40)
|
||||
val viewId = MapperViews.createViewIdByName(viewName)
|
||||
val description = randomString(40)
|
||||
|
||||
if (!checkCustomViewIdOrName(viewName)) {
|
||||
return Failure(InvalidCustomViewFormat)
|
||||
}
|
||||
|
||||
entity.
|
||||
canSeeOtherAccountMetadata_(true).
|
||||
canSeeOtherAccountKind_(true).
|
||||
canSeeMoreInfo_(true).
|
||||
canSeeUrl_(true).
|
||||
canSeeImageUrl_(true).
|
||||
canSeeOpenCorporatesUrl_(true).
|
||||
canSeeCorporateLocation_(true).
|
||||
canSeePhysicalLocation_(true).
|
||||
canSeePublicAlias_(true).
|
||||
canSeePrivateAlias_(true).
|
||||
canAddMoreInfo_(true).
|
||||
canAddURL_(true).
|
||||
canAddImageURL_(true).
|
||||
canAddOpenCorporatesUrl_(true).
|
||||
canAddCorporateLocation_(true).
|
||||
canAddPhysicalLocation_(true).
|
||||
canAddPublicAlias_(true).
|
||||
canAddPrivateAlias_(true).
|
||||
canDeleteCorporateLocation_(true).
|
||||
canDeletePhysicalLocation_(true).
|
||||
canEditOwnerComment_(true).
|
||||
canAddComment_(true).
|
||||
canDeleteComment_(true).
|
||||
canAddTag_(true).
|
||||
canDeleteTag_(true).
|
||||
canAddImage_(true).
|
||||
canDeleteImage_(true).
|
||||
canAddWhereTag_(true).
|
||||
canSeeWhereTag_(true).
|
||||
canDeleteWhereTag_(true).
|
||||
canSeeBankRoutingScheme_(true). //added following in V300
|
||||
canSeeBankRoutingAddress_(true).
|
||||
canSeeBankAccountRoutingScheme_(true).
|
||||
canSeeBankAccountRoutingAddress_(true).
|
||||
canSeeOtherBankRoutingScheme_(true).
|
||||
canSeeOtherBankRoutingAddress_(true).
|
||||
canSeeOtherAccountRoutingScheme_(true).
|
||||
canSeeOtherAccountRoutingAddress_(true).
|
||||
canAddTransactionRequestToOwnAccount_(false).//added following two for payments
|
||||
canAddTransactionRequestToAnyAccount_(false).
|
||||
canSeeBankAccountCreditLimit_(true).
|
||||
saveMe
|
||||
|
||||
Full(entity)
|
||||
getExistingCustomView(bankId, accountId, viewId) match {
|
||||
case Empty => {
|
||||
tryo{ViewDefinition.create.
|
||||
isSystem_(false).
|
||||
isFirehose_(false).
|
||||
name_(viewName).
|
||||
metadataView_(SYSTEM_OWNER_VIEW_ID).
|
||||
description_(description).
|
||||
view_id(viewId).
|
||||
isPublic_(false).
|
||||
bank_id(bankId.value).
|
||||
account_id(accountId.value).
|
||||
usePrivateAliasIfOneExists_(false).
|
||||
usePublicAliasIfOneExists_(false).
|
||||
hideOtherAccountMetadataIfAlias_(false).
|
||||
canSeeTransactionThisBankAccount_(true).
|
||||
canSeeTransactionOtherBankAccount_(true).
|
||||
canSeeTransactionMetadata_(true).
|
||||
canSeeTransactionDescription_(true).
|
||||
canSeeTransactionAmount_(true).
|
||||
canSeeTransactionType_(true).
|
||||
canSeeTransactionCurrency_(true).
|
||||
canSeeTransactionStartDate_(true).
|
||||
canSeeTransactionFinishDate_(true).
|
||||
canSeeTransactionBalance_(true).
|
||||
canSeeComments_(true).
|
||||
canSeeOwnerComment_(true).
|
||||
canSeeTags_(true).
|
||||
canSeeImages_(true).
|
||||
canSeeBankAccountOwners_(true).
|
||||
canSeeBankAccountType_(true).
|
||||
canSeeBankAccountBalance_(true).
|
||||
canSeeBankAccountCurrency_(true).
|
||||
canSeeBankAccountLabel_(true).
|
||||
canSeeBankAccountNationalIdentifier_(true).
|
||||
canSeeBankAccountSwift_bic_(true).
|
||||
canSeeBankAccountIban_(true).
|
||||
canSeeBankAccountNumber_(true).
|
||||
canSeeBankAccountBankName_(true).
|
||||
canSeeBankAccountBankPermalink_(true).
|
||||
canSeeOtherAccountNationalIdentifier_(true).
|
||||
canSeeOtherAccountSWIFT_BIC_(true).
|
||||
canSeeOtherAccountIBAN_(true).
|
||||
canSeeOtherAccountBankName_(true).
|
||||
canSeeOtherAccountNumber_(true).
|
||||
canSeeOtherAccountMetadata_(true).
|
||||
canSeeOtherAccountKind_(true).
|
||||
canSeeMoreInfo_(true).
|
||||
canSeeUrl_(true).
|
||||
canSeeImageUrl_(true).
|
||||
canSeeOpenCorporatesUrl_(true).
|
||||
canSeeCorporateLocation_(true).
|
||||
canSeePhysicalLocation_(true).
|
||||
canSeePublicAlias_(true).
|
||||
canSeePrivateAlias_(true).
|
||||
canAddMoreInfo_(true).
|
||||
canAddURL_(true).
|
||||
canAddImageURL_(true).
|
||||
canAddOpenCorporatesUrl_(true).
|
||||
canAddCorporateLocation_(true).
|
||||
canAddPhysicalLocation_(true).
|
||||
canAddPublicAlias_(true).
|
||||
canAddPrivateAlias_(true).
|
||||
canDeleteCorporateLocation_(true).
|
||||
canDeletePhysicalLocation_(true).
|
||||
canEditOwnerComment_(true).
|
||||
canAddComment_(true).
|
||||
canDeleteComment_(true).
|
||||
canAddTag_(true).
|
||||
canDeleteTag_(true).
|
||||
canAddImage_(true).
|
||||
canDeleteImage_(true).
|
||||
canAddWhereTag_(true).
|
||||
canSeeWhereTag_(true).
|
||||
canDeleteWhereTag_(true).
|
||||
canSeeBankRoutingScheme_(true). //added following in V300
|
||||
canSeeBankRoutingAddress_(true).
|
||||
canSeeBankAccountRoutingScheme_(true).
|
||||
canSeeBankAccountRoutingAddress_(true).
|
||||
canSeeOtherBankRoutingScheme_(true).
|
||||
canSeeOtherBankRoutingAddress_(true).
|
||||
canSeeOtherAccountRoutingScheme_(true).
|
||||
canSeeOtherAccountRoutingAddress_(true).
|
||||
canAddTransactionRequestToOwnAccount_(false). //added following two for payments
|
||||
canAddTransactionRequestToAnyAccount_(false).
|
||||
canSeeBankAccountCreditLimit_(true).
|
||||
saveMe}
|
||||
}
|
||||
case Full(v) => Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
case ParamFailure(x, y, z, q) => ParamFailure(x, y, z, q)
|
||||
}
|
||||
}
|
||||
|
||||
def createDefaultOwnerView(bankId: BankId, accountId: AccountId, name: String): Box[View] = {
|
||||
createAndSaveOwnerView(bankId, accountId, "Owner View")
|
||||
}
|
||||
|
||||
def createDefaultSystemView(name: String): Box[View] = {
|
||||
createAndSaveSystemView(name)
|
||||
}
|
||||
|
||||
def createDefaultPublicView(bankId: BankId, accountId: AccountId, name: String): Box[View] = {
|
||||
def createDefaultCustomPublicView(bankId: BankId, accountId: AccountId, name: String): Box[View] = {
|
||||
if(!allowPublicViews) {
|
||||
return Failure(PublicViewsNotAllowedOnThisInstance)
|
||||
}
|
||||
createAndSaveDefaultPublicView(bankId, accountId, "Public View")
|
||||
}
|
||||
|
||||
def createDefaultAccountantsView(bankId: BankId, accountId: AccountId, name: String): Box[View] = {
|
||||
createAndSaveDefaultAccountantsView(bankId, accountId, "Accountants View")
|
||||
}
|
||||
|
||||
def createDefaultAuditorsView(bankId: BankId, accountId: AccountId, name: String): Box[View] = {
|
||||
createAndSaveDefaultAuditorsView(bankId, accountId, "Auditors View")
|
||||
createAndSaveDefaultPublicCustomView(bankId, accountId, "Public View")
|
||||
}
|
||||
|
||||
def getExistingCustomView(bankId: BankId, accountId: AccountId, viewId: String): Box[View] = {
|
||||
@ -831,96 +811,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
true
|
||||
}
|
||||
|
||||
def unsavedOwnerView(bankId : BankId, accountId: AccountId, description: String) : ViewDefinition = {
|
||||
val entity = create
|
||||
.isSystem_(false)
|
||||
.isFirehose_(true) // TODO This should be set to false. i.e. Firehose views should be separate
|
||||
.bank_id(bankId.value)
|
||||
.account_id(accountId.value)
|
||||
.name_("Owner")
|
||||
.view_id(SYSTEM_OWNER_VIEW_ID)
|
||||
.description_(description)
|
||||
.isPublic_(false) //(default is false anyways)
|
||||
.usePrivateAliasIfOneExists_(false) //(default is false anyways)
|
||||
.usePublicAliasIfOneExists_(false) //(default is false anyways)
|
||||
.hideOtherAccountMetadataIfAlias_(false) //(default is false anyways)
|
||||
.canSeeTransactionThisBankAccount_(true)
|
||||
.canSeeTransactionOtherBankAccount_(true)
|
||||
.canSeeTransactionMetadata_(true)
|
||||
.canSeeTransactionDescription_(true)
|
||||
.canSeeTransactionAmount_(true)
|
||||
.canSeeTransactionType_(true)
|
||||
.canSeeTransactionCurrency_(true)
|
||||
.canSeeTransactionStartDate_(true)
|
||||
.canSeeTransactionFinishDate_(true)
|
||||
.canSeeTransactionBalance_(true)
|
||||
.canSeeComments_(true)
|
||||
.canSeeOwnerComment_(true)
|
||||
.canSeeTags_(true)
|
||||
.canSeeImages_(true)
|
||||
.canSeeBankAccountOwners_(true)
|
||||
.canSeeBankAccountType_(true)
|
||||
.canSeeBankAccountBalance_(true)
|
||||
.canSeeBankAccountCurrency_(true)
|
||||
.canSeeBankAccountLabel_(true)
|
||||
.canSeeBankAccountNationalIdentifier_(true)
|
||||
.canSeeBankAccountSwift_bic_(true)
|
||||
.canSeeBankAccountIban_(true)
|
||||
.canSeeBankAccountNumber_(true)
|
||||
.canSeeBankAccountBankName_(true)
|
||||
.canSeeBankAccountBankPermalink_(true)
|
||||
.canSeeOtherAccountNationalIdentifier_(true)
|
||||
.canSeeOtherAccountSWIFT_BIC_(true)
|
||||
.canSeeOtherAccountIBAN_(true)
|
||||
.canSeeOtherAccountBankName_(true)
|
||||
|
||||
entity
|
||||
.canSeeOtherAccountNumber_(true)
|
||||
.canSeeOtherAccountMetadata_(true)
|
||||
.canSeeOtherAccountKind_(true)
|
||||
.canSeeMoreInfo_(true)
|
||||
.canSeeUrl_(true)
|
||||
.canSeeImageUrl_(true)
|
||||
.canSeeOpenCorporatesUrl_(true)
|
||||
.canSeeCorporateLocation_(true)
|
||||
.canSeePhysicalLocation_(true)
|
||||
.canSeePublicAlias_(true)
|
||||
.canSeePrivateAlias_(true)
|
||||
.canAddMoreInfo_(true)
|
||||
.canAddURL_(true)
|
||||
.canAddImageURL_(true)
|
||||
.canAddOpenCorporatesUrl_(true)
|
||||
.canAddCorporateLocation_(true)
|
||||
.canAddPhysicalLocation_(true)
|
||||
.canAddPublicAlias_(true)
|
||||
.canAddPrivateAlias_(true)
|
||||
.canAddCounterparty_(true)
|
||||
.canGetCounterparty_(true)
|
||||
.canDeleteCounterparty_(true)
|
||||
.canDeleteCorporateLocation_(true)
|
||||
.canDeletePhysicalLocation_(true)
|
||||
.canEditOwnerComment_(true)
|
||||
.canAddComment_(true)
|
||||
.canDeleteComment_(true)
|
||||
.canAddTag_(true)
|
||||
.canDeleteTag_(true)
|
||||
.canAddImage_(true)
|
||||
.canDeleteImage_(true)
|
||||
.canAddWhereTag_(true)
|
||||
.canSeeWhereTag_(true)
|
||||
.canDeleteWhereTag_(true)
|
||||
.canSeeBankRoutingScheme_(true) //added following in V300
|
||||
.canSeeBankRoutingAddress_(true)
|
||||
.canSeeBankAccountRoutingScheme_(true)
|
||||
.canSeeBankAccountRoutingAddress_(true)
|
||||
.canSeeOtherBankRoutingScheme_(true)
|
||||
.canSeeOtherBankRoutingAddress_(true)
|
||||
.canSeeOtherAccountRoutingScheme_(true)
|
||||
.canSeeOtherAccountRoutingAddress_(true)
|
||||
.canAddTransactionRequestToOwnAccount_(true) //added following two for payments
|
||||
.canAddTransactionRequestToAnyAccount_(true)
|
||||
}
|
||||
def unsavedSystemView(viewId: String) : ViewDefinition = {
|
||||
def unsavedSystemView(viewId: String): ViewDefinition = {
|
||||
val entity = create
|
||||
.isSystem_(true)
|
||||
.isFirehose_(false)
|
||||
@ -1006,7 +897,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
.canSeeOtherAccountRoutingAddress_(true)
|
||||
.canAddTransactionRequestToOwnAccount_(true) //added following two for payments
|
||||
.canAddTransactionRequestToAnyAccount_(true)
|
||||
|
||||
|
||||
viewId match {
|
||||
case SYSTEM_STAGE_ONE_VIEW_ID =>
|
||||
entity
|
||||
@ -1020,107 +911,8 @@ object MapperViews extends Views with MdcLoggable {
|
||||
}
|
||||
}
|
||||
|
||||
def unsavedFirehoseView(bankId : BankId, accountId: AccountId, description: String) : ViewDefinition = {
|
||||
val entity = create
|
||||
.isSystem_(true)
|
||||
.isFirehose_(true) // Of the autogenerated views, only firehose should be firehose (except public)
|
||||
.bank_id(bankId.value)
|
||||
.account_id(accountId.value)
|
||||
.name_("Firehose")
|
||||
.view_id("firehose")
|
||||
.description_(description)
|
||||
.isPublic_(false) //(default is false anyways)
|
||||
.usePrivateAliasIfOneExists_(false) //(default is false anyways)
|
||||
.usePublicAliasIfOneExists_(false) //(default is false anyways)
|
||||
.hideOtherAccountMetadataIfAlias_(false) //(default is false anyways)
|
||||
.canSeeTransactionThisBankAccount_(true)
|
||||
.canSeeTransactionOtherBankAccount_(true)
|
||||
.canSeeTransactionMetadata_(true)
|
||||
.canSeeTransactionDescription_(true)
|
||||
.canSeeTransactionAmount_(true)
|
||||
.canSeeTransactionType_(true)
|
||||
.canSeeTransactionCurrency_(true)
|
||||
.canSeeTransactionStartDate_(true)
|
||||
.canSeeTransactionFinishDate_(true)
|
||||
.canSeeTransactionBalance_(true)
|
||||
.canSeeComments_(true)
|
||||
.canSeeOwnerComment_(true)
|
||||
.canSeeTags_(true)
|
||||
.canSeeImages_(true)
|
||||
.canSeeBankAccountOwners_(true)
|
||||
.canSeeBankAccountType_(true)
|
||||
.canSeeBankAccountBalance_(true)
|
||||
.canSeeBankAccountCurrency_(true)
|
||||
.canSeeBankAccountLabel_(true)
|
||||
.canSeeBankAccountNationalIdentifier_(true)
|
||||
.canSeeBankAccountSwift_bic_(true)
|
||||
.canSeeBankAccountIban_(true)
|
||||
.canSeeBankAccountNumber_(true)
|
||||
.canSeeBankAccountBankName_(true)
|
||||
.canSeeBankAccountBankPermalink_(true)
|
||||
.canSeeOtherAccountNationalIdentifier_(true)
|
||||
.canSeeOtherAccountSWIFT_BIC_(true)
|
||||
.canSeeOtherAccountIBAN_(true)
|
||||
.canSeeOtherAccountBankName_(true)
|
||||
|
||||
entity
|
||||
.canSeeOtherAccountNumber_(true)
|
||||
.canSeeOtherAccountMetadata_(true)
|
||||
.canSeeOtherAccountKind_(true)
|
||||
.canSeeMoreInfo_(true)
|
||||
.canSeeUrl_(true)
|
||||
.canSeeImageUrl_(true)
|
||||
.canSeeOpenCorporatesUrl_(true)
|
||||
.canSeeCorporateLocation_(true)
|
||||
.canSeePhysicalLocation_(true)
|
||||
.canSeePublicAlias_(true)
|
||||
.canSeePrivateAlias_(true)
|
||||
.canAddMoreInfo_(true)
|
||||
.canAddURL_(true)
|
||||
.canAddImageURL_(true)
|
||||
.canAddOpenCorporatesUrl_(true)
|
||||
.canAddCorporateLocation_(true)
|
||||
.canAddPhysicalLocation_(true)
|
||||
.canAddPublicAlias_(true)
|
||||
.canAddPrivateAlias_(true)
|
||||
.canAddCounterparty_(true)
|
||||
.canGetCounterparty_(true)
|
||||
.canDeleteCounterparty_(true)
|
||||
.canDeleteCorporateLocation_(true)
|
||||
.canDeletePhysicalLocation_(true)
|
||||
.canEditOwnerComment_(true)
|
||||
.canAddComment_(true)
|
||||
.canDeleteComment_(true)
|
||||
.canAddTag_(true)
|
||||
.canDeleteTag_(true)
|
||||
.canAddImage_(true)
|
||||
.canDeleteImage_(true)
|
||||
.canAddWhereTag_(true)
|
||||
.canSeeWhereTag_(true)
|
||||
.canDeleteWhereTag_(true)
|
||||
.canSeeBankRoutingScheme_(true) //added following in V300
|
||||
.canSeeBankRoutingAddress_(true)
|
||||
.canSeeBankAccountRoutingScheme_(true)
|
||||
.canSeeBankAccountRoutingAddress_(true)
|
||||
.canSeeOtherBankRoutingScheme_(true)
|
||||
.canSeeOtherBankRoutingAddress_(true)
|
||||
.canSeeOtherAccountRoutingScheme_(true)
|
||||
.canSeeOtherAccountRoutingAddress_(true)
|
||||
.canAddTransactionRequestToOwnAccount_(false) //added following two for payments
|
||||
.canAddTransactionRequestToAnyAccount_(false)
|
||||
}
|
||||
|
||||
def createAndSaveFirehoseView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
val res = unsavedFirehoseView(bankId, accountId, description).saveMe
|
||||
Full(res)
|
||||
}
|
||||
|
||||
def createAndSaveOwnerView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
val res = unsavedOwnerView(bankId, accountId, description).saveMe
|
||||
Full(res)
|
||||
}
|
||||
def createAndSaveSystemView(name: String) : Box[View] = {
|
||||
val res = unsavedSystemView(name).saveMe
|
||||
def createAndSaveSystemView(viewId: String) : Box[View] = {
|
||||
val res = unsavedSystemView(viewId).saveMe
|
||||
Full(res)
|
||||
}
|
||||
|
||||
@ -1210,7 +1002,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
canAddTransactionRequestToAnyAccount_(false)
|
||||
}
|
||||
|
||||
def createAndSaveDefaultPublicView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
def createAndSaveDefaultPublicCustomView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
if(!allowPublicViews) {
|
||||
return Failure(PublicViewsNotAllowedOnThisInstance)
|
||||
}
|
||||
@ -1218,197 +1010,4 @@ object MapperViews extends Views with MdcLoggable {
|
||||
Full(res)
|
||||
}
|
||||
|
||||
/*
|
||||
Accountants
|
||||
*/
|
||||
|
||||
def unsavedDefaultAccountantsView(bankId : BankId, accountId: AccountId, description: String) : ViewDefinition = {
|
||||
val entityt = create.
|
||||
isSystem_(false).
|
||||
isFirehose_(true). // TODO This should be set to false. i.e. Firehose views should be separate
|
||||
name_("Accountant"). // Use the singular form
|
||||
description_(description).
|
||||
view_id("accountant"). // Use the singular form
|
||||
isPublic_(false).
|
||||
bank_id(bankId.value).
|
||||
account_id(accountId.value).
|
||||
usePrivateAliasIfOneExists_(false).
|
||||
usePublicAliasIfOneExists_(true).
|
||||
hideOtherAccountMetadataIfAlias_(true).
|
||||
canSeeTransactionThisBankAccount_(true).
|
||||
canSeeTransactionOtherBankAccount_(true).
|
||||
canSeeTransactionMetadata_(true).
|
||||
canSeeTransactionDescription_(false).
|
||||
canSeeTransactionAmount_(true).
|
||||
canSeeTransactionType_(true).
|
||||
canSeeTransactionCurrency_(true).
|
||||
canSeeTransactionStartDate_(true).
|
||||
canSeeTransactionFinishDate_(true).
|
||||
canSeeTransactionBalance_(true).
|
||||
canSeeComments_(true).
|
||||
canSeeOwnerComment_(true).
|
||||
canSeeTags_(true).
|
||||
canSeeImages_(true).
|
||||
canSeeBankAccountOwners_(true).
|
||||
canSeeBankAccountType_(true).
|
||||
canSeeBankAccountBalance_(true).
|
||||
canSeeBankAccountCurrency_(true).
|
||||
canSeeBankAccountLabel_(true).
|
||||
canSeeBankAccountNationalIdentifier_(true).
|
||||
canSeeBankAccountIban_(true).
|
||||
canSeeBankAccountNumber_(true).
|
||||
canSeeBankAccountBankName_(true).
|
||||
canSeeBankAccountBankPermalink_(true).
|
||||
canSeeOtherAccountNationalIdentifier_(true).
|
||||
canSeeOtherAccountIBAN_(true).
|
||||
canSeeOtherAccountBankName_(true).
|
||||
canSeeOtherAccountNumber_(true).
|
||||
canSeeOtherAccountMetadata_(true).
|
||||
canSeeOtherAccountKind_(true)
|
||||
entityt.
|
||||
canSeeMoreInfo_(true).
|
||||
canSeeUrl_(true).
|
||||
canSeeImageUrl_(true).
|
||||
canSeeOpenCorporatesUrl_(true).
|
||||
canSeeCorporateLocation_(true).
|
||||
canSeePhysicalLocation_(true).
|
||||
canSeePublicAlias_(true).
|
||||
canSeePrivateAlias_(true).
|
||||
canAddMoreInfo_(true).
|
||||
canAddURL_(true).
|
||||
canAddImageURL_(true).
|
||||
canAddOpenCorporatesUrl_(true).
|
||||
canAddCorporateLocation_(true).
|
||||
canAddPhysicalLocation_(true).
|
||||
canAddPublicAlias_(true).
|
||||
canAddPrivateAlias_(true).
|
||||
canAddCounterparty_(true).
|
||||
canGetCounterparty_(true).
|
||||
canDeleteCounterparty_(true).
|
||||
canDeleteCorporateLocation_(true).
|
||||
canDeletePhysicalLocation_(true).
|
||||
canEditOwnerComment_(true).
|
||||
canAddComment_(true).
|
||||
canDeleteComment_(true).
|
||||
canAddTag_(true).
|
||||
canDeleteTag_(true).
|
||||
canAddImage_(true).
|
||||
canDeleteImage_(true).
|
||||
canAddWhereTag_(true).
|
||||
canSeeWhereTag_(true).
|
||||
canDeleteWhereTag_(true).
|
||||
canSeeBankRoutingScheme_(true). //added following in V300
|
||||
canSeeBankRoutingAddress_(true).
|
||||
canSeeBankAccountRoutingScheme_(true).
|
||||
canSeeBankAccountRoutingAddress_(true).
|
||||
canSeeOtherBankRoutingScheme_(true).
|
||||
canSeeOtherBankRoutingAddress_(true).
|
||||
canSeeOtherAccountRoutingScheme_(true).
|
||||
canSeeOtherAccountRoutingAddress_(true).
|
||||
canAddTransactionRequestToOwnAccount_(true). //added following two for payments
|
||||
canAddTransactionRequestToAnyAccount_(false)
|
||||
}
|
||||
|
||||
def createAndSaveDefaultAccountantsView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
val res = unsavedDefaultAccountantsView(bankId, accountId, description).saveMe
|
||||
Full(res)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Auditors
|
||||
*/
|
||||
|
||||
def unsavedDefaultAuditorsView(bankId : BankId, accountId: AccountId, description: String) : ViewDefinition = {
|
||||
val entity = create.
|
||||
isSystem_(false).
|
||||
isFirehose_(true). // TODO This should be set to false. i.e. Firehose views should be separate
|
||||
name_("Auditor"). // Use the singular form
|
||||
description_(description).
|
||||
view_id("auditor"). // Use the singular form
|
||||
isPublic_(false).
|
||||
bank_id(bankId.value).
|
||||
account_id(accountId.value).
|
||||
usePrivateAliasIfOneExists_(false).
|
||||
usePublicAliasIfOneExists_(true).
|
||||
hideOtherAccountMetadataIfAlias_(true).
|
||||
canSeeTransactionThisBankAccount_(true).
|
||||
canSeeTransactionOtherBankAccount_(true).
|
||||
canSeeTransactionMetadata_(true).
|
||||
canSeeTransactionDescription_(false).
|
||||
canSeeTransactionAmount_(true).
|
||||
canSeeTransactionType_(true).
|
||||
canSeeTransactionCurrency_(true).
|
||||
canSeeTransactionStartDate_(true).
|
||||
canSeeTransactionFinishDate_(true).
|
||||
canSeeTransactionBalance_(true).
|
||||
canSeeComments_(true).
|
||||
canSeeOwnerComment_(true).
|
||||
canSeeTags_(true).
|
||||
canSeeImages_(true).
|
||||
canSeeBankAccountOwners_(true).
|
||||
canSeeBankAccountType_(true).
|
||||
canSeeBankAccountBalance_(true).
|
||||
canSeeBankAccountCurrency_(true).
|
||||
canSeeBankAccountLabel_(true).
|
||||
canSeeBankAccountNationalIdentifier_(true).
|
||||
canSeeBankAccountIban_(true).
|
||||
canSeeBankAccountNumber_(true).
|
||||
canSeeBankAccountBankName_(true).
|
||||
canSeeBankAccountBankPermalink_(true).
|
||||
canSeeOtherAccountNationalIdentifier_(true).
|
||||
canSeeOtherAccountIBAN_(true).
|
||||
canSeeOtherAccountBankName_(true).
|
||||
canSeeOtherAccountNumber_(true).
|
||||
canSeeOtherAccountMetadata_(true)
|
||||
entity.
|
||||
canSeeOtherAccountKind_(true).
|
||||
canSeeMoreInfo_(true).
|
||||
canSeeUrl_(true).
|
||||
canSeeImageUrl_(true).
|
||||
canSeeOpenCorporatesUrl_(true).
|
||||
canSeeCorporateLocation_(true).
|
||||
canSeePhysicalLocation_(true).
|
||||
canSeePublicAlias_(true).
|
||||
canSeePrivateAlias_(true).
|
||||
canAddMoreInfo_(true).
|
||||
canAddURL_(true).
|
||||
canAddImageURL_(true).
|
||||
canAddOpenCorporatesUrl_(true).
|
||||
canAddCorporateLocation_(true).
|
||||
canAddPhysicalLocation_(true).
|
||||
canAddPublicAlias_(true).
|
||||
canAddPrivateAlias_(true).
|
||||
canAddCounterparty_(true).
|
||||
canGetCounterparty_(true).
|
||||
canDeleteCounterparty_(true).
|
||||
canDeleteCorporateLocation_(true).
|
||||
canDeletePhysicalLocation_(true).
|
||||
canEditOwnerComment_(true).
|
||||
canAddComment_(true).
|
||||
canDeleteComment_(true).
|
||||
canAddTag_(true).
|
||||
canDeleteTag_(true).
|
||||
canAddImage_(true).
|
||||
canDeleteImage_(true).
|
||||
canAddWhereTag_(true).
|
||||
canSeeWhereTag_(true).
|
||||
canDeleteWhereTag_(true).
|
||||
canSeeBankRoutingScheme_(true). //added following in V300
|
||||
canSeeBankRoutingAddress_(true).
|
||||
canSeeBankAccountRoutingScheme_(true).
|
||||
canSeeBankAccountRoutingAddress_(true).
|
||||
canSeeOtherBankRoutingScheme_(true).
|
||||
canSeeOtherBankRoutingAddress_(true).
|
||||
canSeeOtherAccountRoutingScheme_(true).
|
||||
canSeeOtherAccountRoutingAddress_(true).
|
||||
canAddTransactionRequestToOwnAccount_(false).//added following two for payments
|
||||
canAddTransactionRequestToAnyAccount_(false)
|
||||
}
|
||||
|
||||
def createAndSaveDefaultAuditorsView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
val res = unsavedDefaultAuditorsView(bankId, accountId, description).saveMe
|
||||
Full(res)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -108,10 +108,14 @@ trait Views {
|
||||
* We should cache this function because the available views on an account will change rarely.
|
||||
*
|
||||
*/
|
||||
def getOrCreateAccountView(bankAccountUID: BankIdAccountId, viewId: String): Box[View]
|
||||
def getOrCreateSystemViewFromCbs(viewId: String): Box[View]
|
||||
|
||||
def getOrCreateSystemView(viewId: String) : Box[View]
|
||||
def getOrCreateCustomPublicView(bankId: BankId, accountId: AccountId, description: String) : Box[View]
|
||||
|
||||
/**
|
||||
* this is only used for the scala test
|
||||
*/
|
||||
def createCustomRandomView(bankId: BankId, accountId: AccountId) : Box[View]
|
||||
|
||||
def getOwners(view: View): Set[User]
|
||||
@ -160,11 +164,9 @@ class RemotedataViewsCaseClasses {
|
||||
case class getSystemViews()
|
||||
case class customViewFuture(viewId : ViewId, bankAccountId: BankIdAccountId)
|
||||
case class systemViewFuture(viewId : ViewId)
|
||||
case class getOrCreateAccountView(account: BankIdAccountId, viewId: String)
|
||||
case class getOrCreateSystemViewFromCbs(viewId: String)
|
||||
case class getOrCreateSystemView(viewId: String)
|
||||
case class getOrCreatePublicPublicView(bankId: BankId, accountId: AccountId, description: String)
|
||||
case class getOrCreateAccountantsView(bankId: BankId, accountId: AccountId, description: String)
|
||||
case class getOrCreateAuditorsView(bankId: BankId, accountId: AccountId, description: String)
|
||||
case class createRandomView(bankId: BankId, accountId: AccountId)
|
||||
|
||||
case class getOwners(view: View)
|
||||
|
||||
@ -27,7 +27,7 @@ class AccountAccess extends LongKeyedMapper[AccountAccess] with IdPK with Create
|
||||
object view_fk extends MappedLongForeignKey(this, ViewDefinition)
|
||||
}
|
||||
object AccountAccess extends AccountAccess with LongKeyedMetaMapper[AccountAccess] {
|
||||
override def dbIndexes: List[BaseIndex[AccountAccess]] = UniqueIndex(bank_id, account_id, view_fk, user_fk, consumer_id) :: super.dbIndexes
|
||||
override def dbIndexes: List[BaseIndex[AccountAccess]] = UniqueIndex(bank_id, account_id, view_id, user_fk, consumer_id) :: super.dbIndexes
|
||||
def findAllBySystemViewId(systemViewId:ViewId)= AccountAccess.findAll(
|
||||
By(AccountAccess.view_id, systemViewId.value)
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@ package code.model
|
||||
|
||||
import code.UserRefreshes.MappedUserRefreshes
|
||||
import code.accountholders.MapperAccountHolders
|
||||
import code.api.Constant.{SYSTEM_OWNER_VIEW_ID, SYSTEM_STAGE_ONE_VIEW_ID, SYSTEM_STANDARD_VIEW_ID}
|
||||
import code.api.Constant.{SYSTEM_ACCOUNTANT_VIEW_ID, SYSTEM_AUDITOR_VIEW_ID, SYSTEM_OWNER_VIEW_ID, SYSTEM_STAGE_ONE_VIEW_ID, SYSTEM_STANDARD_VIEW_ID}
|
||||
import code.bankconnectors.Connector
|
||||
import code.connector.MockedCbsConnector
|
||||
import code.model.dataAccess.AuthUser
|
||||
@ -235,18 +235,16 @@ class AuthUserTest extends ServerSetup with DefaultUsers with PropsReset{
|
||||
val allViews = ViewDefinition.findAll()
|
||||
allViewsForAccount1.toString().contains(SYSTEM_STANDARD_VIEW_ID) should equal(true)
|
||||
allViewsForAccount1.toString().contains(SYSTEM_OWNER_VIEW_ID) should equal(true)
|
||||
allViewsForAccount1.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount1.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount1.toString().contains("auditor") should equal(true)
|
||||
allViewsForAccount1.toString().contains(SYSTEM_ACCOUNTANT_VIEW_ID) should equal(true)
|
||||
allViewsForAccount1.toString().contains(SYSTEM_AUDITOR_VIEW_ID) should equal(true)
|
||||
allViewsForAccount2.toString().contains(SYSTEM_STANDARD_VIEW_ID) should equal(true)
|
||||
allViewsForAccount2.toString().contains("_public") should equal(true)
|
||||
allViewsForAccount2.toString().contains("accountant") should equal(true)
|
||||
allViewsForAccount2.toString().contains("auditor") should equal(true)
|
||||
allViews.length should equal(6) // 3 system views + 2 custom views
|
||||
allViewsForAccount2.toString().contains(SYSTEM_ACCOUNTANT_VIEW_ID) should equal(true)
|
||||
allViewsForAccount2.toString().contains(SYSTEM_AUDITOR_VIEW_ID) should equal(true)
|
||||
allViews.length should equal(4) // 3 system views + 1 custom views
|
||||
|
||||
Then("We check the AccountAccess")
|
||||
val numberOfAccountAccess = AccountAccess.findAll().length
|
||||
numberOfAccountAccess should equal(10)
|
||||
numberOfAccountAccess should equal(8)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@ class MappedViewsTest extends ServerSetup with DefaultUsers{
|
||||
val bankIdAccountId = BankIdAccountId(BankId("1"),AccountId("2"))
|
||||
|
||||
val viewIdOwner = "owner"
|
||||
val viewIdPublic = "_public"
|
||||
val viewIdAccountant = "accountant"
|
||||
val viewIdAuditor = "auditor"
|
||||
val viewIdNotSupport = "NotSupport"
|
||||
@ -32,37 +31,33 @@ class MappedViewsTest extends ServerSetup with DefaultUsers{
|
||||
scenario("test - getOrCreateAccountView") {
|
||||
|
||||
Given("set up four normal Views")
|
||||
var viewOwner = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdOwner)
|
||||
var viewPublic = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdPublic)
|
||||
var viewAccountant = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdAccountant)
|
||||
var viewAuditor = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdAuditor)
|
||||
var viewOwner = MapperViews.getOrCreateSystemViewFromCbs(viewIdOwner)
|
||||
var viewAccountant = MapperViews.getOrCreateSystemViewFromCbs(viewIdAccountant)
|
||||
var viewAuditor = MapperViews.getOrCreateSystemViewFromCbs(viewIdAuditor)
|
||||
var allExistingViewsForOneAccount = MapperViews.availableViewsForAccount(bankIdAccountId)
|
||||
|
||||
Then("Check the result from database. it should have 4 views and with the right viewId")
|
||||
viewOwner.head.viewId.value should equal("owner".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("_public".toLowerCase())
|
||||
viewAccountant.head.viewId.value should equal("accountant".toLowerCase())
|
||||
viewAuditor.head.viewId.value should equal("auditor".toLowerCase())
|
||||
allExistingViewsForOneAccount.length should equal(4)
|
||||
allExistingViewsForOneAccount.length should equal(3)
|
||||
|
||||
Then("We set the four normal views again")
|
||||
viewOwner = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdOwner)
|
||||
viewPublic = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdPublic)
|
||||
viewAccountant = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdAccountant)
|
||||
viewAuditor = MapperViews.getOrCreateAccountView(bankIdAccountId, viewIdAuditor)
|
||||
viewOwner = MapperViews.getOrCreateSystemViewFromCbs(viewIdOwner)
|
||||
viewAccountant = MapperViews.getOrCreateSystemViewFromCbs(viewIdAccountant)
|
||||
viewAuditor = MapperViews.getOrCreateSystemViewFromCbs(viewIdAuditor)
|
||||
allExistingViewsForOneAccount = MapperViews.availableViewsForAccount(bankIdAccountId)
|
||||
|
||||
Then("Check the result from database again. it should have four views and with the right viewId, there should be not changed.")
|
||||
viewOwner.head.viewId.value should equal("owner".toLowerCase())
|
||||
viewPublic.head.viewId.value should equal("_public".toLowerCase())
|
||||
viewAccountant.head.viewId.value should equal("accountant".toLowerCase())
|
||||
viewAuditor.head.viewId.value should equal("auditor".toLowerCase())
|
||||
allExistingViewsForOneAccount.length should equal(4)
|
||||
allExistingViewsForOneAccount.length should equal(3)
|
||||
|
||||
|
||||
Then("set up four wrong View name, do not support this viewId")
|
||||
val wrongViewId = "WrongViewId"
|
||||
val wrongView = MapperViews.getOrCreateAccountView(bankIdAccountId, wrongViewId)
|
||||
val wrongView = MapperViews.getOrCreateSystemViewFromCbs(wrongViewId)
|
||||
|
||||
wrongView should equal(Failure(ViewIdNotSupported+ s"Your input viewId is :$wrongViewId"))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user