mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 15:06:50 +00:00
Merge pull request #2572 from hongwei1/feature/refactorViewPermission
Feature/refactor view permission
This commit is contained in:
commit
1b2fc85629
@ -407,7 +407,7 @@ class Boot extends MdcLoggable {
|
||||
}
|
||||
|
||||
// ensure our relational database's tables are created/fit the schema
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
|
||||
val runningMode = Props.mode match {
|
||||
case Props.RunModes.Production => "Production mode"
|
||||
@ -795,7 +795,7 @@ class Boot extends MdcLoggable {
|
||||
// export one Connector's methods as endpoints, it is just for develop
|
||||
APIUtil.getPropsValue("connector.name.export.as.endpoints").foreach { connectorName =>
|
||||
// validate whether "connector.name.export.as.endpoints" have set a correct value
|
||||
code.api.Constant.Connector match {
|
||||
code.api.Constant.CONNECTOR match {
|
||||
case Full("star") =>
|
||||
val starConnectorTypes = APIUtil.getPropsValue("starConnector_supported_types","mapped")
|
||||
.trim
|
||||
|
||||
@ -50,7 +50,6 @@ object ObpActorConfig {
|
||||
"code.api.APIFailure" = kryo,
|
||||
"com.openbankproject.commons.model.BankAccount" = kryo,
|
||||
"com.openbankproject.commons.model.View" = kryo,
|
||||
"code.model.dataAccess.ViewImpl" = kryo,
|
||||
"com.openbankproject.commons.model.User" = kryo,
|
||||
"com.openbankproject.commons.model.ViewId" = kryo,
|
||||
"com.openbankproject.commons.model.BankIdAccountIdViewId" = kryo,
|
||||
|
||||
@ -136,185 +136,180 @@ object SwaggerDefinitionsJSON {
|
||||
which_alias_to_use = "family",
|
||||
hide_metadata_if_alias_used = false,
|
||||
allowed_actions = List(
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_amount",
|
||||
"can_see_transaction_type",
|
||||
"can_see_transaction_currency",
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date",
|
||||
"can_see_transaction_balance",
|
||||
"can_see_comments",
|
||||
"can_see_narrative",
|
||||
"can_see_tags",
|
||||
"can_see_images",
|
||||
"can_see_bank_account_owners",
|
||||
"can_see_bank_account_type",
|
||||
"can_see_bank_account_balance",
|
||||
"can_see_bank_account_currency",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic",
|
||||
"can_see_bank_account_iban",
|
||||
"can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name",
|
||||
"can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic",
|
||||
"can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name",
|
||||
"can_see_other_account_number",
|
||||
"can_see_other_account_metadata",
|
||||
"can_see_other_account_kind",
|
||||
"can_see_more_info",
|
||||
"can_see_url",
|
||||
"can_see_image_url",
|
||||
"can_see_open_corporates_url",
|
||||
"can_see_corporate_location",
|
||||
"can_see_physical_location",
|
||||
"can_see_public_alias",
|
||||
"can_see_private_alias",
|
||||
"can_add_more_info",
|
||||
"can_add_url",
|
||||
"can_add_image_url",
|
||||
"can_add_open_corporates_url",
|
||||
"can_add_corporate_location",
|
||||
"can_add_physical_location",
|
||||
"can_add_public_alias",
|
||||
"can_add_private_alias",
|
||||
"can_delete_corporate_location",
|
||||
"can_delete_physical_location",
|
||||
"can_edit_narrative",
|
||||
"can_add_comment",
|
||||
"can_delete_comment",
|
||||
"can_add_tag",
|
||||
"can_delete_tag",
|
||||
"can_add_image",
|
||||
"can_delete_image",
|
||||
"can_add_where_tag",
|
||||
"can_see_where_tag",
|
||||
"can_delete_where_tag",
|
||||
"can_create_counterparty",
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
//V300 New
|
||||
"can_see_bank_routing_scheme",
|
||||
"can_see_bank_routing_address",
|
||||
"can_see_bank_account_routing_scheme",
|
||||
"can_see_bank_account_routing_address",
|
||||
"can_see_other_bank_routing_scheme",
|
||||
"can_see_other_bank_routing_address",
|
||||
"can_see_other_account_routing_scheme",
|
||||
"can_see_other_account_routing_address",
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
//v310
|
||||
"can_query_available_funds",
|
||||
"can_add_transaction_request_to_own_account",
|
||||
"can_add_transaction_request_to_any_account",
|
||||
"can_see_bank_account_credit_limit",
|
||||
CAN_QUERY_AVAILABLE_FUNDS,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,
|
||||
//v400
|
||||
"can_create_direct_debit",
|
||||
"can_create_standing_order",
|
||||
|
||||
CAN_CREATE_DIRECT_DEBIT,
|
||||
CAN_CREATE_STANDING_ORDER,
|
||||
|
||||
//payments
|
||||
"can_add_transaction_request_to_any_account"
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT
|
||||
)
|
||||
)
|
||||
|
||||
lazy val createSystemViewJsonV300 = createViewJsonV300.copy(name = "test", metadata_view = "test", is_public = false)
|
||||
|
||||
lazy val allowedActionsV500 = List(
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_amount",
|
||||
"can_see_transaction_type",
|
||||
"can_see_transaction_currency",
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date",
|
||||
"can_see_transaction_balance",
|
||||
"can_see_comments",
|
||||
"can_see_narrative", "can_see_tags",
|
||||
"can_see_images",
|
||||
"can_see_bank_account_owners",
|
||||
"can_see_bank_account_type",
|
||||
"can_see_bank_account_balance",
|
||||
"can_see_bank_account_currency",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic",
|
||||
"can_see_bank_account_iban",
|
||||
"can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name",
|
||||
"can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic",
|
||||
"can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name",
|
||||
"can_see_other_account_number",
|
||||
"can_see_other_account_metadata",
|
||||
"can_see_other_account_kind",
|
||||
"can_see_more_info",
|
||||
"can_see_url",
|
||||
"can_see_image_url",
|
||||
"can_see_open_corporates_url",
|
||||
"can_see_corporate_location",
|
||||
"can_see_physical_location",
|
||||
"can_see_public_alias",
|
||||
"can_see_private_alias",
|
||||
"can_add_more_info",
|
||||
"can_add_url",
|
||||
"can_add_image_url",
|
||||
"can_add_open_corporates_url",
|
||||
"can_add_corporate_location",
|
||||
"can_add_physical_location",
|
||||
"can_add_public_alias",
|
||||
"can_add_private_alias",
|
||||
"can_delete_corporate_location",
|
||||
"can_delete_physical_location",
|
||||
"can_edit_narrative",
|
||||
"can_add_comment",
|
||||
"can_delete_comment",
|
||||
"can_add_tag",
|
||||
"can_delete_tag",
|
||||
"can_add_image",
|
||||
"can_delete_image",
|
||||
"can_add_where_tag",
|
||||
"can_see_where_tag",
|
||||
"can_delete_where_tag",
|
||||
"can_create_counterparty",
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
//V300 New
|
||||
"can_see_bank_routing_scheme",
|
||||
"can_see_bank_routing_address",
|
||||
"can_see_bank_account_routing_scheme",
|
||||
"can_see_bank_account_routing_address",
|
||||
"can_see_other_bank_routing_scheme",
|
||||
"can_see_other_bank_routing_address",
|
||||
"can_see_other_account_routing_scheme",
|
||||
"can_see_other_account_routing_address",
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
|
||||
//v310
|
||||
"can_query_available_funds",
|
||||
"can_add_transaction_request_to_own_account",
|
||||
"can_add_transaction_request_to_any_account",
|
||||
"can_see_bank_account_credit_limit",
|
||||
CAN_QUERY_AVAILABLE_FUNDS,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,
|
||||
//v400
|
||||
"can_create_direct_debit",
|
||||
"can_create_standing_order",
|
||||
CAN_CREATE_DIRECT_DEBIT,
|
||||
CAN_CREATE_STANDING_ORDER,
|
||||
|
||||
//payments
|
||||
"can_add_transaction_request_to_any_account",
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
|
||||
"can_see_transaction_request_types",
|
||||
"can_see_transaction_requests",
|
||||
"can_see_available_views_for_bank_account",
|
||||
"can_update_bank_account_label",
|
||||
"can_create_custom_view",
|
||||
"can_delete_custom_view",
|
||||
"can_update_custom_view",
|
||||
"can_see_views_with_permissions_for_one_user",
|
||||
"can_see_views_with_permissions_for_all_users",
|
||||
"can_grant_access_to_custom_views",
|
||||
"can_revoke_access_to_custom_views",
|
||||
"can_see_transaction_status"
|
||||
CAN_SEE_TRANSACTION_REQUEST_TYPES,
|
||||
CAN_SEE_TRANSACTION_REQUESTS,
|
||||
CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT,
|
||||
CAN_UPDATE_BANK_ACCOUNT_LABEL,
|
||||
CAN_CREATE_CUSTOM_VIEW,
|
||||
CAN_DELETE_CUSTOM_VIEW,
|
||||
CAN_UPDATE_CUSTOM_VIEW,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS,
|
||||
CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_SEE_TRANSACTION_STATUS
|
||||
)
|
||||
|
||||
lazy val createCustomViewJson = CreateCustomViewJson(
|
||||
@ -367,76 +362,76 @@ object SwaggerDefinitionsJSON {
|
||||
which_alias_to_use = "family",
|
||||
hide_metadata_if_alias_used = true,
|
||||
allowed_actions = List(
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_amount",
|
||||
"can_see_transaction_type",
|
||||
"can_see_transaction_currency",
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date",
|
||||
"can_see_transaction_balance",
|
||||
"can_see_comments",
|
||||
"can_see_narrative", "can_see_tags",
|
||||
"can_see_images",
|
||||
"can_see_bank_account_owners",
|
||||
"can_see_bank_account_type",
|
||||
"can_see_bank_account_balance",
|
||||
"can_see_bank_account_currency",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic",
|
||||
"can_see_bank_account_iban",
|
||||
"can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name",
|
||||
"can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic",
|
||||
"can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name",
|
||||
"can_see_other_account_number",
|
||||
"can_see_other_account_metadata",
|
||||
"can_see_other_account_kind",
|
||||
"can_see_more_info",
|
||||
"can_see_url",
|
||||
"can_see_image_url",
|
||||
"can_see_open_corporates_url",
|
||||
"can_see_corporate_location",
|
||||
"can_see_physical_location",
|
||||
"can_see_public_alias",
|
||||
"can_see_private_alias",
|
||||
"can_add_more_info",
|
||||
"can_add_url",
|
||||
"can_add_image_url",
|
||||
"can_add_open_corporates_url",
|
||||
"can_add_corporate_location",
|
||||
"can_add_physical_location",
|
||||
"can_add_public_alias",
|
||||
"can_add_private_alias",
|
||||
"can_delete_corporate_location",
|
||||
"can_delete_physical_location",
|
||||
"can_edit_narrative",
|
||||
"can_add_comment",
|
||||
"can_delete_comment",
|
||||
"can_add_tag",
|
||||
"can_delete_tag",
|
||||
"can_add_image",
|
||||
"can_delete_image",
|
||||
"can_add_where_tag",
|
||||
"can_see_where_tag",
|
||||
"can_delete_where_tag",
|
||||
"can_create_counterparty",
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
|
||||
//V300 New
|
||||
"can_see_bank_routing_scheme",
|
||||
"can_see_bank_routing_address",
|
||||
"can_see_bank_account_routing_scheme",
|
||||
"can_see_bank_account_routing_address",
|
||||
"can_see_other_bank_routing_scheme",
|
||||
"can_see_other_bank_routing_address",
|
||||
"can_see_other_account_routing_scheme",
|
||||
"can_see_other_account_routing_address",
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
//v310
|
||||
"can_query_available_funds"
|
||||
CAN_QUERY_AVAILABLE_FUNDS
|
||||
)
|
||||
)
|
||||
lazy val updateSystemViewJson310 = updateViewJsonV300.copy(is_public = false, is_firehose = Some(false))
|
||||
@ -845,75 +840,72 @@ object SwaggerDefinitionsJSON {
|
||||
which_alias_to_use = "family",
|
||||
hide_metadata_if_alias_used = false,
|
||||
allowed_actions = List(
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_amount",
|
||||
"can_see_transaction_type",
|
||||
"can_see_transaction_currency",
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date",
|
||||
"can_see_transaction_balance",
|
||||
"can_see_comments",
|
||||
"can_see_narrative",
|
||||
"can_see_tags",
|
||||
"can_see_images",
|
||||
"can_see_bank_account_owners",
|
||||
"can_see_bank_account_type",
|
||||
"can_see_bank_account_balance",
|
||||
"can_see_bank_account_currency",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic",
|
||||
"can_see_bank_account_iban",
|
||||
"can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name",
|
||||
"can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic",
|
||||
"can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name",
|
||||
"can_see_other_account_number",
|
||||
"can_see_other_account_metadata",
|
||||
"can_see_other_account_kind",
|
||||
"can_see_more_info",
|
||||
"can_see_url",
|
||||
"can_see_image_url",
|
||||
"can_see_open_corporates_url",
|
||||
"can_see_corporate_location",
|
||||
"can_see_physical_location",
|
||||
"can_see_public_alias",
|
||||
"can_see_private_alias",
|
||||
"can_add_more_info",
|
||||
"can_add_url",
|
||||
"can_add_image_url",
|
||||
"can_add_open_corporates_url",
|
||||
"can_add_corporate_location",
|
||||
"can_add_physical_location",
|
||||
"can_add_public_alias",
|
||||
"can_add_private_alias",
|
||||
"can_delete_corporate_location",
|
||||
"can_delete_physical_location",
|
||||
"can_edit_narrative",
|
||||
"can_add_comment",
|
||||
"can_delete_comment",
|
||||
"can_add_tag",
|
||||
"can_delete_tag",
|
||||
"can_add_image",
|
||||
"can_delete_image",
|
||||
"can_add_where_tag",
|
||||
"can_see_where_tag",
|
||||
"can_delete_where_tag",
|
||||
"can_create_counterparty",
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
|
||||
//V300 New
|
||||
"can_see_bank_routing_scheme",
|
||||
"can_see_bank_routing_address",
|
||||
"can_see_bank_account_routing_scheme",
|
||||
"can_see_bank_account_routing_address",
|
||||
"can_see_other_bank_routing_scheme",
|
||||
"can_see_other_bank_routing_address",
|
||||
"can_see_other_account_routing_scheme",
|
||||
"can_see_other_account_routing_address"
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS
|
||||
)
|
||||
)
|
||||
|
||||
@ -923,75 +915,72 @@ object SwaggerDefinitionsJSON {
|
||||
which_alias_to_use = "family",
|
||||
hide_metadata_if_alias_used = false,
|
||||
allowed_actions = List(
|
||||
"can_see_transaction_this_bank_account",
|
||||
"can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata",
|
||||
"can_see_transaction_label",
|
||||
"can_see_transaction_amount",
|
||||
"can_see_transaction_type",
|
||||
"can_see_transaction_currency",
|
||||
"can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date",
|
||||
"can_see_transaction_balance",
|
||||
"can_see_comments",
|
||||
"can_see_narrative",
|
||||
"can_see_tags",
|
||||
"can_see_images",
|
||||
"can_see_bank_account_owners",
|
||||
"can_see_bank_account_type",
|
||||
"can_see_bank_account_balance",
|
||||
"can_see_bank_account_currency",
|
||||
"can_see_bank_account_label",
|
||||
"can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic",
|
||||
"can_see_bank_account_iban",
|
||||
"can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name",
|
||||
"can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic",
|
||||
"can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name",
|
||||
"can_see_other_account_number",
|
||||
"can_see_other_account_metadata",
|
||||
"can_see_other_account_kind",
|
||||
"can_see_more_info",
|
||||
"can_see_url",
|
||||
"can_see_image_url",
|
||||
"can_see_open_corporates_url",
|
||||
"can_see_corporate_location",
|
||||
"can_see_physical_location",
|
||||
"can_see_public_alias",
|
||||
"can_see_private_alias",
|
||||
"can_add_more_info",
|
||||
"can_add_url",
|
||||
"can_add_image_url",
|
||||
"can_add_open_corporates_url",
|
||||
"can_add_corporate_location",
|
||||
"can_add_physical_location",
|
||||
"can_add_public_alias",
|
||||
"can_add_private_alias",
|
||||
"can_delete_corporate_location",
|
||||
"can_delete_physical_location",
|
||||
"can_edit_narrative",
|
||||
"can_add_comment",
|
||||
"can_delete_comment",
|
||||
"can_add_tag",
|
||||
"can_delete_tag",
|
||||
"can_add_image",
|
||||
"can_delete_image",
|
||||
"can_add_where_tag",
|
||||
"can_see_where_tag",
|
||||
"can_delete_where_tag",
|
||||
"can_create_counterparty",
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
|
||||
//V300 New
|
||||
"can_see_bank_routing_scheme",
|
||||
"can_see_bank_routing_address",
|
||||
"can_see_bank_account_routing_scheme",
|
||||
"can_see_bank_account_routing_address",
|
||||
"can_see_other_bank_routing_scheme",
|
||||
"can_see_other_bank_routing_address",
|
||||
"can_see_other_account_routing_scheme",
|
||||
"can_see_other_account_routing_address"
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS
|
||||
)
|
||||
)
|
||||
lazy val viewsJSONV121 = ViewsJSONV121(
|
||||
@ -5701,6 +5690,11 @@ object SwaggerDefinitionsJSON {
|
||||
lazy val bankAccountBalancesJsonV510 = BankAccountBalancesJsonV510(
|
||||
balances = List(bankAccountBalanceResponseJsonV510)
|
||||
)
|
||||
|
||||
lazy val createViewPermissionJson = CreateViewPermissionJson(
|
||||
permission_name = CAN_GRANT_ACCESS_TO_VIEWS,
|
||||
extra_data = Some(List(SYSTEM_ACCOUNTANT_VIEW_ID, SYSTEM_AUDITOR_VIEW_ID))
|
||||
)
|
||||
//The common error or success format.
|
||||
//Just some helper format to use in Json
|
||||
case class NotSupportedYet()
|
||||
|
||||
@ -6,22 +6,22 @@ import code.api.berlin.group.v1_3.JvalueCaseClass
|
||||
import code.api.util.APIUtil.{defaultBankId, _}
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.{ApiTag, NewStyle}
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{ApiTag, NewStyle}
|
||||
import code.bankconnectors.Connector
|
||||
import code.model._
|
||||
import code.util.Helper
|
||||
import code.views.Views
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId, ViewId}
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId}
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json
|
||||
import net.liftweb.json._
|
||||
|
||||
import scala.collection.immutable.Nil
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.Future
|
||||
|
||||
object APIMethods_AISPApi extends RestHelper {
|
||||
@ -112,7 +112,7 @@ The ASPSP answers by providing a list of balances on this account.
|
||||
_ <- Helper.booleanToFuture(failMsg= DefaultBankIdNotSet, cc=callContext) { defaultBankId != "DEFAULT_BANK_ID_NOT_SET" }
|
||||
(_, callContext) <- NewStyle.function.getBank(BankId(defaultBankId), callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(BankId(defaultBankId), AccountId(accountresourceid), callContext)
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
moderatedAccount <- Future {bankAccount.moderatedBankAccount(view, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), Full(u), callContext)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
@ -299,7 +299,7 @@ The AISP requests the ASPSP on one of the PSU's accounts. It may specify some se
|
||||
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, AccountId(accountresourceid), callContext)
|
||||
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
|
||||
params <- Future { createQueriesByHttpParams(callContext.get.requestHeaders)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
|
||||
@ -5,19 +5,17 @@ import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages.{InvalidConnectorResponseForGetTransactionRequests210, UnknownError, UserNotLoggedIn, _}
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import code.api.util.{ ErrorMessages, NewStyle}
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{ErrorMessages, NewStyle}
|
||||
import code.bankconnectors.Connector
|
||||
import code.model._
|
||||
import code.util.Helper
|
||||
import code.views.Views
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId, ViewId}
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId}
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
|
||||
import scala.collection.immutable.Nil
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.Future
|
||||
|
||||
object APIMethods_UKOpenBanking_200 extends RestHelper{
|
||||
@ -92,7 +90,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{
|
||||
(bankAccount, callContext) <- Future { BankAccountX(BankId(defaultBankId), accountId, callContext) } map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
params <- Future { createQueriesByHttpParams(callContext.get.requestHeaders)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
@ -181,7 +179,7 @@ object APIMethods_UKOpenBanking_200 extends RestHelper{
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(DefaultBankIdNotSet, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
|
||||
moderatedAccount <- Future {account.moderatedBankAccount(view, BankIdAccountId(account.bankId, account.accountId), Full(u), callContext)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
|
||||
@ -3,21 +3,19 @@ package code.api.UKOpenBanking.v3_1_0
|
||||
import code.api.Constant
|
||||
import code.api.berlin.group.v1_3.JvalueCaseClass
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{ApiTag, NewStyle}
|
||||
|
||||
import code.views.Views
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model.{AccountId, BankIdAccountId, View, ViewId}
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json
|
||||
import net.liftweb.json._
|
||||
|
||||
import scala.collection.immutable.Nil
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
|
||||
object APIMethods_BalancesApi extends RestHelper {
|
||||
val apiVersion = OBP_UKOpenBanking_310.apiVersion
|
||||
@ -117,7 +115,7 @@ object APIMethods_BalancesApi extends RestHelper {
|
||||
_ <- NewStyle.function.checkUKConsent(user, callContext)
|
||||
_ <- passesPsd2Aisp(callContext)
|
||||
(account, callContext) <- NewStyle.function.getBankAccountByAccountId(accountId, callContext)
|
||||
view: View <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, accountId), Full(user), callContext)
|
||||
view: View <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, accountId), Full(user), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, Full(user), callContext)
|
||||
} yield {
|
||||
(JSONFactory_UKOpenBanking_310.createAccountBalanceJSON(moderatedAccount), callContext)
|
||||
|
||||
@ -1,25 +1,24 @@
|
||||
package code.api.UKOpenBanking.v3_1_0
|
||||
|
||||
import code.api.{APIFailureNewStyle, Constant}
|
||||
import code.api.berlin.group.v1_3.JvalueCaseClass
|
||||
import code.api.util.APIUtil.{defaultBankId, _}
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{ApiTag, NewStyle}
|
||||
import code.api.{APIFailureNewStyle, Constant}
|
||||
import code.bankconnectors.Connector
|
||||
import code.model._
|
||||
import code.views.Views
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.model.{AccountId, BankId, BankIdAccountId, TransactionAttribute, ViewId}
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.Full
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json
|
||||
import net.liftweb.json._
|
||||
|
||||
import scala.collection.immutable.Nil
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
object APIMethods_TransactionsApi extends RestHelper {
|
||||
@ -758,7 +757,7 @@ object APIMethods_TransactionsApi extends RestHelper {
|
||||
_ <- passesPsd2Aisp(callContext)
|
||||
(account, callContext) <- NewStyle.function.getBankAccountByAccountId(accountId, callContext)
|
||||
(bank, callContext) <- NewStyle.function.getBank(account.bankId, callContext)
|
||||
view <- NewStyle.function.checkViewsAccessAndReturnView(detailViewId, basicViewId, BankIdAccountId(account.bankId, accountId), Full(u), callContext)
|
||||
view <- ViewNewStyle.checkViewsAccessAndReturnView(detailViewId, basicViewId, BankIdAccountId(account.bankId, accountId), Full(u), callContext)
|
||||
params <- Future { createQueriesByHttpParams(callContext.get.requestHeaders)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
|
||||
@ -11,6 +11,7 @@ import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.consent.{ConsentStatus, Consents}
|
||||
import code.context.{ConsentAuthContextProvider, UserAuthContextProvider}
|
||||
import code.model
|
||||
@ -641,7 +642,7 @@ Reads account data from a given card account addressed by "account-id".
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankAccount.bankId, callContext)
|
||||
viewId = ViewId(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID)
|
||||
bankIdAccountId = BankIdAccountId(bankAccount.bankId, bankAccount.accountId)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
params <- Future { createQueriesByHttpParams(callContext.get.requestHeaders)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
@ -875,7 +876,7 @@ of the "Read Transaction List" call within the _links subfield.
|
||||
(account: BankAccount, callContext) <- NewStyle.function.getBankAccountByAccountId(AccountId(accountId), callContext)
|
||||
viewId = ViewId(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID)
|
||||
bankIdAccountId = BankIdAccountId(account.bankId, account.accountId)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(user), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(user), callContext)
|
||||
(moderatedTransaction, callContext) <- account.moderatedTransactionFuture(TransactionId(transactionId), view, Some(user), callContext) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionsException)
|
||||
}
|
||||
@ -969,7 +970,7 @@ The ASPSP might add balance information, if transaction lists without balances a
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankAccount.bankId, callContext)
|
||||
viewId = ViewId(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID)
|
||||
bankIdAccountId = BankIdAccountId(bankAccount.bankId, bankAccount.accountId)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
params <- Future { createQueriesByHttpParams(callContext.get.requestHeaders)} map {
|
||||
x => fullBoxOrException(x ~> APIFailureNewStyle(UnknownError, 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
|
||||
@ -23,7 +23,7 @@ object Constant extends MdcLoggable {
|
||||
final val h2DatabaseDefaultUrlValue = "jdbc:h2:mem:OBPTest_H2_v2.1.214;NON_KEYWORDS=VALUE;DB_CLOSE_DELAY=10"
|
||||
|
||||
final val HostName = APIUtil.getPropsValue("hostname").openOrThrowException(ErrorMessages.HostnameNotSpecified)
|
||||
final val Connector = APIUtil.getPropsValue("connector")
|
||||
final val CONNECTOR = APIUtil.getPropsValue("connector")
|
||||
final val openidConnectEnabled = APIUtil.getPropsAsBoolValue("openid_connect.enabled", false)
|
||||
|
||||
final val bgRemoveSignOfAmounts = APIUtil.getPropsAsBoolValue("BG_remove_sign_of_amounts", false)
|
||||
@ -128,6 +128,380 @@ object Constant extends MdcLoggable {
|
||||
final val GET_STATIC_RESOURCE_DOCS_TTL: Int = APIUtil.getPropsValue(s"staticResourceDocsObp.cache.ttl.seconds", "3600").toInt
|
||||
final val SHOW_USED_CONNECTOR_METHODS: Boolean = APIUtil.getPropsAsBoolValue(s"show_used_connector_methods", false)
|
||||
|
||||
final val CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT = "can_see_transaction_other_bank_account"
|
||||
final val CAN_SEE_TRANSACTION_METADATA = "can_see_transaction_metadata"
|
||||
final val CAN_SEE_TRANSACTION_DESCRIPTION = "can_see_transaction_description"
|
||||
final val CAN_SEE_TRANSACTION_AMOUNT = "can_see_transaction_amount"
|
||||
final val CAN_SEE_TRANSACTION_TYPE = "can_see_transaction_type"
|
||||
final val CAN_SEE_TRANSACTION_CURRENCY = "can_see_transaction_currency"
|
||||
final val CAN_SEE_TRANSACTION_START_DATE = "can_see_transaction_start_date"
|
||||
final val CAN_SEE_TRANSACTION_FINISH_DATE = "can_see_transaction_finish_date"
|
||||
final val CAN_SEE_TRANSACTION_BALANCE = "can_see_transaction_balance"
|
||||
final val CAN_SEE_COMMENTS = "can_see_comments"
|
||||
final val CAN_SEE_OWNER_COMMENT = "can_see_owner_comment"
|
||||
final val CAN_SEE_TAGS = "can_see_tags"
|
||||
final val CAN_SEE_IMAGES = "can_see_images"
|
||||
final val CAN_SEE_BANK_ACCOUNT_OWNERS = "can_see_bank_account_owners"
|
||||
final val CAN_SEE_BANK_ACCOUNT_TYPE = "can_see_bank_account_type"
|
||||
final val CAN_SEE_BANK_ACCOUNT_BALANCE = "can_see_bank_account_balance"
|
||||
final val CAN_QUERY_AVAILABLE_FUNDS = "can_query_available_funds"
|
||||
final val CAN_SEE_BANK_ACCOUNT_LABEL = "can_see_bank_account_label"
|
||||
final val CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER = "can_see_bank_account_national_identifier"
|
||||
final val CAN_SEE_BANK_ACCOUNT_SWIFT_BIC = "can_see_bank_account_swift_bic"
|
||||
final val CAN_SEE_BANK_ACCOUNT_IBAN = "can_see_bank_account_iban"
|
||||
final val CAN_SEE_BANK_ACCOUNT_NUMBER = "can_see_bank_account_number"
|
||||
final val CAN_SEE_BANK_ACCOUNT_BANK_NAME = "can_see_bank_account_bank_name"
|
||||
final val CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK = "can_see_bank_account_bank_permalink"
|
||||
final val CAN_SEE_BANK_ROUTING_SCHEME = "can_see_bank_routing_scheme"
|
||||
final val CAN_SEE_BANK_ROUTING_ADDRESS = "can_see_bank_routing_address"
|
||||
final val CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME = "can_see_bank_account_routing_scheme"
|
||||
final val CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS = "can_see_bank_account_routing_address"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER = "can_see_other_account_national_identifier"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC = "can_see_other_account_swift_bic"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_IBAN = "can_see_other_account_iban"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_BANK_NAME = "can_see_other_account_bank_name"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_NUMBER = "can_see_other_account_number"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_METADATA = "can_see_other_account_metadata"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_KIND = "can_see_other_account_kind"
|
||||
final val CAN_SEE_OTHER_BANK_ROUTING_SCHEME = "can_see_other_bank_routing_scheme"
|
||||
final val CAN_SEE_OTHER_BANK_ROUTING_ADDRESS = "can_see_other_bank_routing_address"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME = "can_see_other_account_routing_scheme"
|
||||
final val CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS = "can_see_other_account_routing_address"
|
||||
final val CAN_SEE_MORE_INFO = "can_see_more_info"
|
||||
final val CAN_SEE_URL = "can_see_url"
|
||||
final val CAN_SEE_IMAGE_URL = "can_see_image_url"
|
||||
final val CAN_SEE_OPEN_CORPORATES_URL = "can_see_open_corporates_url"
|
||||
final val CAN_SEE_CORPORATE_LOCATION = "can_see_corporate_location"
|
||||
final val CAN_SEE_PHYSICAL_LOCATION = "can_see_physical_location"
|
||||
final val CAN_SEE_PUBLIC_ALIAS = "can_see_public_alias"
|
||||
final val CAN_SEE_PRIVATE_ALIAS = "can_see_private_alias"
|
||||
final val CAN_ADD_MORE_INFO = "can_add_more_info"
|
||||
final val CAN_ADD_URL = "can_add_url"
|
||||
final val CAN_ADD_IMAGE_URL = "can_add_image_url"
|
||||
final val CAN_ADD_OPEN_CORPORATES_URL = "can_add_open_corporates_url"
|
||||
final val CAN_ADD_CORPORATE_LOCATION = "can_add_corporate_location"
|
||||
final val CAN_ADD_PHYSICAL_LOCATION = "can_add_physical_location"
|
||||
final val CAN_ADD_PUBLIC_ALIAS = "can_add_public_alias"
|
||||
final val CAN_ADD_PRIVATE_ALIAS = "can_add_private_alias"
|
||||
final val CAN_ADD_COUNTERPARTY = "can_add_counterparty"
|
||||
final val CAN_GET_COUNTERPARTY = "can_get_counterparty"
|
||||
final val CAN_DELETE_COUNTERPARTY = "can_delete_counterparty"
|
||||
final val CAN_DELETE_CORPORATE_LOCATION = "can_delete_corporate_location"
|
||||
final val CAN_DELETE_PHYSICAL_LOCATION = "can_delete_physical_location"
|
||||
final val CAN_EDIT_OWNER_COMMENT = "can_edit_owner_comment"
|
||||
final val CAN_ADD_COMMENT = "can_add_comment"
|
||||
final val CAN_DELETE_COMMENT = "can_delete_comment"
|
||||
final val CAN_ADD_TAG = "can_add_tag"
|
||||
final val CAN_DELETE_TAG = "can_delete_tag"
|
||||
final val CAN_ADD_IMAGE = "can_add_image"
|
||||
final val CAN_DELETE_IMAGE = "can_delete_image"
|
||||
final val CAN_ADD_WHERE_TAG = "can_add_where_tag"
|
||||
final val CAN_SEE_WHERE_TAG = "can_see_where_tag"
|
||||
final val CAN_DELETE_WHERE_TAG = "can_delete_where_tag"
|
||||
final val CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT = "can_add_transaction_request_to_own_account"
|
||||
final val CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT = "can_add_transaction_request_to_any_account"
|
||||
final val CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT = "can_see_bank_account_credit_limit"
|
||||
final val CAN_CREATE_DIRECT_DEBIT = "can_create_direct_debit"
|
||||
final val CAN_CREATE_STANDING_ORDER = "can_create_standing_order"
|
||||
final val CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS = "can_revoke_access_to_custom_views"
|
||||
final val CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS = "can_grant_access_to_custom_views"
|
||||
final val CAN_SEE_TRANSACTION_REQUESTS = "can_see_transaction_requests"
|
||||
final val CAN_SEE_TRANSACTION_REQUEST_TYPES = "can_see_transaction_request_types"
|
||||
final val CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT = "can_see_available_views_for_bank_account"
|
||||
final val CAN_UPDATE_BANK_ACCOUNT_LABEL = "can_update_bank_account_label"
|
||||
final val CAN_CREATE_CUSTOM_VIEW = "can_create_custom_view"
|
||||
final val CAN_DELETE_CUSTOM_VIEW = "can_delete_custom_view"
|
||||
final val CAN_UPDATE_CUSTOM_VIEW = "can_update_custom_view"
|
||||
final val CAN_GET_CUSTOM_VIEW = "can_get_custom_view"
|
||||
final val CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS = "can_see_views_with_permissions_for_all_users"
|
||||
final val CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER = "can_see_views_with_permissions_for_one_user"
|
||||
final val CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT = "can_see_transaction_this_bank_account"
|
||||
final val CAN_SEE_TRANSACTION_STATUS = "can_see_transaction_status"
|
||||
final val CAN_SEE_BANK_ACCOUNT_CURRENCY = "can_see_bank_account_currency"
|
||||
final val CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY = "can_add_transaction_request_to_beneficiary"
|
||||
final val CAN_GRANT_ACCESS_TO_VIEWS = "can_grant_access_to_views"
|
||||
final val CAN_REVOKE_ACCESS_TO_VIEWS = "can_revoke_access_to_views"
|
||||
|
||||
final val SYSTEM_OWNER_VIEW_PERMISSION_ADMIN = List(
|
||||
CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_REQUESTS,
|
||||
CAN_SEE_TRANSACTION_REQUEST_TYPES,
|
||||
CAN_UPDATE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS,
|
||||
CAN_SEE_TRANSACTION_DESCRIPTION,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY,
|
||||
CAN_GRANT_ACCESS_TO_VIEWS,
|
||||
CAN_REVOKE_ACCESS_TO_VIEWS
|
||||
)
|
||||
|
||||
final val SYSTEM_MANAGER_VIEW_PERMISSION = List(
|
||||
CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_CREATE_CUSTOM_VIEW,
|
||||
CAN_DELETE_CUSTOM_VIEW,
|
||||
CAN_UPDATE_CUSTOM_VIEW,
|
||||
CAN_GET_CUSTOM_VIEW
|
||||
)
|
||||
|
||||
final val SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_PERMISSION = List(
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY
|
||||
)
|
||||
|
||||
final val SYSTEM_PUBLIC_VIEW_PERMISSION = List(
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_OWNER_COMMENT,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_ADD_COUNTERPARTY,
|
||||
CAN_GET_COUNTERPARTY,
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_TRANSACTION_STATUS
|
||||
)
|
||||
|
||||
final val SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_PERMISSION = List(
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_DESCRIPTION,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY
|
||||
)
|
||||
|
||||
final val SYSTEM_VIEW_PERMISSION_COMMON = List(
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_OWNER_COMMENT,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_ADD_COUNTERPARTY,
|
||||
CAN_GET_COUNTERPARTY,
|
||||
CAN_DELETE_COUNTERPARTY,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_TRANSACTION_STATUS,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT
|
||||
)
|
||||
|
||||
final val ALL_VIEW_PERMISSION_NAMES = List(
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_DESCRIPTION,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_OWNER_COMMENT,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_QUERY_AVAILABLE_FUNDS,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK,
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_ADD_COUNTERPARTY,
|
||||
CAN_GET_COUNTERPARTY,
|
||||
CAN_DELETE_COUNTERPARTY,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,
|
||||
CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,
|
||||
CAN_CREATE_DIRECT_DEBIT,
|
||||
CAN_CREATE_STANDING_ORDER,
|
||||
CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS,
|
||||
CAN_SEE_TRANSACTION_REQUESTS,
|
||||
CAN_SEE_TRANSACTION_REQUEST_TYPES,
|
||||
CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT,
|
||||
CAN_UPDATE_BANK_ACCOUNT_LABEL,
|
||||
CAN_CREATE_CUSTOM_VIEW,
|
||||
CAN_DELETE_CUSTOM_VIEW,
|
||||
CAN_UPDATE_CUSTOM_VIEW,
|
||||
CAN_GET_CUSTOM_VIEW,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS,
|
||||
CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER,
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_STATUS,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY,
|
||||
CAN_GRANT_ACCESS_TO_VIEWS,
|
||||
CAN_REVOKE_ACCESS_TO_VIEWS,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
|
||||
package code.api.util
|
||||
|
||||
import bootstrap.liftweb.CustomDBVendor
|
||||
import code.accountholders.AccountHolders
|
||||
import code.api.Constant._
|
||||
@ -49,6 +48,7 @@ import code.api.util.ApiTag.{ResourceDocTag, apiTagBank}
|
||||
import code.api.util.BerlinGroupSigning.getCertificateFromTppSignatureCertificate
|
||||
import code.api.util.FutureUtil.{EndpointContext, EndpointTimeout}
|
||||
import code.api.util.Glossary.GlossaryItem
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.v1_2.ErrorMessage
|
||||
import code.api.v2_0_0.CreateEntitlementJSON
|
||||
import code.api.v2_2_0.OBPAPI2_2_0.Implementations2_2_0
|
||||
@ -67,7 +67,7 @@ import code.usercustomerlinks.UserCustomerLink
|
||||
import code.users.Users
|
||||
import code.util.Helper.{MdcLoggable, ObpS, SILENCE_IS_GOLDEN}
|
||||
import code.util.{Helper, JsonSchemaUtil}
|
||||
import code.views.system.{AccountAccess, ViewDefinition}
|
||||
import code.views.system.AccountAccess
|
||||
import code.views.{MapperViews, Views}
|
||||
import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue
|
||||
import com.alibaba.ttl.internal.javassist.CannotCompileException
|
||||
@ -3476,7 +3476,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
)= createOBPId(s"$thisBankId$thisAccountId$counterpartyName$otherAccountRoutingScheme$otherAccountRoutingAddress")
|
||||
|
||||
def isDataFromOBPSide (methodName: String, argNameToValue: Array[(String, AnyRef)] = Array.empty): Boolean = {
|
||||
val connectorNameInProps = code.api.Constant.Connector.openOrThrowException(attemptedToOpenAnEmptyBox)
|
||||
val connectorNameInProps = code.api.Constant.CONNECTOR.openOrThrowException(attemptedToOpenAnEmptyBox)
|
||||
//if the connector == mapped, then the data is always over obp database
|
||||
if(connectorNameInProps == "mapped") {
|
||||
true
|
||||
@ -3719,9 +3719,9 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
|
||||
lazy val view = APIUtil.checkViewAccessAndReturnView(viewId, bankAccountId, Some(user), callContext)
|
||||
|
||||
lazy val canAddTransactionRequestToAnyAccount = view.map(_.canAddTransactionRequestToAnyAccount).getOrElse(false)
|
||||
lazy val canAddTransactionRequestToAnyAccount = view.map(_.allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)).getOrElse(false)
|
||||
|
||||
lazy val canAddTransactionRequestToBeneficiary = view.map(_.canAddTransactionRequestToBeneficiary).getOrElse(false)
|
||||
lazy val canAddTransactionRequestToBeneficiary = view.map(_.allowed_actions.exists( _ == CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY )).getOrElse(false)
|
||||
//1st check the admin level role/entitlement `canCreateAnyTransactionRequest`
|
||||
if (hasCanCreateAnyTransactionRequestRole) {
|
||||
Full(true)
|
||||
@ -4189,8 +4189,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
allCanGrantAccessToViewsPermissions.contains(targetViewId.value)
|
||||
} else{
|
||||
//2. if targetViewId is customView, we only need to check the `canGrantAccessToCustomViews`.
|
||||
val allCanGrantAccessToCustomViewsPermissions: List[Boolean] = permission.map(_.views.map(_.canGrantAccessToCustomViews)).getOrElse(Nil)
|
||||
|
||||
val allCanGrantAccessToCustomViewsPermissions: List[Boolean] = permission.map(_.views.map(_.allowed_actions.exists(_ == CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS))).getOrElse(Nil)
|
||||
allCanGrantAccessToCustomViewsPermissions.contains(true)
|
||||
}
|
||||
}
|
||||
@ -4200,13 +4199,13 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
//1st: get the view
|
||||
val view: Box[View] = Views.views.vend.getViewByBankIdAccountIdViewIdUserPrimaryKey(bankIdAccountIdViewId, user.userPrimaryKey)
|
||||
|
||||
//2rd: If targetViewId is systemView. we need to check `view.canGrantAccessToViews` field.
|
||||
//2nd: If targetViewId is systemView. we need to check `view.canGrantAccessToViews` field.
|
||||
if(isValidSystemViewId(targetViewId.value)){
|
||||
val canGrantAccessToSystemViews: Box[List[String]] = view.map(_.canGrantAccessToViews.getOrElse(Nil))
|
||||
canGrantAccessToSystemViews.getOrElse(Nil).contains(targetViewId.value)
|
||||
} else{
|
||||
//3rd. if targetViewId is customView, we need to check `view.canGrantAccessToCustomViews` field.
|
||||
view.map(_.canGrantAccessToCustomViews).getOrElse(false)
|
||||
view.map(_.allowed_actions.exists(_ == CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS)).getOrElse(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -4225,7 +4224,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
//if the targetViewIds contains custom view ids, we need to check the both canGrantAccessToCustomViews and canGrantAccessToSystemViews
|
||||
if (targetViewIds.map(_.value).distinct.find(isValidCustomViewId).isDefined){
|
||||
//check if we can grant all customViews Access.
|
||||
val allCanGrantAccessToCustomViewsPermissions: List[Boolean] = permissionBox.map(_.views.map(_.canGrantAccessToCustomViews)).getOrElse(Nil)
|
||||
val allCanGrantAccessToCustomViewsPermissions: List[Boolean] = permissionBox.map(_.views.map(_.allowed_actions.exists(_ ==CAN_GRANT_ACCESS_TO_CUSTOM_VIEWS))).getOrElse(Nil)
|
||||
val canGrantAccessToAllCustomViews = allCanGrantAccessToCustomViewsPermissions.contains(true)
|
||||
//we need merge both system and custom access
|
||||
canGrantAllSystemViewsIdsTobeGranted && canGrantAccessToAllCustomViews
|
||||
@ -4244,7 +4243,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
canRevokeAccessToSystemViews.getOrElse(Nil).contains(targetViewId.value)
|
||||
} else {
|
||||
//3rd. if targetViewId is customView, we need to check `view.canGrantAccessToCustomViews` field.
|
||||
view.map(_.canRevokeAccessToCustomViews).getOrElse(false)
|
||||
view.map(_.allowed_actions.exists(_ == CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS)).getOrElse(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -4261,7 +4260,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
allCanRevokeAccessToSystemViews.contains(targetViewId.value)
|
||||
} else {
|
||||
//2. if targetViewId is customView, we only need to check the `canRevokeAccessToCustomViews`.
|
||||
val allCanRevokeAccessToCustomViewsPermissions: List[Boolean] = permission.map(_.views.map(_.canRevokeAccessToCustomViews)).getOrElse(Nil)
|
||||
val allCanRevokeAccessToCustomViewsPermissions: List[Boolean] = permission.map(_.views.map(_.allowed_actions.exists( _ ==CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS))).getOrElse(Nil)
|
||||
|
||||
allCanRevokeAccessToCustomViewsPermissions.contains(true)
|
||||
}
|
||||
@ -4285,7 +4284,8 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
//if allTargetViewIds contains customViewId,we need to check both `canRevokeAccessToCustomViews` and `canRevokeAccessToSystemViews` fields
|
||||
if (allTargetViewIds.find(isValidCustomViewId).isDefined) {
|
||||
//check if we can revoke all customViews Access
|
||||
val allCanRevokeAccessToCustomViewsPermissions: List[Boolean] = permissionBox.map(_.views.map(_.canRevokeAccessToCustomViews)).getOrElse(Nil)
|
||||
val allCanRevokeAccessToCustomViewsPermissions: List[Boolean] = permissionBox.map(_.views.map(_.allowed_actions.exists( _ ==CAN_REVOKE_ACCESS_TO_CUSTOM_VIEWS))).getOrElse(Nil)
|
||||
|
||||
val canRevokeAccessToAllCustomViews = allCanRevokeAccessToCustomViewsPermissions.contains(true)
|
||||
//we need merge both system and custom access
|
||||
canRevokeAccessToAllSystemTargetViews && canRevokeAccessToAllCustomViews
|
||||
@ -4326,7 +4326,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
case x => NewStyle.function.getBankAccount(x, _, _)
|
||||
}
|
||||
private val checkViewFun: PartialFunction[ViewId, (BankIdAccountId, Option[User], Option[CallContext]) => Future[View]] = {
|
||||
case x => NewStyle.function.checkViewAccessAndReturnView(x, _, _, _)
|
||||
case x => ViewNewStyle.checkViewAccessAndReturnView(x, _, _, _)
|
||||
}
|
||||
private val checkCounterpartyFun: PartialFunction[CounterpartyId, Option[CallContext] => OBPReturnType[CounterpartyTrait]] = {
|
||||
case x => NewStyle.function.getCounterpartyByCounterpartyId(x, _)
|
||||
@ -5059,16 +5059,4 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|
||||
.distinct // List pairs (bank_id, account_id)
|
||||
}
|
||||
|
||||
//get all the permission Pair from one record, eg:
|
||||
//List("can_see_transaction_this_bank_account","can_see_transaction_requests"....)
|
||||
//Note, do not contain can_revoke_access_to_views and can_grant_access_to_views permission yet.
|
||||
def getViewPermissions(view: ViewDefinition) = view.allFields.map(x => (x.name, x.get))
|
||||
.filter(pair =>pair._2.isInstanceOf[Boolean])
|
||||
.filter(pair => pair._1.startsWith("can"))
|
||||
.filter(pair => pair._2.equals(true))
|
||||
.map(pair =>
|
||||
StringHelpers.snakify(pair._1)
|
||||
.dropRight(1) //Remove the "_" in the end, eg canCreateStandingOrder_ --> canCreateStandingOrder
|
||||
).toSet
|
||||
|
||||
}
|
||||
@ -1,14 +1,13 @@
|
||||
package code.api.util
|
||||
|
||||
import code.api.dynamic.endpoint.helper.DynamicEndpointHelper
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import code.api.dynamic.endpoint.helper.DynamicEndpointHelper
|
||||
import code.api.dynamic.entity.helper.DynamicEntityHelper
|
||||
import code.util.Helper.MdcLoggable
|
||||
import com.openbankproject.commons.util.{JsonAble, ReflectUtils}
|
||||
import net.liftweb.json.{Formats, JsonAST}
|
||||
import net.liftweb.json.JsonDSL._
|
||||
import net.liftweb.json.{Formats, JsonAST}
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
sealed trait ApiRole extends JsonAble {
|
||||
val requiresBankId: Boolean
|
||||
@ -210,6 +209,12 @@ object ApiRole extends MdcLoggable{
|
||||
|
||||
case class CanCreateEntitlementAtOneBank(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canCreateEntitlementAtOneBank = CanCreateEntitlementAtOneBank()
|
||||
|
||||
case class CanCreateSystemViewPermission(requiresBankId: Boolean = false) extends ApiRole
|
||||
lazy val canCreateSystemViewPermission = CanCreateSystemViewPermission()
|
||||
|
||||
case class CanDeleteSystemViewPermission(requiresBankId: Boolean = false) extends ApiRole
|
||||
lazy val canDeleteSystemViewPermission = CanDeleteSystemViewPermission()
|
||||
|
||||
case class CanDeleteEntitlementAtOneBank(requiresBankId: Boolean = true) extends ApiRole
|
||||
lazy val canDeleteEntitlementAtOneBank = CanDeleteEntitlementAtOneBank()
|
||||
|
||||
@ -557,6 +557,11 @@ object ErrorMessages {
|
||||
val CannotAddEntitlement = "OBP-30332: Failed to add entitlement. Please check the provided details and try again."
|
||||
val CannotGetEntitlements = "OBP-30333: Cannot get entitlements for user id."
|
||||
|
||||
val ViewPermissionNameExists = "OBP-30334: View Permission name already exists. Please specify a different value."
|
||||
val CreateViewPermissionError = "OBP-30335: Could not create the View Permission."
|
||||
val ViewPermissionNotFound = "OBP-30336: View Permission not found by name. "
|
||||
val InvalidViewPermissionName = "OBP-30337: The view permission name does not exist in OBP."
|
||||
val DeleteViewPermissionError = "OBP-30338: Could not delete the View Permission."
|
||||
|
||||
// Branch related messages
|
||||
val BranchesNotFoundLicense = "OBP-32001: No branches available. License may not be set."
|
||||
|
||||
@ -2,6 +2,7 @@ package code.api.util
|
||||
|
||||
|
||||
import code.api.Constant
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.{DateWithMs, DateWithMsExampleString, formatDate, oneYearAgoDate, parseDate}
|
||||
import code.api.util.ErrorMessages.{InvalidJsonFormat, UnknownError, UserHasMissingRoles, UserNotLoggedIn}
|
||||
import code.api.util.Glossary.{glossaryItems, makeGlossaryItem}
|
||||
@ -709,7 +710,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("count", countExample)
|
||||
|
||||
lazy val canSeeOtherAccountBankNameExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_bank_name", canSeeOtherAccountBankNameExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_BANK_NAME, canSeeOtherAccountBankNameExample)
|
||||
|
||||
lazy val handleExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("handle", handleExample)
|
||||
@ -730,7 +731,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("duration", durationExample)
|
||||
|
||||
lazy val canSeeBankAccountTypeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_type", canSeeBankAccountTypeExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_TYPE, canSeeBankAccountTypeExample)
|
||||
|
||||
lazy val toSepaExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("to_sepa", toSepaExample)
|
||||
@ -739,7 +740,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("which_alias_to_use", whichAliasToUseExample)
|
||||
|
||||
lazy val canAddImageExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_image", canAddImageExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_IMAGE, canAddImageExample)
|
||||
|
||||
lazy val accountAttributeIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("account_attribute_id", accountAttributeIdExample)
|
||||
@ -758,18 +759,18 @@ object ExampleValue {
|
||||
|
||||
lazy val statusExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("status", statusExample)
|
||||
|
||||
|
||||
lazy val transactionStatusExample = ConnectorField(s" ${TransactionRequestStatus.COMPLETED.toString}",s"Status of the transaction, e.g. ${TransactionRequestStatus.COMPLETED.toString}, ${TransactionRequestStatus.PENDING.toString} ..")
|
||||
glossaryItems += makeGlossaryItem("status", transactionStatusExample)
|
||||
|
||||
|
||||
lazy val errorCodeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("errorCode", errorCodeExample)
|
||||
|
||||
|
||||
lazy val textExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("text", textExample)
|
||||
|
||||
lazy val canSeeTransactionBalanceExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_balance", canSeeTransactionBalanceExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_BALANCE, canSeeTransactionBalanceExample)
|
||||
|
||||
lazy val atmsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("atms", atmsExample)
|
||||
@ -778,10 +779,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("overall_balance_date", overallBalanceDateExample)
|
||||
|
||||
lazy val canDeletePhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_delete_physical_location", canDeletePhysicalLocationExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_DELETE_PHYSICAL_LOCATION, canDeletePhysicalLocationExample)
|
||||
|
||||
lazy val canAddWhereTagExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_where_tag", canAddWhereTagExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_WHERE_TAG, canAddWhereTagExample)
|
||||
|
||||
lazy val pinResetExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("pin_reset", pinResetExample)
|
||||
@ -811,10 +812,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("active", activeExample)
|
||||
|
||||
lazy val canSeeOtherAccountMetadataExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_metadata", canSeeOtherAccountMetadataExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_METADATA, canSeeOtherAccountMetadataExample)
|
||||
|
||||
lazy val canSeeBankAccountIbanExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_iban", canSeeBankAccountIbanExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_IBAN, canSeeBankAccountIbanExample)
|
||||
|
||||
lazy val lobbyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("lobby", lobbyExample)
|
||||
@ -844,7 +845,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("function_name", functionNameExample)
|
||||
|
||||
lazy val canSeeBankRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_routing_scheme", canSeeBankRoutingSchemeExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ROUTING_SCHEME, canSeeBankRoutingSchemeExample)
|
||||
|
||||
lazy val line1Example = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("line1", line1Example)
|
||||
@ -865,7 +866,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("counterparties", counterpartiesExample)
|
||||
|
||||
lazy val canSeeMoreInfoExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_more_info", canSeeMoreInfoExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_MORE_INFO, canSeeMoreInfoExample)
|
||||
|
||||
lazy val transactionAttributesExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("transaction_attributes", transactionAttributesExample)
|
||||
@ -883,31 +884,31 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("images", imagesExample)
|
||||
|
||||
lazy val canSeeBankAccountBalanceExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_balance", canSeeBankAccountBalanceExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_BALANCE, canSeeBankAccountBalanceExample)
|
||||
|
||||
lazy val parametersExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("parameters", parametersExample)
|
||||
|
||||
lazy val canAddTransactionRequestToAnyAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_transaction_request_to_any_account", canAddTransactionRequestToAnyAccountExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT, canAddTransactionRequestToAnyAccountExample)
|
||||
|
||||
lazy val websiteExample = ConnectorField("www.openbankproject.com",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("website", websiteExample)
|
||||
|
||||
lazy val atmIdExample = ConnectorField("atme-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the ATM on this OBP instance.")
|
||||
glossaryItems += makeGlossaryItem("atm_id", atmIdExample)
|
||||
|
||||
|
||||
lazy val atmAttributeIdExample = ConnectorField("xxaf2a-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the ATM Attribute on this OBP instance.")
|
||||
glossaryItems += makeGlossaryItem("ATM.attribute_id", atmIdExample)
|
||||
|
||||
|
||||
lazy val entityIdExample = ConnectorField("0af807d7-3c39-43ef-9712-82bcfde1b9ca", "A unique identifier for the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_id", entityIdExample)
|
||||
|
||||
|
||||
lazy val certificateAuthorityCaOwnerIdExample = ConnectorField("CY_CBC", "The certificate authority owner ID.")
|
||||
glossaryItems += makeGlossaryItem("certificate_authority_ca_owner_id", certificateAuthorityCaOwnerIdExample)
|
||||
|
||||
|
||||
lazy val entityCertificatePublicKeyExample = ConnectorField(
|
||||
"MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbT" +
|
||||
"MIICsjCCAZqgAwIBAgIGAYwQ62R0MA0GCSqGSIb3DQEBCwUAMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbT" +
|
||||
"AeFw0yMzExMjcxMzE1MTFaFw0yNTExMjYxMzE1MTFaMBoxGDAWBgNVBAMMD2FwcC5leGFtcGxlLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADC" +
|
||||
"CAQoCggEBAK9WIodZHWzKyCcf9YfWEhPURbfO6zKuMqzHN27GdqHsVVEGxP4F/J4mso+0ENcRr6ur4u81iREaVdCc40rHDHVJNEtniD8Icbz7tcsq" +
|
||||
"AewIVhc/q6WXGqImJpCq7hA0m247dDsaZT0lb/MVBiMoJxDEmAE/GYYnWTEn84R35WhJsMvuQ7QmLvNg6RkChY6POCT/YKe9NKwa1NqI1U+oA5RFz" +
|
||||
@ -919,34 +920,34 @@ object ExampleValue {
|
||||
"The public key of the entity certificate."
|
||||
)
|
||||
glossaryItems += makeGlossaryItem("entity_certificate_public_key", entityCertificatePublicKeyExample)
|
||||
|
||||
|
||||
lazy val entityNameExample = ConnectorField("EXAMPLE COMPANY LTD", "The name of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_name", entityNameExample)
|
||||
|
||||
|
||||
lazy val entityCodeExample = ConnectorField("PSD_PICY_CBC!12345", "The code of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_code", entityCodeExample)
|
||||
|
||||
|
||||
lazy val entityTypeExample = ConnectorField("PSD_PI", "The type of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_type", entityTypeExample)
|
||||
|
||||
|
||||
lazy val entityAddressExample = ConnectorField("EXAMPLE COMPANY LTD, 5 SOME STREET", "The address of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_address", entityAddressExample)
|
||||
|
||||
|
||||
lazy val entityTownCityExample = ConnectorField("SOME CITY", "The town or city of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_town_city", entityTownCityExample)
|
||||
|
||||
|
||||
lazy val entityPostCodeExample = ConnectorField("1060", "The postal code of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_post_code", entityPostCodeExample)
|
||||
|
||||
|
||||
lazy val entityCountryExample = ConnectorField("CY", "The country of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_country", entityCountryExample)
|
||||
|
||||
|
||||
lazy val entityWebSiteExample = ConnectorField("www.example.com", "The website of the entity.")
|
||||
glossaryItems += makeGlossaryItem("entity_web_site", entityWebSiteExample)
|
||||
|
||||
|
||||
lazy val servicesExample = ConnectorField("""[{"CY":["PS_010","PS_020","PS_03C","PS_04C"]}]""", "The services provided by the entity.")
|
||||
glossaryItems += makeGlossaryItem("services", servicesExample)
|
||||
|
||||
|
||||
lazy val regulatedEntityAttributeIdExample = ConnectorField("attrafa-9a0f-4bfa-b30b-9003aa467f51","A string that MUST uniquely identify the Regulated Entity Attribute on this OBP instance.")
|
||||
glossaryItems += makeGlossaryItem("RegulatedEntity.attribute_id", regulatedEntityAttributeIdExample)
|
||||
|
||||
@ -1005,13 +1006,13 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("accessibility_features", accessibilityFeaturesExample)
|
||||
|
||||
lazy val canSeeOtherBankRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_bank_routing_scheme", canSeeOtherBankRoutingSchemeExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_BANK_ROUTING_SCHEME, canSeeOtherBankRoutingSchemeExample)
|
||||
|
||||
lazy val physicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("physical_location", physicalLocationExample)
|
||||
|
||||
lazy val canSeeBankAccountRoutingSchemeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_routing_scheme", canSeeBankAccountRoutingSchemeExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME, canSeeBankAccountRoutingSchemeExample)
|
||||
|
||||
lazy val rankAmount2Example = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("rank_amount2", rankAmount2Example)
|
||||
@ -1026,7 +1027,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("image_url", imageUrlExample)
|
||||
|
||||
lazy val canSeeTransactionMetadataExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_metadata", canSeeTransactionMetadataExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_METADATA, canSeeTransactionMetadataExample)
|
||||
|
||||
lazy val documentsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("documents", documentsExample)
|
||||
@ -1056,13 +1057,13 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("other_accounts", otherAccountsExample)
|
||||
|
||||
lazy val canSeeTransactionFinishDateExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_finish_date", canSeeTransactionFinishDateExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_FINISH_DATE, canSeeTransactionFinishDateExample)
|
||||
|
||||
lazy val satisfiedExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("satisfied", satisfiedExample)
|
||||
|
||||
lazy val canSeeOtherAccountIbanExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_iban", canSeeOtherAccountIbanExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_IBAN, canSeeOtherAccountIbanExample)
|
||||
|
||||
lazy val attributeIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("attribute_id", attributeIdExample)
|
||||
@ -1074,7 +1075,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("id", idExample)
|
||||
|
||||
lazy val canAddCorporateLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_corporate_location", canAddCorporateLocationExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_CORPORATE_LOCATION, canAddCorporateLocationExample)
|
||||
|
||||
lazy val crmEventsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("crm_events", crmEventsExample)
|
||||
@ -1107,7 +1108,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("requested_current_valid_end_date", requestedCurrentValidEndDateExample)
|
||||
|
||||
lazy val canSeeOtherBankRoutingAddressExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_bank_routing_address", canSeeOtherBankRoutingAddressExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_BANK_ROUTING_ADDRESS, canSeeOtherBankRoutingAddressExample)
|
||||
|
||||
lazy val thursdayExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("thursday", thursdayExample)
|
||||
@ -1117,27 +1118,27 @@ object ExampleValue {
|
||||
|
||||
lazy val phoneExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("phone", phoneExample)
|
||||
|
||||
|
||||
lazy val sepaCreditTransferExample = ConnectorField("yes","no-description-provided")
|
||||
glossaryItems += makeGlossaryItem("sepaCreditTransfer", sepaCreditTransferExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem("sepaCreditTransfer", sepaCreditTransferExample)
|
||||
|
||||
lazy val sepaSddCoreExample = ConnectorField("yes","no-description-provided")
|
||||
glossaryItems += makeGlossaryItem("sepaSddCore", sepaSddCoreExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem("sepaSddCore", sepaSddCoreExample)
|
||||
|
||||
lazy val sepaB2bExample = ConnectorField("yes","no-description-provided")
|
||||
glossaryItems += makeGlossaryItem("sepaB2b", sepaB2bExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem("sepaB2b", sepaB2bExample)
|
||||
|
||||
lazy val sepaCardClearingExample = ConnectorField("no","no-description-provided")
|
||||
glossaryItems += makeGlossaryItem("sepaCardClearing", sepaCardClearingExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem("sepaCardClearing", sepaCardClearingExample)
|
||||
|
||||
lazy val bicExample = ConnectorField("BUKBGB22","The Business Identifier Code")
|
||||
glossaryItems += makeGlossaryItem("bic", bicExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem("bic", bicExample)
|
||||
|
||||
lazy val sepaDirectDebitExample = ConnectorField("yes","no-description-provided")
|
||||
glossaryItems += makeGlossaryItem("sepaDirectDebit", sepaDirectDebitExample)
|
||||
|
||||
lazy val canSeeTransactionOtherBankAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_other_bank_account", canSeeTransactionOtherBankAccountExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT, canSeeTransactionOtherBankAccountExample)
|
||||
|
||||
lazy val itemsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("items", itemsExample)
|
||||
@ -1149,7 +1150,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("bank_routings", bankRoutingsExample)
|
||||
|
||||
lazy val canSeeOpenCorporatesUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_open_corporates_url", canSeeOpenCorporatesUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OPEN_CORPORATES_URL, canSeeOpenCorporatesUrlExample)
|
||||
|
||||
lazy val branchesExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("branches", branchesExample)
|
||||
@ -1233,7 +1234,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("comment_id", commentIdExample)
|
||||
|
||||
lazy val canSeeBankAccountNationalIdentifierExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_national_identifier", canSeeBankAccountNationalIdentifierExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER, canSeeBankAccountNationalIdentifierExample)
|
||||
|
||||
lazy val perMinuteExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("per_minute", perMinuteExample)
|
||||
@ -1266,7 +1267,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("this_view_id", thisViewIdExample)
|
||||
|
||||
lazy val canSeeTransactionCurrencyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_currency", canSeeTransactionCurrencyExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_CURRENCY, canSeeTransactionCurrencyExample)
|
||||
|
||||
lazy val accountOtpExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("account_otp", accountOtpExample)
|
||||
@ -1275,7 +1276,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("hide_metadata_if_alias_used", hideMetadataIfAliasUsedExample)
|
||||
|
||||
lazy val canSeeBankAccountCurrencyExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_currency", canSeeBankAccountCurrencyExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_CURRENCY, canSeeBankAccountCurrencyExample)
|
||||
|
||||
lazy val generateAuditorsViewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("generate_auditors_view", generateAuditorsViewExample)
|
||||
@ -1324,16 +1325,16 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("from_person", fromPersonExample)
|
||||
|
||||
lazy val canSeePrivateAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_private_alias", canSeePrivateAliasExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_PRIVATE_ALIAS, canSeePrivateAliasExample)
|
||||
|
||||
lazy val typeOfLockExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("type_of_lock", typeOfLockExample)
|
||||
|
||||
lazy val canSeeOtherAccountKindExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_kind", canSeeOtherAccountKindExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_KIND, canSeeOtherAccountKindExample)
|
||||
|
||||
lazy val canAddOpenCorporatesUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_open_corporates_url", canAddOpenCorporatesUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_OPEN_CORPORATES_URL, canAddOpenCorporatesUrlExample)
|
||||
|
||||
lazy val metadataViewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("metadata_view", metadataViewExample)
|
||||
@ -1342,7 +1343,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("alias", aliasExample)
|
||||
|
||||
lazy val canSeeTransactionThisBankAccountExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_this_bank_account", canSeeTransactionThisBankAccountExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT, canSeeTransactionThisBankAccountExample)
|
||||
|
||||
lazy val triggerNameExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("trigger_name", triggerNameExample)
|
||||
@ -1375,7 +1376,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("address", addressExample)
|
||||
|
||||
lazy val canAddPrivateAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_private_alias", canAddPrivateAliasExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_PRIVATE_ALIAS, canAddPrivateAliasExample)
|
||||
|
||||
lazy val postcodeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("postcode", postcodeExample)
|
||||
@ -1396,7 +1397,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("reset_password_url", resetPasswordUrlExample)
|
||||
|
||||
lazy val canSeeBankAccountSwiftBicExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_swift_bic", canSeeBankAccountSwiftBicExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_SWIFT_BIC, canSeeBankAccountSwiftBicExample)
|
||||
|
||||
lazy val jsonstringExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("jsonstring", jsonstringExample)
|
||||
@ -1417,10 +1418,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("details", detailsExample)
|
||||
|
||||
lazy val canSeeOwnerCommentExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_owner_comment", canSeeOwnerCommentExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OWNER_COMMENT, canSeeOwnerCommentExample)
|
||||
|
||||
lazy val canSeeTagsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_tags", canSeeTagsExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TAGS, canSeeTagsExample)
|
||||
|
||||
lazy val moreInfoUrlExample = ConnectorField("www.example.com/abc",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("more_info_url", moreInfoUrlExample)
|
||||
@ -1441,7 +1442,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("terms_and_conditions_url_example", termsAndConditionsUrlExample)
|
||||
|
||||
lazy val canAddUrlExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_url", canAddUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_URL, canAddUrlExample)
|
||||
|
||||
lazy val viewExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("view", viewExample)
|
||||
@ -1450,7 +1451,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("display_name", displayNameExample)
|
||||
|
||||
lazy val canDeleteTagExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_delete_tag", canDeleteTagExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_DELETE_TAG, canDeleteTagExample)
|
||||
|
||||
lazy val hoursExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("hours", hoursExample)
|
||||
@ -1513,7 +1514,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("kyc_document_id", kycDocumentIdExample)
|
||||
|
||||
lazy val canSeePublicAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_public_alias", canSeePublicAliasExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_PUBLIC_ALIAS, canSeePublicAliasExample)
|
||||
|
||||
lazy val webUiPropsIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("web_ui_props_id", webUiPropsIdExample)
|
||||
@ -1522,7 +1523,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("provider", providerExample)
|
||||
|
||||
lazy val canSeePhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_physical_location", canSeePhysicalLocationExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_PHYSICAL_LOCATION, canSeePhysicalLocationExample)
|
||||
|
||||
lazy val accountRoutingsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("account_routings", accountRoutingsExample)
|
||||
@ -1944,7 +1945,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("full_name", fullNameExample)
|
||||
|
||||
lazy val canCreateDirectDebitExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_create_direct_debit", canCreateDirectDebitExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_CREATE_DIRECT_DEBIT, canCreateDirectDebitExample)
|
||||
|
||||
lazy val futureDateExample = ConnectorField("20200127",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("future_date", futureDateExample)
|
||||
@ -1962,19 +1963,19 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("document_number", documentNumberExample)
|
||||
|
||||
lazy val canSeeOtherAccountNationalIdentifierExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_national_identifier", canSeeOtherAccountNationalIdentifierExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER, canSeeOtherAccountNationalIdentifierExample)
|
||||
|
||||
lazy val canSeeTransactionStartDateExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_start_date", canSeeTransactionStartDateExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_START_DATE, canSeeTransactionStartDateExample)
|
||||
|
||||
lazy val canAddPhysicalLocationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_physical_location", canAddPhysicalLocationExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_PHYSICAL_LOCATION, canAddPhysicalLocationExample)
|
||||
|
||||
lazy val cacheExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("cache", cacheExample)
|
||||
|
||||
lazy val canSeeBankRoutingAddressExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_routing_address", canSeeBankRoutingAddressExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ROUTING_ADDRESS, canSeeBankRoutingAddressExample)
|
||||
|
||||
lazy val usersExample = ConnectorField("user list", "Please refer to the user object.")
|
||||
glossaryItems += makeGlossaryItem("users", usersExample)
|
||||
@ -2004,7 +2005,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("metadata", metadataExample)
|
||||
|
||||
lazy val canSeeTransactionAmountExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_amount", canSeeTransactionAmountExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_AMOUNT, canSeeTransactionAmountExample)
|
||||
|
||||
lazy val methodRoutingIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("method_routing_id", methodRoutingIdExample)
|
||||
@ -2028,10 +2029,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("country_code", countryCodeExample)
|
||||
|
||||
lazy val canSeeBankAccountCreditLimitExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_credit_limit", canSeeBankAccountCreditLimitExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT, canSeeBankAccountCreditLimitExample)
|
||||
|
||||
lazy val canSeeOtherAccountNumberExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_number", canSeeOtherAccountNumberExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_NUMBER, canSeeOtherAccountNumberExample)
|
||||
|
||||
lazy val orderExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("order", orderExample)
|
||||
@ -2052,7 +2053,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("is_active", isActiveExample)
|
||||
|
||||
lazy val canSeeBankAccountBankNameExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_bank_name", canSeeBankAccountBankNameExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_BANK_NAME, canSeeBankAccountBankNameExample)
|
||||
|
||||
lazy val firstNameExample = ConnectorField("Tom","The first name")
|
||||
glossaryItems += makeGlossaryItem("first_name", firstNameExample)
|
||||
@ -2067,7 +2068,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("transaction_ids", transactionIdsExample)
|
||||
|
||||
lazy val canSeeBankAccountOwnersExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_owners", canSeeBankAccountOwnersExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_OWNERS, canSeeBankAccountOwnersExample)
|
||||
|
||||
lazy val actualDateExample = ConnectorField("2020-01-27",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("actual_date", actualDateExample)
|
||||
@ -2076,10 +2077,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("example_outbound_message", exampleOutboundMessageExample)
|
||||
|
||||
lazy val canDeleteWhereTagExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_delete_where_tag", canDeleteWhereTagExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_DELETE_WHERE_TAG, canDeleteWhereTagExample)
|
||||
|
||||
lazy val canSeeUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_url", canSeeUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_URL, canSeeUrlExample)
|
||||
|
||||
lazy val versionExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("version", versionExample)
|
||||
@ -2088,7 +2089,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("collected", collectedExample)
|
||||
|
||||
lazy val canAddPublicAliasExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_public_alias", canAddPublicAliasExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_PUBLIC_ALIAS, canAddPublicAliasExample)
|
||||
|
||||
lazy val allowedActionsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("allowed_actions", allowedActionsExample)
|
||||
@ -2106,7 +2107,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("implemented_in_version", implementedInVersionExample)
|
||||
|
||||
lazy val canSeeImageUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_image_url", canSeeImageUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_IMAGE_URL, canSeeImageUrlExample)
|
||||
|
||||
lazy val toTransferToPhoneExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("to_transfer_to_phone", toTransferToPhoneExample)
|
||||
@ -2151,7 +2152,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("e", eExample)
|
||||
|
||||
lazy val canSeeCorporateLocationExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_corporate_location", canSeeCorporateLocationExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_CORPORATE_LOCATION, canSeeCorporateLocationExample)
|
||||
|
||||
lazy val userExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("user", userExample)
|
||||
@ -2199,7 +2200,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("requiredfieldinfo", requiredfieldinfoExample)
|
||||
|
||||
lazy val canSeeWhereTagExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_where_tag", canSeeWhereTagExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_WHERE_TAG, canSeeWhereTagExample)
|
||||
|
||||
lazy val bankidExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("bankid", bankidExample)
|
||||
@ -2262,10 +2263,10 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("to_sandbox_tan", toSandboxTanExample)
|
||||
|
||||
lazy val canAddTagExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_tag", canAddTagExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_TAG, canAddTagExample)
|
||||
|
||||
lazy val canSeeBankAccountLabelExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_label", canSeeBankAccountLabelExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_LABEL, canSeeBankAccountLabelExample)
|
||||
|
||||
lazy val serviceAvailableExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("service_available", serviceAvailableExample)
|
||||
@ -2280,7 +2281,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("link", linkExample)
|
||||
|
||||
lazy val canSeeTransactionTypeExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_type", canSeeTransactionTypeExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_TYPE, canSeeTransactionTypeExample)
|
||||
|
||||
lazy val implementedByPartialFunctionExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("implemented_by_partial_function", implementedByPartialFunctionExample)
|
||||
@ -2289,7 +2290,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("drive_up", driveUpExample)
|
||||
|
||||
lazy val canAddMoreInfoExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_more_info", canAddMoreInfoExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_MORE_INFO, canAddMoreInfoExample)
|
||||
|
||||
lazy val detailExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("detail", detailExample)
|
||||
@ -2317,21 +2318,21 @@ object ExampleValue {
|
||||
|
||||
lazy val maxNumberOfYearlyTransactionsExample = ConnectorField("100",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("max_number_of_yearly_transactions", maxNumberOfYearlyTransactionsExample)
|
||||
|
||||
|
||||
lazy val maxNumberOfTransactionsExample = ConnectorField("100",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("max_number_of_transactions", maxNumberOfTransactionsExample)
|
||||
|
||||
|
||||
lazy val maxTotalAmountExample = ConnectorField("10000.12",NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("max_total_amount", maxTotalAmountExample)
|
||||
|
||||
lazy val canAddImageUrlExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_add_image_url", canAddImageUrlExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_ADD_IMAGE_URL, canAddImageUrlExample)
|
||||
|
||||
lazy val jwksUrisExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("jwks_uris", jwksUrisExample)
|
||||
|
||||
lazy val canSeeOtherAccountSwiftBicExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_other_account_swift_bic", canSeeOtherAccountSwiftBicExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC, canSeeOtherAccountSwiftBicExample)
|
||||
|
||||
lazy val staffUserIdExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("staff_user_id", staffUserIdExample)
|
||||
@ -2343,7 +2344,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("valid_from", validFromExample)
|
||||
|
||||
lazy val canDeleteImageExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_delete_image", canDeleteImageExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_DELETE_IMAGE, canDeleteImageExample)
|
||||
|
||||
lazy val toExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("to", toExample)
|
||||
@ -2355,13 +2356,13 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("product_attributes", productAttributesExample)
|
||||
|
||||
lazy val canSeeTransactionDescriptionExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_transaction_description", canSeeTransactionDescriptionExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_TRANSACTION_DESCRIPTION, canSeeTransactionDescriptionExample)
|
||||
|
||||
lazy val faceImageExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("face_image", faceImageExample)
|
||||
|
||||
lazy val canSeeBankAccountNumberExample = ConnectorField(booleanFalse,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_see_bank_account_number", canSeeBankAccountNumberExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_SEE_BANK_ACCOUNT_NUMBER, canSeeBankAccountNumberExample)
|
||||
|
||||
lazy val glossaryItemsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("glossary_items", glossaryItemsExample)
|
||||
@ -2391,8 +2392,8 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("DynamicResourceDoc.description", dynamicResourceDocDescriptionExample)
|
||||
|
||||
lazy val canDeleteCommentExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_delete_comment", canDeleteCommentExample)
|
||||
|
||||
glossaryItems += makeGlossaryItem(CAN_DELETE_COMMENT, canDeleteCommentExample)
|
||||
|
||||
lazy val commentsExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("comments", commentsExample)
|
||||
|
||||
@ -2400,7 +2401,7 @@ object ExampleValue {
|
||||
glossaryItems += makeGlossaryItem("banks", banksExample)
|
||||
|
||||
lazy val canCreateStandingOrderExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("can_create_standing_order", canCreateStandingOrderExample)
|
||||
glossaryItems += makeGlossaryItem(CAN_CREATE_STANDING_ORDER, canCreateStandingOrderExample)
|
||||
|
||||
lazy val adapterImplementationExample = ConnectorField(NoExampleProvided,NoDescriptionProvided)
|
||||
glossaryItems += makeGlossaryItem("adapter_implementation", adapterImplementationExample)
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
package code.api.util
|
||||
|
||||
import java.io.File
|
||||
import code.api.Constant
|
||||
import code.api.Constant.{PARAM_LOCALE, directLoginHeaderName}
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.{getObpApiRoot, getServerUrl}
|
||||
import code.api.util.ExampleValue.{accountIdExample, bankIdExample, customerIdExample, userIdExample}
|
||||
|
||||
import code.util.Helper.MdcLoggable
|
||||
import code.util.HydraUtil
|
||||
import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue
|
||||
import net.liftweb.http.LiftRules
|
||||
|
||||
import java.io.File
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
|
||||
|
||||
@ -1336,7 +1333,7 @@ object Glossary extends MdcLoggable {
|
||||
|
|
||||
|Body:
|
||||
|
|
||||
| { "name":"_test", "description":"This view is for family", "metadata_view":"_test", "is_public":true, "which_alias_to_use":"family", "hide_metadata_if_alias_used":false, "allowed_actions":["can_see_transaction_this_bank_account","can_see_transaction_other_bank_account","can_see_transaction_metadata","can_see_transaction_label","can_see_transaction_amount","can_see_transaction_type","can_see_transaction_currency","can_see_transaction_start_date","can_see_transaction_finish_date","can_see_transaction_balance","can_see_comments","can_see_narrative","can_see_tags","can_see_images","can_see_bank_account_owners","can_see_bank_account_type","can_see_bank_account_balance","can_see_bank_account_currency","can_see_bank_account_label","can_see_bank_account_national_identifier","can_see_bank_account_swift_bic","can_see_bank_account_iban","can_see_bank_account_number","can_see_bank_account_bank_name","can_see_other_account_national_identifier","can_see_other_account_swift_bic","can_see_other_account_iban","can_see_other_account_bank_name","can_see_other_account_number","can_see_other_account_metadata","can_see_other_account_kind","can_see_more_info","can_see_url","can_see_image_url","can_see_open_corporates_url","can_see_corporate_location","can_see_physical_location","can_see_public_alias","can_see_private_alias","can_add_more_info","can_add_url","can_add_image_url","can_add_open_corporates_url","can_add_corporate_location","can_add_physical_location","can_add_public_alias","can_add_private_alias","can_delete_corporate_location","can_delete_physical_location","can_edit_narrative","can_add_comment","can_delete_comment","can_add_tag","can_delete_tag","can_add_image","can_delete_image","can_add_where_tag","can_see_where_tag","can_delete_where_tag","can_create_counterparty","can_see_bank_routing_scheme","can_see_bank_routing_address","can_see_bank_account_routing_scheme","can_see_bank_account_routing_address","can_see_other_bank_routing_scheme","can_see_other_bank_routing_address","can_see_other_account_routing_scheme","can_see_other_account_routing_address","can_query_available_funds","can_add_transaction_request_to_own_account","can_add_transaction_request_to_any_account","can_see_bank_account_credit_limit","can_create_direct_debit","can_create_standing_order"]} |
|
||||
| { "name":"_test", "description":"This view is for family", "metadata_view":"_test", "is_public":true, "which_alias_to_use":"family", "hide_metadata_if_alias_used":false, "allowed_actions":[$CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_METADATA,,$CAN_SEE_TRANSACTION_AMOUNT,$CAN_SEE_TRANSACTION_TYPE,$CAN_SEE_TRANSACTION_CURRENCY,$CAN_SEE_TRANSACTION_START_DATE,$CAN_SEE_TRANSACTION_FINISH_DATE,$CAN_SEE_TRANSACTION_BALANCE,$CAN_SEE_COMMENTS,$CAN_SEE_TAGS,$CAN_SEE_IMAGES,$CAN_SEE_BANK_ACCOUNT_OWNERS,$CAN_SEE_BANK_ACCOUNT_TYPE,$CAN_SEE_BANK_ACCOUNT_BALANCE,$CAN_SEE_BANK_ACCOUNT_CURRENCY,$CAN_SEE_BANK_ACCOUNT_LABEL,$CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,$CAN_SEE_BANK_ACCOUNT_IBAN,$CAN_SEE_BANK_ACCOUNT_NUMBER,$CAN_SEE_BANK_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,$CAN_SEE_OTHER_ACCOUNT_IBAN,$CAN_SEE_OTHER_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NUMBER,$CAN_SEE_OTHER_ACCOUNT_METADATA,$CAN_SEE_OTHER_ACCOUNT_KIND,$CAN_SEE_MORE_INFO,$CAN_SEE_URL,$CAN_SEE_IMAGE_URL,$CAN_SEE_OPEN_CORPORATES_URL,$CAN_SEE_CORPORATE_LOCATION,$CAN_SEE_PHYSICAL_LOCATION,$CAN_SEE_PUBLIC_ALIAS,$CAN_SEE_PRIVATE_ALIAS,$CAN_ADD_MORE_INFO,$CAN_ADD_URL,$CAN_ADD_IMAGE_URL,$CAN_ADD_OPEN_CORPORATES_URL,$CAN_ADD_CORPORATE_LOCATION,$CAN_ADD_PHYSICAL_LOCATION,$CAN_ADD_PUBLIC_ALIAS,$CAN_ADD_PRIVATE_ALIAS,$CAN_DELETE_CORPORATE_LOCATION,$CAN_DELETE_PHYSICAL_LOCATION,$CAN_ADD_COMMENT,$CAN_DELETE_COMMENT,$CAN_ADD_TAG,$CAN_DELETE_TAG,$CAN_ADD_IMAGE,$CAN_DELETE_IMAGE,$CAN_ADD_WHERE_TAG,$CAN_SEE_WHERE_TAG,$CAN_DELETE_WHERE_TAG,$CAN_SEE_BANK_ROUTING_SCHEME,$CAN_SEE_BANK_ROUTING_ADDRESS,$CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,$CAN_SEE_OTHER_BANK_ROUTING_SCHEME,$CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,$CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,$CAN_QUERY_AVAILABLE_FUNDS,$CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,$CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,$CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,$CAN_CREATE_DIRECT_DEBIT,$CAN_CREATE_STANDING_ORDER]} |
|
||||
| Headers:
|
||||
|
|
||||
| Content-Type: application/json
|
||||
@ -1432,7 +1429,7 @@ object Glossary extends MdcLoggable {
|
||||
|
|
||||
|Body:
|
||||
|
|
||||
| { "name":"_test", "description":"good", "is_public":false, "which_alias_to_use":"accountant", "hide_metadata_if_alias_used":false, "allowed_actions": ["can_see_transaction_this_bank_account", "can_see_transaction_other_bank_account", "can_see_transaction_metadata", "can_see_transaction_label", "can_see_transaction_amount", "can_see_transaction_type", "can_see_transaction_currency", "can_see_transaction_start_date", "can_see_transaction_finish_date", "can_see_transaction_balance", "can_see_comments", "can_see_narrative", "can_see_tags", "can_see_images", "can_see_bank_account_owners", "can_see_bank_account_type", "can_see_bank_account_balance", "can_see_bank_account_currency", "can_see_bank_account_label", "can_see_bank_account_national_identifier", "can_see_bank_account_swift_bic", "can_see_bank_account_iban", "can_see_bank_account_number", "can_see_bank_account_bank_name", "can_see_other_account_national_identifier", "can_see_other_account_swift_bic", "can_see_other_account_iban", "can_see_other_account_bank_name", "can_see_other_account_number", "can_see_other_account_metadata", "can_see_other_account_kind", "can_see_more_info", "can_see_url", "can_see_image_url", "can_see_open_corporates_url", "can_see_corporate_location", "can_see_physical_location", "can_see_public_alias", "can_see_private_alias", "can_add_more_info", "can_add_url", "can_add_image_url", "can_add_open_corporates_url", "can_add_corporate_location", "can_add_physical_location", "can_add_public_alias", "can_add_private_alias", "can_delete_corporate_location", "can_delete_physical_location", "can_edit_narrative", "can_add_comment", "can_delete_comment", "can_add_tag", "can_delete_tag", "can_add_image", "can_delete_image", "can_add_where_tag", "can_see_where_tag", "can_delete_where_tag", "can_create_counterparty", "can_see_bank_routing_scheme", "can_see_bank_routing_address", "can_see_bank_account_routing_scheme", "can_see_bank_account_routing_address", "can_see_other_bank_routing_scheme", "can_see_other_bank_routing_address", "can_see_other_account_routing_scheme", "can_see_other_account_routing_address"]}
|
||||
| { "name":"_test", "description":"good", "is_public":false, "which_alias_to_use":"accountant", "hide_metadata_if_alias_used":false, "allowed_actions": [$CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,$CAN_SEE_TRANSACTION_METADATA,,$CAN_SEE_TRANSACTION_AMOUNT,$CAN_SEE_TRANSACTION_TYPE,$CAN_SEE_TRANSACTION_CURRENCY,$CAN_SEE_TRANSACTION_START_DATE,$CAN_SEE_TRANSACTION_FINISH_DATE,$CAN_SEE_TRANSACTION_BALANCE,$CAN_SEE_COMMENTS,$CAN_SEE_TAGS,$CAN_SEE_IMAGES,$CAN_SEE_BANK_ACCOUNT_OWNERS,$CAN_SEE_BANK_ACCOUNT_TYPE,$CAN_SEE_BANK_ACCOUNT_BALANCE,$CAN_SEE_BANK_ACCOUNT_CURRENCY,$CAN_SEE_BANK_ACCOUNT_LABEL,$CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,$CAN_SEE_BANK_ACCOUNT_IBAN,$CAN_SEE_BANK_ACCOUNT_NUMBER,$CAN_SEE_BANK_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,$CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,$CAN_SEE_OTHER_ACCOUNT_IBAN,$CAN_SEE_OTHER_ACCOUNT_BANK_NAME,$CAN_SEE_OTHER_ACCOUNT_NUMBER,$CAN_SEE_OTHER_ACCOUNT_METADATA,$CAN_SEE_OTHER_ACCOUNT_KIND,$CAN_SEE_MORE_INFO,$CAN_SEE_URL,$CAN_SEE_IMAGE_URL,$CAN_SEE_OPEN_CORPORATES_URL,$CAN_SEE_CORPORATE_LOCATION,$CAN_SEE_PHYSICAL_LOCATION,$CAN_SEE_PUBLIC_ALIAS,$CAN_SEE_PRIVATE_ALIAS,$CAN_ADD_MORE_INFO,$CAN_ADD_URL,$CAN_ADD_IMAGE_URL,$CAN_ADD_OPEN_CORPORATES_URL,$CAN_ADD_CORPORATE_LOCATION,$CAN_ADD_PHYSICAL_LOCATION,$CAN_ADD_PUBLIC_ALIAS,$CAN_ADD_PRIVATE_ALIAS,$CAN_DELETE_CORPORATE_LOCATION,$CAN_DELETE_PHYSICAL_LOCATION,$CAN_ADD_COMMENT,$CAN_DELETE_COMMENT,$CAN_ADD_TAG,$CAN_DELETE_TAG,$CAN_ADD_IMAGE,$CAN_DELETE_IMAGE,$CAN_ADD_WHERE_TAG,$CAN_SEE_WHERE_TAG,$CAN_DELETE_WHERE_TAG,$CAN_SEE_BANK_ROUTING_SCHEME,$CAN_SEE_BANK_ROUTING_ADDRESS,$CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,$CAN_SEE_OTHER_BANK_ROUTING_SCHEME,$CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,$CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,$CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,$CAN_QUERY_AVAILABLE_FUNDS,$CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT,$CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT,$CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,$CAN_CREATE_DIRECT_DEBIT,$CAN_CREATE_STANDING_ORDER]}
|
||||
|
|
||||
| Headers:
|
||||
|
|
||||
@ -3352,7 +3349,7 @@ object Glossary extends MdcLoggable {
|
||||
|
|
||||
|Rule for calculating number of security challenges:
|
||||
|If product Account attribute REQUIRED_CHALLENGE_ANSWERS=N then create N challenges
|
||||
|(one for every user that has a View where permission "can_add_transaction_request_to_any_account"=true)
|
||||
|(one for every user that has a View where permission $CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT=true)
|
||||
|In case REQUIRED_CHALLENGE_ANSWERS is not defined as an account attribute default value is 1.
|
||||
|
|
||||
|Transaction Requests contain charge information giving the client the opportunity to proceed or not (as long as the challenge level is appropriate).
|
||||
|
||||
@ -467,42 +467,7 @@ object NewStyle extends MdcLoggable{
|
||||
} map { fullBoxOrException(_)
|
||||
} map { unboxFull(_) }
|
||||
|
||||
def grantAccessToView(account: BankAccount, u: User, bankIdAccountIdViewId : BankIdAccountIdViewId, provider : String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.grantAccessToView(u, bankIdAccountIdViewId, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x => (unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewId(${bankIdAccountIdViewId.viewId.value}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
def grantAccessToMultipleViews(account: BankAccount, u: User, bankIdAccountIdViewIds : List[BankIdAccountIdViewId], provider : String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.grantAccessToMultipleViews(u, bankIdAccountIdViewIds, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewIds(${bankIdAccountIdViewIds}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
def revokeAccessToView(account: BankAccount, u: User, bankIdAccountIdViewId : BankIdAccountIdViewId, provider : String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.revokeAccessToView(u, bankIdAccountIdViewId, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanRevokeAccessToViewForTargetAccount + s"Current ViewId(${bankIdAccountIdViewId.viewId.value}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
def revokeAllAccountAccess(account: BankAccount, u: User, provider : String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.revokeAllAccountAccess(u, provider, providerId, callContext)
|
||||
} map {
|
||||
@ -545,53 +510,7 @@ object NewStyle extends MdcLoggable{
|
||||
Connector.connector.vend.getTransactionsCore(bankId: BankId, accountId: AccountId, queryParams: List[OBPQueryParam], callContext: Option[CallContext]) map { i =>
|
||||
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponseForGetTransactions", 400 ), i._2)
|
||||
}
|
||||
def checkOwnerViewAccessAndReturnOwnerView(user: User, bankAccountId: BankIdAccountId, callContext: Option[CallContext]) : Future[View] = {
|
||||
Future {user.checkOwnerViewAccessAndReturnOwnerView(bankAccountId, callContext)} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoOwnerView" +"userId : " + user.userId + ". bankId : " + s"${bankAccountId.bankId}" + ". accountId : " + s"${bankAccountId.accountId}")
|
||||
}
|
||||
}
|
||||
|
||||
def checkViewAccessAndReturnView(viewId : ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]) : Future[View] = {
|
||||
Future{
|
||||
APIUtil.checkViewAccessAndReturnView(viewId, bankAccountId, user, callContext)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${viewId.value}")
|
||||
}
|
||||
}
|
||||
def checkAccountAccessAndGetView(viewId : ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]) : Future[View] = {
|
||||
Future{
|
||||
APIUtil.checkViewAccessAndReturnView(viewId, bankAccountId, user, callContext)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${viewId.value}", 403)
|
||||
}
|
||||
}
|
||||
def checkViewsAccessAndReturnView(firstView : ViewId, secondView : ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]) : Future[View] = {
|
||||
Future{
|
||||
APIUtil.checkViewAccessAndReturnView(firstView, bankAccountId, user, callContext).or(
|
||||
APIUtil.checkViewAccessAndReturnView(secondView, bankAccountId, user, callContext)
|
||||
)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${firstView.value} or ${secondView.value}")
|
||||
}
|
||||
}
|
||||
def checkBalancingTransactionAccountAccessAndReturnView(doubleEntryTransaction: DoubleEntryTransaction, user: Option[User], callContext: Option[CallContext]) : Future[View] = {
|
||||
val debitBankAccountId = BankIdAccountId(
|
||||
doubleEntryTransaction.debitTransactionBankId,
|
||||
doubleEntryTransaction.debitTransactionAccountId
|
||||
)
|
||||
val creditBankAccountId = BankIdAccountId(
|
||||
doubleEntryTransaction.creditTransactionBankId,
|
||||
doubleEntryTransaction.creditTransactionAccountId
|
||||
)
|
||||
val ownerViewId = ViewId(Constant.SYSTEM_OWNER_VIEW_ID)
|
||||
Future{
|
||||
APIUtil.checkViewAccessAndReturnView(ownerViewId, debitBankAccountId, user, callContext).or(
|
||||
APIUtil.checkViewAccessAndReturnView(ownerViewId, creditBankAccountId, user, callContext)
|
||||
)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${ownerViewId.value}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def checkAuthorisationToCreateTransactionRequest(viewId : ViewId, bankAccountId: BankIdAccountId, user: User, callContext: Option[CallContext]) : Future[Boolean] = {
|
||||
Future{
|
||||
@ -604,84 +523,6 @@ object NewStyle extends MdcLoggable{
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
def customView(viewId : ViewId, bankAccountId: BankIdAccountId, callContext: Option[CallContext]) : Future[View] = {
|
||||
Views.views.vend.customViewFuture(viewId, bankAccountId) map {
|
||||
unboxFullOrFail(_, callContext, s"$ViewNotFound. Current ViewId is $viewId")
|
||||
}
|
||||
}
|
||||
|
||||
def systemView(viewId : ViewId, callContext: Option[CallContext]) : Future[View] = {
|
||||
Views.views.vend.systemViewFuture(viewId) map {
|
||||
unboxFullOrFail(_, callContext, s"$SystemViewNotFound. Current ViewId is $viewId")
|
||||
}
|
||||
}
|
||||
def systemViews(): Future[List[View]] = {
|
||||
Views.views.vend.getSystemViews()
|
||||
}
|
||||
def grantAccessToCustomView(view : View, user: User, callContext: Option[CallContext]) : Future[View] = {
|
||||
view.isSystem match {
|
||||
case false =>
|
||||
Future(Views.views.vend.grantAccessToCustomView(BankIdAccountIdViewId(view.bankId, view.accountId, view.viewId), user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotGrantAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case true =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for system views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
def revokeAccessToCustomView(view : View, user: User, callContext: Option[CallContext]) : Future[Boolean] = {
|
||||
view.isSystem match {
|
||||
case false =>
|
||||
Future(Views.views.vend.revokeAccess(BankIdAccountIdViewId(view.bankId, view.accountId, view.viewId), user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotRevokeAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case true =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for system views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
def grantAccessToSystemView(bankId: BankId, accountId: AccountId, view : View, user: User, callContext: Option[CallContext]) : Future[View] = {
|
||||
view.isSystem match {
|
||||
case true =>
|
||||
Future(Views.views.vend.grantAccessToSystemView(bankId, accountId, view, user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotGrantAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case false =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for custom views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
def revokeAccessToSystemView(bankId: BankId, accountId: AccountId, view : View, user: User, callContext: Option[CallContext]) : Future[Boolean] = {
|
||||
view.isSystem match {
|
||||
case true =>
|
||||
Future(Views.views.vend.revokeAccessToSystemView(bankId, accountId, view, user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotRevokeAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case false =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for custom views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
def createSystemView(view: CreateViewJson, callContext: Option[CallContext]) : Future[View] = {
|
||||
Views.views.vend.createSystemView(view) map {
|
||||
unboxFullOrFail(_, callContext, s"$CreateSystemViewError")
|
||||
}
|
||||
}
|
||||
def updateSystemView(viewId: ViewId, view: UpdateViewJSON, callContext: Option[CallContext]) : Future[View] = {
|
||||
Views.views.vend.updateSystemView(viewId, view) map {
|
||||
unboxFullOrFail(_, callContext, s"$UpdateSystemViewError")
|
||||
}
|
||||
}
|
||||
def deleteSystemView(viewId : ViewId, callContext: Option[CallContext]) : Future[Boolean] = {
|
||||
Views.views.vend.removeSystemView(viewId) map {
|
||||
unboxFullOrFail(_, callContext, s"$DeleteSystemViewError")
|
||||
}
|
||||
}
|
||||
|
||||
def getConsumerByConsumerId(consumerId: String, callContext: Option[CallContext]): Future[Consumer] = {
|
||||
Consumers.consumers.vend.getConsumerByConsumerIdFuture(consumerId) map {
|
||||
@ -4238,27 +4079,6 @@ object NewStyle extends MdcLoggable{
|
||||
, callContext)
|
||||
}
|
||||
|
||||
def createCustomView(bankAccountId: BankIdAccountId, createViewJson: CreateViewJson, callContext: Option[CallContext]): OBPReturnType[View] =
|
||||
Future {
|
||||
Views.views.vend.createCustomView(bankAccountId, createViewJson)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$CreateCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def updateCustomView(bankAccountId : BankIdAccountId, viewId : ViewId, viewUpdateJson : UpdateViewJSON, callContext: Option[CallContext]): OBPReturnType[View] =
|
||||
Future {
|
||||
Views.views.vend.updateCustomView(bankAccountId, viewId, viewUpdateJson)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$UpdateCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def removeCustomView(viewId: ViewId, bankAccountId: BankIdAccountId, callContext: Option[CallContext]) =
|
||||
Future {
|
||||
Views.views.vend.removeCustomView(viewId, bankAccountId)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$DeleteCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def createOrUpdateCounterpartyLimit(
|
||||
bankId: String,
|
||||
accountId: String,
|
||||
|
||||
@ -60,9 +60,7 @@ object Migration extends MdcLoggable {
|
||||
def executeScripts(startedBeforeSchemifier: Boolean): Boolean = executeScript {
|
||||
dummyScript()
|
||||
addAccountAccessConsumerId()
|
||||
populateTableViewDefinition()
|
||||
populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier)
|
||||
populateTableAccountAccess()
|
||||
// populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier)
|
||||
generateAndPopulateMissingCustomerUUIDs(startedBeforeSchemifier)
|
||||
generateAndPopulateMissingConsumersUUIDs(startedBeforeSchemifier)
|
||||
populateTableRateLimiting()
|
||||
@ -98,9 +96,10 @@ object Migration extends MdcLoggable {
|
||||
alterMappedCustomerAttribute(startedBeforeSchemifier)
|
||||
dropMappedBadLoginAttemptIndex()
|
||||
alterMetricColumnUrlLength()
|
||||
populateViewDefinitionCanAddTransactionRequestToBeneficiary()
|
||||
populateViewDefinitionCanSeeTransactionStatus()
|
||||
// populateViewDefinitionCanAddTransactionRequestToBeneficiary()
|
||||
// populateViewDefinitionCanSeeTransactionStatus()
|
||||
alterCounterpartyLimitFieldType()
|
||||
populateMigrationOfViewPermissions(startedBeforeSchemifier)
|
||||
}
|
||||
|
||||
private def dummyScript(): Boolean = {
|
||||
@ -116,43 +115,41 @@ object Migration extends MdcLoggable {
|
||||
}
|
||||
}
|
||||
|
||||
private def populateTableAccountAccess(): Boolean = {
|
||||
val name = nameOf(populateTableAccountAccess)
|
||||
runOnce(name) {
|
||||
TableAccountAccess.populate(name)
|
||||
}
|
||||
}
|
||||
// private def populateViewDefinitionCanAddTransactionRequestToBeneficiary(): Boolean = {
|
||||
// val name = nameOf(populateViewDefinitionCanAddTransactionRequestToBeneficiary)
|
||||
// runOnce(name) {
|
||||
// MigrationOfViewDefinitionCanAddTransactionRequestToBeneficiary.populateTheField(name)
|
||||
// }
|
||||
// }
|
||||
|
||||
private def populateTableViewDefinition(): Boolean = {
|
||||
val name = nameOf(populateTableViewDefinition)
|
||||
runOnce(name) {
|
||||
TableViewDefinition.populate(name)
|
||||
}
|
||||
}
|
||||
|
||||
private def populateViewDefinitionCanAddTransactionRequestToBeneficiary(): Boolean = {
|
||||
val name = nameOf(populateViewDefinitionCanAddTransactionRequestToBeneficiary)
|
||||
runOnce(name) {
|
||||
MigrationOfViewDefinitionCanAddTransactionRequestToBeneficiary.populateTheField(name)
|
||||
}
|
||||
}
|
||||
|
||||
private def populateViewDefinitionCanSeeTransactionStatus(): Boolean = {
|
||||
val name = nameOf(populateViewDefinitionCanSeeTransactionStatus)
|
||||
runOnce(name) {
|
||||
MigrationOfViewDefinitionCanSeeTransactionStatus.populateTheField(name)
|
||||
}
|
||||
}
|
||||
// private def populateViewDefinitionCanSeeTransactionStatus(): Boolean = {
|
||||
// val name = nameOf(populateViewDefinitionCanSeeTransactionStatus)
|
||||
// runOnce(name) {
|
||||
// MigrationOfViewDefinitionCanSeeTransactionStatus.populateTheField(name)
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
private def populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier: Boolean): Boolean = {
|
||||
// private def populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier: Boolean): Boolean = {
|
||||
// if (startedBeforeSchemifier == true) {
|
||||
// logger.warn(s"Migration.database.populateMigrationOfViewDefinitionPermissions(true) cannot be run before Schemifier.")
|
||||
// true
|
||||
// } else {
|
||||
// val name = nameOf(populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier))
|
||||
// runOnce(name) {
|
||||
// MigrationOfViewDefinitionPermissions.populate(name)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
private def populateMigrationOfViewPermissions(startedBeforeSchemifier: Boolean): Boolean = {
|
||||
if (startedBeforeSchemifier == true) {
|
||||
logger.warn(s"Migration.database.populateMigrationOfViewDefinitionPermissions(true) cannot be run before Schemifier.")
|
||||
logger.warn(s"Migration.database.populateMigrationOfViewPermissions(true) cannot be run before Schemifier.")
|
||||
true
|
||||
} else {
|
||||
val name = nameOf(populateMigrationOfViewDefinitionPermissions(startedBeforeSchemifier))
|
||||
val name = nameOf(populateMigrationOfViewPermissions(startedBeforeSchemifier))
|
||||
runOnce(name) {
|
||||
MigrationOfViewDefinitionPermissions.populate(name)
|
||||
MigrationOfViewPermissions.populate(name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,77 +0,0 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.model.dataAccess.{ViewImpl, ViewPrivileges}
|
||||
import code.views.system.{AccountAccess, ViewDefinition}
|
||||
import net.liftweb.mapper.{By, ByList, DB}
|
||||
import net.liftweb.util.DefaultConnectionIdentifier
|
||||
|
||||
object TableAccountAccess {
|
||||
def populate(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewPrivileges) match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val views = ViewImpl.findAll()
|
||||
|
||||
// Make back up
|
||||
DbFunction.makeBackUpOfTable(AccountAccess)
|
||||
// Delete all rows at the table
|
||||
AccountAccess.bulkDelete_!!()
|
||||
|
||||
// Insert rows into table "accountaccess" based on data in the tables viewimpl and viewprivileges
|
||||
val insertedRows: List[Boolean] =
|
||||
for {
|
||||
view <- views
|
||||
permission <- ViewPrivileges.findAll(By(ViewPrivileges.view, view.id))
|
||||
} yield {
|
||||
val viewId = ViewImpl.find(By(ViewImpl.id_, permission.view.get)).map(_.permalink_.get).getOrElse("")
|
||||
val viewFk: Long = ViewDefinition.findByUniqueKey(view.bankId.value, view.accountId.value, view.viewId.value).map(_.id_.get).getOrElse(0)
|
||||
AccountAccess
|
||||
.create
|
||||
.bank_id(view.bankPermalink.get)
|
||||
.account_id(view.accountPermalink.get)
|
||||
.user_fk(permission.user.get)
|
||||
.view_id(viewId)
|
||||
.view_fk(viewFk)
|
||||
.save
|
||||
}
|
||||
val isSuccessful = insertedRows.forall(_ == true)
|
||||
val accountAccess = AccountAccess.findAll()
|
||||
val accountAccessSize = accountAccess.size
|
||||
val viewPrivileges = ViewPrivileges.findAll()
|
||||
val viewPrivilegesSize = viewPrivileges.size
|
||||
|
||||
// We want to find foreign keys "viewprivileges.view_c" which cannot be mapped to "viewimpl.id_"
|
||||
val x1 = ViewPrivileges.findAll(ByList(ViewPrivileges.view, views.map(_.id))).map(_.view.get).distinct.sortWith(_>_)
|
||||
val x2 = viewPrivileges.map(_.view.get).distinct.sortWith(_>_)
|
||||
val deadForeignKeys = x2.diff(x1)
|
||||
|
||||
val endDate = System.currentTimeMillis()
|
||||
|
||||
//// (${accountAccess.map(_.id).mkString(",")});
|
||||
|
||||
|
||||
val comment: String =
|
||||
s"""Account access size: $accountAccessSize;
|
||||
|View privileges size: $viewPrivilegesSize;
|
||||
|List of dead foreign keys at the field ViewPrivileges.view_c: ${deadForeignKeys.mkString(",")};
|
||||
|Duration: ${endDate - startDate} ms;
|
||||
|Primary keys of the inserted rows: NOPE too risky
|
||||
""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""View privileges does not exist;
|
||||
""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,148 +0,0 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.model.dataAccess.ViewImpl
|
||||
import code.views.system.ViewDefinition
|
||||
import net.liftweb.mapper.DB
|
||||
import net.liftweb.util.DefaultConnectionIdentifier
|
||||
|
||||
object TableViewDefinition {
|
||||
def populate(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewImpl) match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val views = ViewImpl.findAll()
|
||||
|
||||
// Make back up
|
||||
DbFunction.makeBackUpOfTable(ViewDefinition)
|
||||
// Delete all rows at the table
|
||||
ViewDefinition.bulkDelete_!!()
|
||||
|
||||
// Insert rows into table "viewdefinition" based on data in the table viewimpl
|
||||
val insertedRows =
|
||||
for {
|
||||
view: ViewImpl <- views
|
||||
} yield {
|
||||
val viewDefinition = ViewDefinition
|
||||
.create
|
||||
.isSystem_(view.isSystem)
|
||||
.isFirehose_(view.isFirehose)
|
||||
.name_(view.name)
|
||||
.bank_id(view.bankId.value)
|
||||
.account_id(view.accountId.value)
|
||||
.view_id(view.viewId.value)
|
||||
.description_(view.description)
|
||||
.isPublic_(view.isPublic)
|
||||
.usePrivateAliasIfOneExists_(view.usePrivateAliasIfOneExists)
|
||||
.usePublicAliasIfOneExists_(view.usePublicAliasIfOneExists)
|
||||
.hideOtherAccountMetadataIfAlias_(view.hideOtherAccountMetadataIfAlias)
|
||||
.canSeeTransactionThisBankAccount_(view.canSeeTransactionThisBankAccount)
|
||||
.canSeeTransactionOtherBankAccount_(view.canSeeTransactionOtherBankAccount)
|
||||
.canSeeTransactionMetadata_(view.canSeeTransactionMetadata)
|
||||
.canSeeTransactionDescription_(view.canSeeTransactionDescription)
|
||||
.canSeeTransactionAmount_(view.canSeeTransactionAmount)
|
||||
.canSeeTransactionType_(view.canSeeTransactionType)
|
||||
.canSeeTransactionCurrency_(view.canSeeTransactionCurrency)
|
||||
.canSeeTransactionStartDate_(view.canSeeTransactionStartDate)
|
||||
.canSeeTransactionFinishDate_(view.canSeeTransactionFinishDate)
|
||||
.canSeeTransactionBalance_(view.canSeeTransactionBalance)
|
||||
.canSeeComments_(view.canSeeComments)
|
||||
.canSeeOwnerComment_(view.canSeeOwnerComment)
|
||||
.canSeeTags_(view.canSeeTags)
|
||||
.canSeeImages_(view.canSeeImages)
|
||||
.canSeeBankAccountOwners_(view.canSeeBankAccountOwners)
|
||||
.canSeeBankAccountType_(view.canSeeBankAccountType)
|
||||
.canSeeBankAccountBalance_(view.canSeeBankAccountBalance)
|
||||
.canSeeBankAccountCurrency_(view.canSeeBankAccountCurrency)
|
||||
|
||||
viewDefinition
|
||||
.canSeeBankAccountLabel_(view.canSeeBankAccountLabel)
|
||||
.canSeeBankAccountNationalIdentifier_(view.canSeeBankAccountNationalIdentifier)
|
||||
.canSeeBankAccountSwift_bic_(view.canSeeBankAccountSwift_bic)
|
||||
.canSeeBankAccountIban_(view.canSeeBankAccountIban)
|
||||
.canSeeBankAccountNumber_(view.canSeeBankAccountNumber)
|
||||
.canSeeBankAccountBankName_(view.canSeeBankAccountBankName)
|
||||
.canSeeBankAccountBankPermalink_(view.canSeeBankAccountBankPermalink)
|
||||
.canSeeOtherAccountNationalIdentifier_(view.canSeeOtherAccountNationalIdentifier)
|
||||
.canSeeOtherAccountSWIFT_BIC_(view.canSeeOtherAccountSWIFT_BIC)
|
||||
.canSeeOtherAccountIBAN_(view.canSeeOtherAccountIBAN)
|
||||
.canSeeOtherAccountBankName_(view.canSeeOtherAccountBankName)
|
||||
.canSeeOtherAccountNumber_(view.canSeeOtherAccountNumber)
|
||||
.canSeeOtherAccountMetadata_(view.canSeeOtherAccountMetadata)
|
||||
.canSeeOtherAccountKind_(view.canSeeOtherAccountKind)
|
||||
.canSeeMoreInfo_(view.canSeeMoreInfo)
|
||||
.canSeeUrl_(view.canSeeUrl)
|
||||
.canSeeImageUrl_(view.canSeeImageUrl)
|
||||
.canSeeOpenCorporatesUrl_(view.canSeeOpenCorporatesUrl)
|
||||
.canSeeCorporateLocation_(view.canSeeCorporateLocation)
|
||||
.canSeePhysicalLocation_(view.canSeePhysicalLocation)
|
||||
.canSeePublicAlias_(view.canSeePublicAlias)
|
||||
.canSeePrivateAlias_(view.canSeePrivateAlias)
|
||||
.canAddMoreInfo_(view.canAddMoreInfo)
|
||||
.canAddURL_(view.canAddURL)
|
||||
.canAddImageURL_(view.canAddImageURL)
|
||||
.canAddOpenCorporatesUrl_(view.canAddOpenCorporatesUrl)
|
||||
.canAddCorporateLocation_(view.canAddCorporateLocation)
|
||||
.canAddPhysicalLocation_(view.canAddPhysicalLocation)
|
||||
.canAddPublicAlias_(view.canAddPublicAlias)
|
||||
.canAddPrivateAlias_(view.canAddPrivateAlias)
|
||||
|
||||
viewDefinition
|
||||
.canAddCounterparty_(view.canAddCounterparty)
|
||||
.canGetCounterparty_(view.canGetCounterparty)
|
||||
.canDeleteCounterparty_(view.canDeleteCounterparty)
|
||||
.canDeleteCorporateLocation_(view.canDeleteCorporateLocation)
|
||||
.canDeletePhysicalLocation_(view.canDeletePhysicalLocation)
|
||||
.canEditOwnerComment_(view.canEditOwnerComment)
|
||||
.canAddComment_(view.canAddComment)
|
||||
.canDeleteComment_(view.canDeleteComment)
|
||||
.canAddTag_(view.canAddTag)
|
||||
.canDeleteTag_(view.canDeleteTag)
|
||||
.canAddImage_(view.canAddImage)
|
||||
.canDeleteImage_(view.canDeleteImage)
|
||||
.canAddWhereTag_(view.canAddWhereTag)
|
||||
.canSeeWhereTag_(view.canSeeWhereTag)
|
||||
.canDeleteWhereTag_(view.canDeleteWhereTag)
|
||||
.canSeeBankRoutingScheme_(view.canSeeBankRoutingScheme)
|
||||
.canSeeBankRoutingAddress_(view.canSeeBankRoutingAddress)
|
||||
.canSeeBankAccountRoutingScheme_(view.canSeeBankAccountRoutingScheme)
|
||||
.canSeeBankAccountRoutingAddress_(view.canSeeBankAccountRoutingAddress)
|
||||
.canSeeOtherBankRoutingScheme_(view.canSeeOtherBankRoutingScheme)
|
||||
.canSeeOtherBankRoutingAddress_(view.canSeeOtherBankRoutingAddress)
|
||||
.canSeeOtherAccountRoutingScheme_(view.canSeeOtherAccountRoutingScheme)
|
||||
.canSeeOtherAccountRoutingAddress_(view.canSeeOtherAccountRoutingAddress)
|
||||
.canAddTransactionRequestToOwnAccount_(view.canAddTransactionRequestToOwnAccount)
|
||||
.canAddTransactionRequestToAnyAccount_(view.canAddTransactionRequestToAnyAccount)
|
||||
.canAddTransactionRequestToBeneficiary_(view.canAddTransactionRequestToBeneficiary)
|
||||
.save
|
||||
}
|
||||
val isSuccessful = insertedRows.forall(_ == true)
|
||||
val viewDefinition = ViewDefinition.findAll()
|
||||
val viewDefinitionSize = viewDefinition.size
|
||||
val endDate = System.currentTimeMillis()
|
||||
|
||||
// (${viewDefinition.map(_.id).mkString(",")});
|
||||
|
||||
val comment: String =
|
||||
s"""View implementation size: ${views.size};
|
||||
|View definition size: $viewDefinitionSize;
|
||||
|Duration: ${endDate - startDate} ms;
|
||||
|Primary keys of the inserted rows: NOPE too risky.
|
||||
""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""View implementation does not exist!;
|
||||
""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,47 +1,47 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.Constant.SYSTEM_OWNER_VIEW_ID
|
||||
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.{ZoneId, ZonedDateTime}
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.model.Consumer
|
||||
import code.views.system.ViewDefinition
|
||||
|
||||
object MigrationOfViewDefinitionCanAddTransactionRequestToBeneficiary {
|
||||
|
||||
val oneDayAgo = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)
|
||||
val oneYearInFuture = ZonedDateTime.now(ZoneId.of("UTC")).plusYears(1)
|
||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'")
|
||||
|
||||
def populateTheField(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewDefinition) match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
var isSuccessful = false
|
||||
|
||||
val view = ViewDefinition.findSystemView(SYSTEM_OWNER_VIEW_ID).map(_.canAddTransactionRequestToBeneficiary_(true).saveMe())
|
||||
|
||||
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""set $SYSTEM_OWNER_VIEW_ID.canAddTransactionRequestToBeneficiary_ to {true}""".stripMargin
|
||||
val value = view.map(_.canAddTransactionRequestToBeneficiary_.get).getOrElse(false)
|
||||
isSuccessful = value
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""${Consumer._dbTableNameLC} table does not exist""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
//package code.api.util.migration
|
||||
//
|
||||
//import code.api.Constant.SYSTEM_OWNER_VIEW_ID
|
||||
//
|
||||
//import java.time.format.DateTimeFormatter
|
||||
//import java.time.{ZoneId, ZonedDateTime}
|
||||
//import code.api.util.APIUtil
|
||||
//import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
//import code.model.Consumer
|
||||
//import code.views.system.ViewDefinition
|
||||
//
|
||||
//object MigrationOfViewDefinitionCanAddTransactionRequestToBeneficiary {
|
||||
//
|
||||
// val oneDayAgo = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)
|
||||
// val oneYearInFuture = ZonedDateTime.now(ZoneId.of("UTC")).plusYears(1)
|
||||
// val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'")
|
||||
//
|
||||
// def populateTheField(name: String): Boolean = {
|
||||
// DbFunction.tableExists(ViewDefinition) match {
|
||||
// case true =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// var isSuccessful = false
|
||||
//
|
||||
// val view = ViewDefinition.findSystemView(SYSTEM_OWNER_VIEW_ID).map(_.canAddTransactionRequestToBeneficiary_(true).saveMe())
|
||||
//
|
||||
//
|
||||
// val endDate = System.currentTimeMillis()
|
||||
// val comment: String =
|
||||
// s"""set $SYSTEM_OWNER_VIEW_ID.canAddTransactionRequestToBeneficiary_ to {true}""".stripMargin
|
||||
// val value = view.map(_.canAddTransactionRequestToBeneficiary_.get).getOrElse(false)
|
||||
// isSuccessful = value
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
//
|
||||
// case false =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// val isSuccessful = false
|
||||
// val endDate = System.currentTimeMillis()
|
||||
// val comment: String =
|
||||
// s"""${Consumer._dbTableNameLC} table does not exist""".stripMargin
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,80 +1,80 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.model.Consumer
|
||||
import code.views.system.ViewDefinition
|
||||
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.time.{ZoneId, ZonedDateTime}
|
||||
|
||||
object MigrationOfViewDefinitionCanSeeTransactionStatus {
|
||||
|
||||
val oneDayAgo = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)
|
||||
val oneYearInFuture = ZonedDateTime.now(ZoneId.of("UTC")).plusYears(1)
|
||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'")
|
||||
|
||||
def populateTheField(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewDefinition) match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
var isSuccessful = false
|
||||
|
||||
val view = ViewDefinition.findSystemView(SYSTEM_OWNER_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view1 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view2 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_DETAIL_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view3 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_DEBITS_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view4 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_BASIC_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view8 = ViewDefinition.findSystemView(SYSTEM_AUDITOR_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view5 = ViewDefinition.findSystemView(SYSTEM_STAGE_ONE_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view6 = ViewDefinition.findSystemView(SYSTEM_STANDARD_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view7 = ViewDefinition.findSystemView(SYSTEM_FIREHOSE_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view9 = ViewDefinition.findSystemView(SYSTEM_ACCOUNTANT_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
val view10 = ViewDefinition.findSystemView(SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
|
||||
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""set $SYSTEM_OWNER_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID.canSeeTransactionStatus_ to {true}
|
||||
|set $SYSTEM_READ_TRANSACTIONS_DETAIL_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_READ_TRANSACTIONS_DEBITS_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_READ_TRANSACTIONS_BASIC_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_AUDITOR_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_STAGE_ONE_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_STANDARD_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_FIREHOSE_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_ACCOUNTANT_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|set $SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
|""".stripMargin
|
||||
val value = view.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value1 = view1.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value2 = view1.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value3 = view3.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value4 = view4.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value5 = view5.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value6 = view6.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value7 = view7.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value8 = view8.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value9 = view9.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
val value10 = view10.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
|
||||
isSuccessful = value && value1 && value2 && value3 && value4 && value5 && value6 && value7 && value8 && value9 && value10
|
||||
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""${Consumer._dbTableNameLC} table does not exist""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
//package code.api.util.migration
|
||||
//
|
||||
//import code.api.Constant._
|
||||
//import code.api.util.APIUtil
|
||||
//import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
//import code.model.Consumer
|
||||
//import code.views.system.ViewDefinition
|
||||
//
|
||||
//import java.time.format.DateTimeFormatter
|
||||
//import java.time.{ZoneId, ZonedDateTime}
|
||||
//
|
||||
//object MigrationOfViewDefinitionCanSeeTransactionStatus {
|
||||
//
|
||||
// val oneDayAgo = ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)
|
||||
// val oneYearInFuture = ZonedDateTime.now(ZoneId.of("UTC")).plusYears(1)
|
||||
// val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm'Z'")
|
||||
//
|
||||
// def populateTheField(name: String): Boolean = {
|
||||
// DbFunction.tableExists(ViewDefinition) match {
|
||||
// case true =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// var isSuccessful = false
|
||||
//
|
||||
// val view = ViewDefinition.findSystemView(SYSTEM_OWNER_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view1 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view2 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_DETAIL_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view3 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_DEBITS_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view4 = ViewDefinition.findSystemView(SYSTEM_READ_TRANSACTIONS_BASIC_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view8 = ViewDefinition.findSystemView(SYSTEM_AUDITOR_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view5 = ViewDefinition.findSystemView(SYSTEM_STAGE_ONE_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view6 = ViewDefinition.findSystemView(SYSTEM_STANDARD_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view7 = ViewDefinition.findSystemView(SYSTEM_FIREHOSE_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view9 = ViewDefinition.findSystemView(SYSTEM_ACCOUNTANT_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
// val view10 = ViewDefinition.findSystemView(SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID).map(_.canSeeTransactionStatus_(true).saveMe())
|
||||
//
|
||||
//
|
||||
// val endDate = System.currentTimeMillis()
|
||||
// val comment: String =
|
||||
// s"""set $SYSTEM_OWNER_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID.canSeeTransactionStatus_ to {true}
|
||||
// |set $SYSTEM_READ_TRANSACTIONS_DETAIL_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_READ_TRANSACTIONS_DEBITS_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_READ_TRANSACTIONS_BASIC_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_AUDITOR_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_STAGE_ONE_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_STANDARD_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_FIREHOSE_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_ACCOUNTANT_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |set $SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID.canSeeTransactionStatus_ to {true};
|
||||
// |""".stripMargin
|
||||
// val value = view.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value1 = view1.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value2 = view1.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value3 = view3.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value4 = view4.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value5 = view5.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value6 = view6.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value7 = view7.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value8 = view8.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value9 = view9.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
// val value10 = view10.map(_.canSeeTransactionStatus_.get).getOrElse(false)
|
||||
//
|
||||
// isSuccessful = value && value1 && value2 && value3 && value4 && value5 && value6 && value7 && value8 && value9 && value10
|
||||
//
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
//
|
||||
// case false =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// val isSuccessful = false
|
||||
// val endDate = System.currentTimeMillis()
|
||||
// val comment: String =
|
||||
// s"""${Consumer._dbTableNameLC} table does not exist""".stripMargin
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,97 +1,97 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.Constant.{DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS, SYSTEM_OWNER_VIEW_ID, SYSTEM_STANDARD_VIEW_ID}
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.views.system.ViewDefinition
|
||||
import net.liftweb.mapper.{By, DB, NullRef}
|
||||
import net.liftweb.util.DefaultConnectionIdentifier
|
||||
|
||||
object MigrationOfViewDefinitionPermissions {
|
||||
def populate(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewDefinition) match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val ownerView = ViewDefinition.find(
|
||||
NullRef(ViewDefinition.bank_id),
|
||||
NullRef(ViewDefinition.account_id),
|
||||
By(ViewDefinition.view_id, SYSTEM_OWNER_VIEW_ID),
|
||||
By(ViewDefinition.isSystem_,true)
|
||||
).map(view =>
|
||||
view
|
||||
.canSeeTransactionRequestTypes_(true)
|
||||
.canSeeTransactionRequests_(true)
|
||||
.canSeeAvailableViewsForBankAccount_(true)
|
||||
.canUpdateBankAccountLabel_(true)
|
||||
.canSeeViewsWithPermissionsForOneUser_(true)
|
||||
.canSeeViewsWithPermissionsForAllUsers_(true)
|
||||
.canCreateCustomView_(false)
|
||||
.canDeleteCustomView_(false)
|
||||
.canUpdateCustomView_(false)
|
||||
.canGrantAccessToCustomViews_(false)
|
||||
.canRevokeAccessToCustomViews_(false)
|
||||
.canGrantAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
.canRevokeAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
.save
|
||||
)
|
||||
|
||||
val standardView = ViewDefinition.find(
|
||||
NullRef(ViewDefinition.bank_id),
|
||||
NullRef(ViewDefinition.account_id),
|
||||
By(ViewDefinition.view_id, SYSTEM_STANDARD_VIEW_ID),
|
||||
By(ViewDefinition.isSystem_,true)
|
||||
).map(view =>
|
||||
view
|
||||
.canSeeTransactionRequestTypes_(true)
|
||||
.canSeeTransactionRequests_(true)
|
||||
.canSeeAvailableViewsForBankAccount_(true)
|
||||
.canUpdateBankAccountLabel_(true)
|
||||
.canSeeViewsWithPermissionsForOneUser_(true)
|
||||
.canSeeViewsWithPermissionsForAllUsers_(true)
|
||||
.canCreateCustomView_(false)
|
||||
.canDeleteCustomView_(false)
|
||||
.canUpdateCustomView_(false)
|
||||
.canGrantAccessToCustomViews_(false)
|
||||
.canRevokeAccessToCustomViews_(false)
|
||||
.canGrantAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
.canRevokeAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
.save
|
||||
)
|
||||
|
||||
|
||||
val isSuccessful = ownerView.isDefined && standardView.isDefined
|
||||
val endDate = System.currentTimeMillis()
|
||||
|
||||
val comment: String =
|
||||
s"""ViewDefinition system $SYSTEM_OWNER_VIEW_ID and $SYSTEM_STANDARD_VIEW_ID views, update the following rows to true:
|
||||
|${ViewDefinition.canSeeTransactionRequestTypes_.dbColumnName}
|
||||
|${ViewDefinition.canSeeTransactionRequests_.dbColumnName}
|
||||
|${ViewDefinition.canSeeAvailableViewsForBankAccount_.dbColumnName}
|
||||
|${ViewDefinition.canUpdateBankAccountLabel_.dbColumnName}
|
||||
|${ViewDefinition.canCreateCustomView_.dbColumnName}
|
||||
|${ViewDefinition.canDeleteCustomView_.dbColumnName}
|
||||
|${ViewDefinition.canUpdateCustomView_.dbColumnName}
|
||||
|${ViewDefinition.canSeeViewsWithPermissionsForAllUsers_.dbColumnName}
|
||||
|${ViewDefinition.canSeeViewsWithPermissionsForOneUser_.dbColumnName}
|
||||
|${ViewDefinition.canGrantAccessToCustomViews_.dbColumnName}
|
||||
|${ViewDefinition.canRevokeAccessToCustomViews_.dbColumnName}
|
||||
|${ViewDefinition.canGrantAccessToViews_.dbColumnName}
|
||||
|${ViewDefinition.canRevokeAccessToViews_.dbColumnName}
|
||||
|Duration: ${endDate - startDate} ms;
|
||||
""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""ViewDefinition does not exist!""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
//package code.api.util.migration
|
||||
//
|
||||
//import code.api.Constant.{DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS, SYSTEM_OWNER_VIEW_ID, SYSTEM_STANDARD_VIEW_ID}
|
||||
//import code.api.util.APIUtil
|
||||
//import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
//import code.views.system.ViewDefinition
|
||||
//import net.liftweb.mapper.{By, DB, NullRef}
|
||||
//import net.liftweb.util.DefaultConnectionIdentifier
|
||||
//
|
||||
//object MigrationOfViewDefinitionPermissions {
|
||||
// def populate(name: String): Boolean = {
|
||||
// DbFunction.tableExists(ViewDefinition) match {
|
||||
// case true =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// val ownerView = ViewDefinition.find(
|
||||
// NullRef(ViewDefinition.bank_id),
|
||||
// NullRef(ViewDefinition.account_id),
|
||||
// By(ViewDefinition.view_id, SYSTEM_OWNER_VIEW_ID),
|
||||
// By(ViewDefinition.isSystem_,true)
|
||||
// ).map(view =>
|
||||
// view
|
||||
// .canSeeTransactionRequestTypes_(true)
|
||||
// .canSeeTransactionRequests_(true)
|
||||
// .canSeeAvailableViewsForBankAccount_(true)
|
||||
// .canUpdateBankAccountLabel_(true)
|
||||
// .canSeeViewsWithPermissionsForOneUser_(true)
|
||||
// .canSeeViewsWithPermissionsForAllUsers_(true)
|
||||
// .canCreateCustomView_(false)
|
||||
// .canDeleteCustomView_(false)
|
||||
// .canUpdateCustomView_(false)
|
||||
// .canGrantAccessToCustomViews_(false)
|
||||
// .canRevokeAccessToCustomViews_(false)
|
||||
// .canGrantAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
// .canRevokeAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
// .save
|
||||
// )
|
||||
//
|
||||
// val standardView = ViewDefinition.find(
|
||||
// NullRef(ViewDefinition.bank_id),
|
||||
// NullRef(ViewDefinition.account_id),
|
||||
// By(ViewDefinition.view_id, SYSTEM_STANDARD_VIEW_ID),
|
||||
// By(ViewDefinition.isSystem_,true)
|
||||
// ).map(view =>
|
||||
// view
|
||||
// .canSeeTransactionRequestTypes_(true)
|
||||
// .canSeeTransactionRequests_(true)
|
||||
// .canSeeAvailableViewsForBankAccount_(true)
|
||||
// .canUpdateBankAccountLabel_(true)
|
||||
// .canSeeViewsWithPermissionsForOneUser_(true)
|
||||
// .canSeeViewsWithPermissionsForAllUsers_(true)
|
||||
// .canCreateCustomView_(false)
|
||||
// .canDeleteCustomView_(false)
|
||||
// .canUpdateCustomView_(false)
|
||||
// .canGrantAccessToCustomViews_(false)
|
||||
// .canRevokeAccessToCustomViews_(false)
|
||||
// .canGrantAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
// .canRevokeAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
// .save
|
||||
// )
|
||||
//
|
||||
//
|
||||
// val isSuccessful = ownerView.isDefined && standardView.isDefined
|
||||
// val endDate = System.currentTimeMillis()
|
||||
//
|
||||
// val comment: String =
|
||||
// s"""ViewDefinition system $SYSTEM_OWNER_VIEW_ID and $SYSTEM_STANDARD_VIEW_ID views, update the following rows to true:
|
||||
// |${ViewDefinition.canSeeTransactionRequestTypes_.dbColumnName}
|
||||
// |${ViewDefinition.canSeeTransactionRequests_.dbColumnName}
|
||||
// |${ViewDefinition.canSeeAvailableViewsForBankAccount_.dbColumnName}
|
||||
// |${ViewDefinition.canUpdateBankAccountLabel_.dbColumnName}
|
||||
// |${ViewDefinition.canCreateCustomView_.dbColumnName}
|
||||
// |${ViewDefinition.canDeleteCustomView_.dbColumnName}
|
||||
// |${ViewDefinition.canUpdateCustomView_.dbColumnName}
|
||||
// |${ViewDefinition.canSeeViewsWithPermissionsForAllUsers_.dbColumnName}
|
||||
// |${ViewDefinition.canSeeViewsWithPermissionsForOneUser_.dbColumnName}
|
||||
// |${ViewDefinition.canGrantAccessToCustomViews_.dbColumnName}
|
||||
// |${ViewDefinition.canRevokeAccessToCustomViews_.dbColumnName}
|
||||
// |${ViewDefinition.canGrantAccessToViews_.dbColumnName}
|
||||
// |${ViewDefinition.canRevokeAccessToViews_.dbColumnName}
|
||||
// |Duration: ${endDate - startDate} ms;
|
||||
// """.stripMargin
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
//
|
||||
// case false =>
|
||||
// val startDate = System.currentTimeMillis()
|
||||
// val commitId: String = APIUtil.gitCommit
|
||||
// val isSuccessful = false
|
||||
// val endDate = System.currentTimeMillis()
|
||||
// val comment: String =
|
||||
// s"""ViewDefinition does not exist!""".stripMargin
|
||||
// saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
// isSuccessful
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package code.api.util.migration
|
||||
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.migration.Migration.{DbFunction, saveLog}
|
||||
import code.views.MapperViews
|
||||
import code.views.system.{ViewDefinition, ViewPermission}
|
||||
|
||||
object MigrationOfViewPermissions {
|
||||
def populate(name: String): Boolean = {
|
||||
DbFunction.tableExists(ViewDefinition) && DbFunction.tableExists(ViewPermission)match {
|
||||
case true =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
|
||||
val allViewDefinitions = ViewDefinition.findAll()
|
||||
val viewPermissionRowNumberBefore = ViewPermission.count
|
||||
allViewDefinitions.map(v => MapperViews.migrateViewPermissions(v))
|
||||
val viewPermissionRowNumberAfter = ViewPermission.count
|
||||
|
||||
val isSuccessful = true
|
||||
val endDate = System.currentTimeMillis()
|
||||
|
||||
val comment: String = s"""migrate all permissions from ViewDefinition (${allViewDefinitions.length} rows) to ViewPermission (${viewPermissionRowNumberAfter-viewPermissionRowNumberBefore} added) .""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
|
||||
case false =>
|
||||
val startDate = System.currentTimeMillis()
|
||||
val commitId: String = APIUtil.gitCommit
|
||||
val isSuccessful = false
|
||||
val endDate = System.currentTimeMillis()
|
||||
val comment: String =
|
||||
s"""ViewDefinition or ViewPermission does not exist!""".stripMargin
|
||||
saveLog(name, commitId, isSuccessful, startDate, endDate, comment)
|
||||
isSuccessful
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,14 @@
|
||||
package code.api.util.newstyle
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.{OBPReturnType, unboxFullOrFail}
|
||||
import code.api.util.ErrorMessages.{InvalidConnectorResponse}
|
||||
import code.api.util.ErrorMessages.InvalidConnectorResponse
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import code.bankconnectors.Connector
|
||||
import code.views.Views
|
||||
import com.openbankproject.commons.model.{AccountBalances, AccountsBalances, BankId, BankIdAccountId, User, ViewId}
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.model._
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
object BalanceNewStyle {
|
||||
@ -20,7 +22,7 @@ object BalanceNewStyle {
|
||||
Future {
|
||||
val (views, accountAccesses) = Views.views.vend.getAccountAccessAtBankThroughView(user, bankId, viewId)
|
||||
// Filter views which can read the balance
|
||||
val canSeeBankAccountBalanceViews = views.filter(_.canSeeBankAccountBalance)
|
||||
val canSeeBankAccountBalanceViews = views.filter(_.allowed_actions.exists( _ == CAN_SEE_BANK_ACCOUNT_BALANCE))
|
||||
// Filter accounts the user has permission to see balances and remove duplicates
|
||||
val allowedAccounts = APIUtil.intersectAccountAccessAndView(accountAccesses, canSeeBankAccountBalanceViews)
|
||||
allowedAccounts
|
||||
@ -35,8 +37,11 @@ object BalanceNewStyle {
|
||||
Future {
|
||||
val (views, accountAccesses) = Views.views.vend.privateViewsUserCanAccessAtBank(user, bankId)
|
||||
// Filter views which can read the balance
|
||||
val canSeeBankAccountBalanceViews = views.filter(_.canSeeBankAccountBalance)
|
||||
// Filter accounts the user has permission to see balances and remove duplicates
|
||||
|
||||
val viewsWithActions = views.map(view => (view, view.allowed_actions))
|
||||
val canSeeBankAccountBalanceViews = viewsWithActions.filter {
|
||||
case (_, actions) => actions.contains(CAN_SEE_BANK_ACCOUNT_BALANCE)
|
||||
}.map(_._1)
|
||||
val allowedAccounts = APIUtil.intersectAccountAccessAndView(accountAccesses, canSeeBankAccountBalanceViews)
|
||||
allowedAccounts
|
||||
} map {
|
||||
|
||||
248
obp-api/src/main/scala/code/api/util/newstyle/ViewNewStyle.scala
Normal file
248
obp-api/src/main/scala/code/api/util/newstyle/ViewNewStyle.scala
Normal file
@ -0,0 +1,248 @@
|
||||
package code.api.util.newstyle
|
||||
|
||||
import code.api.Constant
|
||||
import code.api.util.APIUtil.{OBPReturnType, unboxFullOrFail}
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import code.model._
|
||||
import code.views.Views
|
||||
import code.views.system.ViewPermission
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common._
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
object ViewNewStyle {
|
||||
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
|
||||
def customView(viewId: ViewId, bankAccountId: BankIdAccountId, callContext: Option[CallContext]): Future[View] = {
|
||||
Views.views.vend.customViewFuture(viewId, bankAccountId) map {
|
||||
unboxFullOrFail(_, callContext, s"$ViewNotFound. Current ViewId is $viewId")
|
||||
}
|
||||
}
|
||||
|
||||
def systemView(viewId: ViewId, callContext: Option[CallContext]): Future[View] = {
|
||||
Views.views.vend.systemViewFuture(viewId) map {
|
||||
unboxFullOrFail(_, callContext, s"$SystemViewNotFound. Current ViewId is $viewId")
|
||||
}
|
||||
}
|
||||
|
||||
def systemViews(): Future[List[View]] = {
|
||||
Views.views.vend.getSystemViews()
|
||||
}
|
||||
|
||||
|
||||
def grantAccessToCustomView(view: View, user: User, callContext: Option[CallContext]): Future[View] = {
|
||||
view.isSystem match {
|
||||
case false =>
|
||||
Future(Views.views.vend.grantAccessToCustomView(BankIdAccountIdViewId(view.bankId, view.accountId, view.viewId), user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotGrantAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case true =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for system views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def revokeAccessToCustomView(view: View, user: User, callContext: Option[CallContext]): Future[Boolean] = {
|
||||
view.isSystem match {
|
||||
case false =>
|
||||
Future(Views.views.vend.revokeAccess(BankIdAccountIdViewId(view.bankId, view.accountId, view.viewId), user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotRevokeAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case true =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for system views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def grantAccessToSystemView(bankId: BankId, accountId: AccountId, view: View, user: User, callContext: Option[CallContext]): Future[View] = {
|
||||
view.isSystem match {
|
||||
case true =>
|
||||
Future(Views.views.vend.grantAccessToSystemView(bankId, accountId, view, user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotGrantAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case false =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for custom views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def revokeAccessToSystemView(bankId: BankId, accountId: AccountId, view: View, user: User, callContext: Option[CallContext]): Future[Boolean] = {
|
||||
view.isSystem match {
|
||||
case true =>
|
||||
Future(Views.views.vend.revokeAccessToSystemView(bankId, accountId, view, user)) map {
|
||||
unboxFullOrFail(_, callContext, s"$CannotRevokeAccountAccess Current ViewId is ${view.viewId.value}")
|
||||
}
|
||||
case false =>
|
||||
Future(Empty) map {
|
||||
unboxFullOrFail(_, callContext, s"This function cannot be used for custom views.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def createSystemView(view: CreateViewJson, callContext: Option[CallContext]): Future[View] = {
|
||||
Views.views.vend.createSystemView(view) map {
|
||||
unboxFullOrFail(_, callContext, s"$CreateSystemViewError")
|
||||
}
|
||||
}
|
||||
|
||||
def updateSystemView(viewId: ViewId, view: UpdateViewJSON, callContext: Option[CallContext]): Future[View] = {
|
||||
Views.views.vend.updateSystemView(viewId, view) map {
|
||||
unboxFullOrFail(_, callContext, s"$UpdateSystemViewError")
|
||||
}
|
||||
}
|
||||
|
||||
def deleteSystemView(viewId: ViewId, callContext: Option[CallContext]): Future[Boolean] = {
|
||||
Views.views.vend.removeSystemView(viewId) map {
|
||||
unboxFullOrFail(_, callContext, s"$DeleteSystemViewError")
|
||||
}
|
||||
}
|
||||
|
||||
def checkOwnerViewAccessAndReturnOwnerView(user: User, bankAccountId: BankIdAccountId, callContext: Option[CallContext]): Future[View] = {
|
||||
Future {
|
||||
user.checkOwnerViewAccessAndReturnOwnerView(bankAccountId, callContext)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoOwnerView" + "userId : " + user.userId + ". bankId : " + s"${bankAccountId.bankId}" + ". accountId : " + s"${bankAccountId.accountId}")
|
||||
}
|
||||
}
|
||||
|
||||
def checkViewAccessAndReturnView(viewId: ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]): Future[View] = {
|
||||
Future {
|
||||
APIUtil.checkViewAccessAndReturnView(viewId, bankAccountId, user, callContext)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${viewId.value}")
|
||||
}
|
||||
}
|
||||
|
||||
def checkAccountAccessAndGetView(viewId: ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]): Future[View] = {
|
||||
Future {
|
||||
APIUtil.checkViewAccessAndReturnView(viewId, bankAccountId, user, callContext)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${viewId.value}", 403)
|
||||
}
|
||||
}
|
||||
|
||||
def checkViewsAccessAndReturnView(firstView: ViewId, secondView: ViewId, bankAccountId: BankIdAccountId, user: Option[User], callContext: Option[CallContext]): Future[View] = {
|
||||
Future {
|
||||
APIUtil.checkViewAccessAndReturnView(firstView, bankAccountId, user, callContext).or(
|
||||
APIUtil.checkViewAccessAndReturnView(secondView, bankAccountId, user, callContext)
|
||||
)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${firstView.value} or ${secondView.value}")
|
||||
}
|
||||
}
|
||||
|
||||
def checkBalancingTransactionAccountAccessAndReturnView(doubleEntryTransaction: DoubleEntryTransaction, user: Option[User], callContext: Option[CallContext]): Future[View] = {
|
||||
val debitBankAccountId = BankIdAccountId(
|
||||
doubleEntryTransaction.debitTransactionBankId,
|
||||
doubleEntryTransaction.debitTransactionAccountId
|
||||
)
|
||||
val creditBankAccountId = BankIdAccountId(
|
||||
doubleEntryTransaction.creditTransactionBankId,
|
||||
doubleEntryTransaction.creditTransactionAccountId
|
||||
)
|
||||
val ownerViewId = ViewId(Constant.SYSTEM_OWNER_VIEW_ID)
|
||||
Future {
|
||||
APIUtil.checkViewAccessAndReturnView(ownerViewId, debitBankAccountId, user, callContext).or(
|
||||
APIUtil.checkViewAccessAndReturnView(ownerViewId, creditBankAccountId, user, callContext)
|
||||
)
|
||||
} map {
|
||||
unboxFullOrFail(_, callContext, s"$UserNoPermissionAccessView Current ViewId is ${ownerViewId.value}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def createCustomView(bankAccountId: BankIdAccountId, createViewJson: CreateViewJson, callContext: Option[CallContext]): OBPReturnType[View] =
|
||||
Future {
|
||||
Views.views.vend.createCustomView(bankAccountId, createViewJson)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$CreateCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def updateCustomView(bankAccountId: BankIdAccountId, viewId: ViewId, viewUpdateJson: UpdateViewJSON, callContext: Option[CallContext]): OBPReturnType[View] =
|
||||
Future {
|
||||
Views.views.vend.updateCustomView(bankAccountId, viewId, viewUpdateJson)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$UpdateCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def removeCustomView(viewId: ViewId, bankAccountId: BankIdAccountId, callContext: Option[CallContext]) =
|
||||
Future {
|
||||
Views.views.vend.removeCustomView(viewId, bankAccountId)
|
||||
} map { i =>
|
||||
(unboxFullOrFail(i, callContext, s"$DeleteCustomViewError"), callContext)
|
||||
}
|
||||
|
||||
def grantAccessToView(account: BankAccount, u: User, bankIdAccountIdViewId: BankIdAccountIdViewId, provider: String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.grantAccessToView(u, bankIdAccountIdViewId, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewId(${bankIdAccountIdViewId.viewId.value}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
def grantAccessToMultipleViews(account: BankAccount, u: User, bankIdAccountIdViewIds: List[BankIdAccountIdViewId], provider: String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.grantAccessToMultipleViews(u, bankIdAccountIdViewIds, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanGrantAccessToViewForTargetAccount + s"Current ViewIds(${bankIdAccountIdViewIds}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
def revokeAccessToView(account: BankAccount, u: User, bankIdAccountIdViewId: BankIdAccountIdViewId, provider: String, providerId: String, callContext: Option[CallContext]) = Future {
|
||||
account.revokeAccessToView(u, bankIdAccountIdViewId, provider, providerId, callContext: Option[CallContext])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
UserLacksPermissionCanRevokeAccessToViewForTargetAccount + s"Current ViewId(${bankIdAccountIdViewId.viewId.value}) and current UserId(${u.userId})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def findSystemViewPermission(viewId: ViewId, permissionName: String, callContext: Option[CallContext]) = Future {
|
||||
ViewPermission.findSystemViewPermission(viewId: ViewId, permissionName: String)
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
ViewPermissionNotFound + s"Current System ViewId(${viewId.value}) and PermissionName (${permissionName})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def createSystemViewPermission(viewId: ViewId, permissionName: String, extraData: Option[List[String]], callContext: Option[CallContext]) = Future {
|
||||
ViewPermission.createSystemViewPermission(viewId: ViewId, permissionName: String, extraData: Option[List[String]])
|
||||
} map {
|
||||
x =>
|
||||
(unboxFullOrFail(
|
||||
x,
|
||||
callContext,
|
||||
CreateViewPermissionError + s"Current System ViewId(${viewId.value}) and Permission (${permissionName})",
|
||||
403),
|
||||
callContext
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package code.api.v1_2_1
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.cache.Caching
|
||||
import code.api.util.APIUtil._
|
||||
@ -8,14 +9,13 @@ import code.api.util.ErrorMessages._
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.bankconnectors._
|
||||
import code.metadata.counterparties.Counterparties
|
||||
import code.model.{BankAccountX, BankX, ModeratedTransactionMetadata, UserX, toBankAccountExtended, toBankExtended}
|
||||
import code.util.Helper
|
||||
import code.util.Helper.booleanToBox
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
@ -26,7 +26,6 @@ import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.util.Helpers._
|
||||
import net.liftweb.util.StringHelpers
|
||||
|
||||
import java.net.URL
|
||||
import java.util.UUID.randomUUID
|
||||
@ -93,7 +92,7 @@ trait APIMethods121 {
|
||||
private def moderatedTransactionMetadataFuture(bankId : BankId, accountId : AccountId, viewId : ViewId, transactionID : TransactionId, user : Box[User], callContext: Option[CallContext]): Future[ModeratedTransactionMetadata] = {
|
||||
for {
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view: View <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
view: View <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
(moderatedTransaction, callContext) <- account.moderatedTransactionFuture(transactionID, view, user, callContext) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionsException)
|
||||
}
|
||||
@ -478,10 +477,10 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
json <- NewStyle.function.tryons(InvalidJsonFormat, 400, callContext) { json.extract[UpdateAccountJSON] }
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
anyViewContainsCanUpdateBankAccountLabelPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canUpdateBankAccountLabel).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
permission <- NewStyle.function.permission(account.bankId, account.accountId, u, callContext)
|
||||
anyViewContainsCanUpdateBankAccountLabelPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_BANK_ACCOUNT_LABEL)).find(true == _).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canUpdateBankAccountLabel_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_UPDATE_BANK_ACCOUNT_LABEL)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanUpdateBankAccountLabelPermission
|
||||
@ -541,10 +540,10 @@ trait APIMethods121 {
|
||||
u <- cc.user ?~ UserNotLoggedIn
|
||||
bankAccount <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
|
||||
permission <- Views.views.vend.permission(BankIdAccountId(bankAccount.bankId, bankAccount.accountId), u)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.canSeeAvailableViewsForBankAccount).find(_.==(true)).getOrElse(false)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToBox(
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission,
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeAvailableViewsForBankAccount_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)}` permission on any your views"
|
||||
)
|
||||
views <- Full(Views.views.vend.availableViewsForAccount(BankIdAccountId(bankAccount.bankId, bankAccount.accountId)))
|
||||
} yield {
|
||||
@ -606,10 +605,10 @@ trait APIMethods121 {
|
||||
createViewJsonV121.allowed_actions
|
||||
)
|
||||
anyViewContainsCanCreateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canCreateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanCreateCustomViewPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canCreateCustomView_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_CREATE_CUSTOM_VIEW)}` permission on any your views"
|
||||
)
|
||||
view <- Views.views.vend.createCustomView(BankIdAccountId(bankId,accountId), createViewJson)?~ CreateCustomViewError
|
||||
} yield {
|
||||
@ -668,10 +667,10 @@ trait APIMethods121 {
|
||||
allowed_actions = updateJsonV121.allowed_actions
|
||||
)
|
||||
anyViewContainsCanUpdateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canUpdateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanUpdateCustomViewPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canUpdateCustomView_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views"
|
||||
)
|
||||
updatedView <- Views.views.vend.updateCustomView(BankIdAccountId(bankId, accountId),viewId, updateViewJson) ?~ CreateCustomViewError
|
||||
} yield {
|
||||
@ -711,18 +710,18 @@ trait APIMethods121 {
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
// custom views start with `_` eg _play, _work, and System views start with a letter, eg: owner
|
||||
_ <- Helper.booleanToFuture(InvalidCustomViewFormat+s"Current view_name (${viewId.value})", cc=callContext) { viewId.value.startsWith("_") }
|
||||
_ <- NewStyle.function.customView(viewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
_ <- ViewNewStyle.customView(viewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
|
||||
anyViewContainsCanDeleteCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canDeleteCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_DELETE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canDeleteCustomView_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_DELETE_CUSTOM_VIEW)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanDeleteCustomViewPermission
|
||||
}
|
||||
|
||||
deleted <- NewStyle.function.removeCustomView(viewId, BankIdAccountId(bankId, accountId),callContext)
|
||||
deleted <- ViewNewStyle.removeCustomView(viewId, BankIdAccountId(bankId, accountId),callContext)
|
||||
} yield {
|
||||
(Full(deleted), HttpCode.`204`(callContext))
|
||||
}
|
||||
@ -753,10 +752,10 @@ trait APIMethods121 {
|
||||
u <- cc.user ?~ UserNotLoggedIn
|
||||
account <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
|
||||
anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canSeeViewsWithPermissionsForAllUsers).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeViewsWithPermissionsForAllUsers_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views"
|
||||
)
|
||||
permissions = Views.views.vend.permissions(BankIdAccountId(bankId, accountId))
|
||||
} yield {
|
||||
@ -797,11 +796,11 @@ trait APIMethods121 {
|
||||
loggedInUser <- cc.user ?~ UserNotLoggedIn
|
||||
account <- BankAccountX(bankId, accountId) ?~! BankAccountNotFound
|
||||
loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser)
|
||||
anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.canSeeViewsWithPermissionsForOneUser)
|
||||
.find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)))
|
||||
.getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanSeeViewsWithPermissionsForOneUserPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeViewsWithPermissionsForOneUser_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views"
|
||||
)
|
||||
userFromURL <- UserX.findByProviderId(provider, providerId) ?~! UserNotFoundByProviderAndProvideId
|
||||
permission <- Views.views.vend.permission(BankIdAccountId(bankId, accountId), userFromURL)
|
||||
@ -848,7 +847,7 @@ trait APIMethods121 {
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
failMsg = "wrong format JSON"
|
||||
viewIds <- NewStyle.function.tryons(failMsg, 400, callContext) { json.extract[ViewIdsJson] }
|
||||
(addedViews, callContext) <- NewStyle.function.grantAccessToMultipleViews(
|
||||
(addedViews, callContext) <- ViewNewStyle.grantAccessToMultipleViews(
|
||||
account, u,
|
||||
viewIds.views.map(viewIdString => BankIdAccountIdViewId(bankId, accountId,ViewId(viewIdString))),
|
||||
provider,
|
||||
@ -895,7 +894,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
(addedView, callContext) <- NewStyle.function.grantAccessToView(account, u, BankIdAccountIdViewId(bankId, accountId, viewId), provider, providerId, callContext)
|
||||
(addedView, callContext) <- ViewNewStyle.grantAccessToView(account, u, BankIdAccountIdViewId(bankId, accountId, viewId), provider, providerId, callContext)
|
||||
} yield {
|
||||
val viewJson = JSONFactory.createViewJSON(addedView)
|
||||
(viewJson, HttpCode.`201`(callContext))
|
||||
@ -955,7 +954,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
_ <- NewStyle.function.revokeAccessToView(account, u, BankIdAccountIdViewId(bankId, accountId, viewId), provider, providerId, callContext)
|
||||
_ <- ViewNewStyle.revokeAccessToView(account, u, BankIdAccountIdViewId(bankId, accountId, viewId), provider, providerId, callContext)
|
||||
} yield {
|
||||
(Full(""), HttpCode.`204`(callContext))
|
||||
}
|
||||
@ -1023,7 +1022,7 @@ trait APIMethods121 {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, Some(cc))
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), cc.user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), cc.user, callContext)
|
||||
(otherBankAccounts, callContext) <- NewStyle.function.moderatedOtherBankAccounts(account, view, cc.user, callContext)
|
||||
} yield {
|
||||
(JSONFactory.createOtherBankAccountsJSON(otherBankAccounts), HttpCode.`200`(callContext))
|
||||
@ -1053,7 +1052,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(u, callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, u, callContext)
|
||||
} yield {
|
||||
val otherBankAccountJson = JSONFactory.createOtherBankAccount(otherBankAccount)
|
||||
@ -1085,7 +1084,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1124,7 +1123,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1176,7 +1175,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1229,7 +1228,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1280,7 +1279,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1327,7 +1326,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1373,7 +1372,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1425,7 +1424,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1476,7 +1475,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1525,7 +1524,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1574,7 +1573,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1622,7 +1621,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1671,7 +1670,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1720,7 +1719,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1768,7 +1767,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1816,7 +1815,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1864,7 +1863,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1906,7 +1905,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -1953,7 +1952,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2002,7 +2001,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2050,7 +2049,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2098,7 +2097,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2153,7 +2152,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2204,7 +2203,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2255,7 +2254,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2310,7 +2309,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2361,7 +2360,7 @@ trait APIMethods121 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(otherBankAccount, callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_other_account_metadata. Current ViewId($viewId)", cc=callContext) {
|
||||
otherBankAccount.metadata.isDefined
|
||||
@ -2746,7 +2745,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(user), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
metadata <- moderatedTransactionMetadataFuture(bankId, accountId, viewId, transactionId, Full(user), callContext)
|
||||
delete <- Future(metadata.deleteComment(commentId, Full(user), account, view, callContext)) map {
|
||||
unboxFullOrFail(_, callContext, "")
|
||||
@ -2865,7 +2864,7 @@ trait APIMethods121 {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(Full(user), callContext) <- authenticatedAccess(cc)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
metadata <- moderatedTransactionMetadataFuture(bankId, accountId, viewId, transactionId, Full(user), callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
delete <- Future(metadata.deleteTag(tagId, Full(user), bankAccount, view, callContext)) map {
|
||||
@ -2990,7 +2989,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(user), callContext) <- authenticatedAccess(cc)
|
||||
metadata <- moderatedTransactionMetadataFuture(bankId, accountId, viewId, transactionId, Full(user), callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(user), callContext)
|
||||
(account, _) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
delete <- Future(metadata.deleteImage(imageId, Full(user), account, view, callContext)) map {
|
||||
unboxFullOrFail(_, callContext, "")
|
||||
@ -3163,7 +3162,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(user, callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
metadata <- moderatedTransactionMetadataFuture(bankId, accountId, viewId, transactionId, user, callContext)
|
||||
delete <- Future(metadata.deleteWhereTag(viewId, user, account, view, callContext)) map {
|
||||
unboxFullOrFail(_, callContext, "Delete not completed")
|
||||
@ -3197,7 +3196,7 @@ trait APIMethods121 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
(moderatedTransaction, callContext) <- account.moderatedTransactionFuture(transactionId, view, Full(u), callContext) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionsException)
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
package code.api.v1_2_1
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ErrorMessages.MandatoryPropertyIsNotSet
|
||||
@ -372,7 +373,7 @@ object JSONFactory{
|
||||
val phone = APIUtil.getPropsValue("hosted_by.phone", "+49 (0)30 8145 3994")
|
||||
val organisationWebsite = APIUtil.getPropsValue("organisation_website", "https://www.tesobe.com")
|
||||
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
|
||||
val hostedBy = new HostedBy(organisation, email, phone, organisationWebsite)
|
||||
val apiInfoJSON = new APIInfoJSON(apiVersion.vDottedApiVersion, apiVersionStatus, gitCommit, connector, hostedBy)
|
||||
@ -406,6 +407,8 @@ object JSONFactory{
|
||||
else
|
||||
""
|
||||
|
||||
val allowed_actions = view.allowed_actions
|
||||
|
||||
new ViewJSONV121(
|
||||
id = view.viewId.value,
|
||||
short_name = stringOrNull(view.name),
|
||||
@ -413,65 +416,65 @@ object JSONFactory{
|
||||
is_public = view.isPublic,
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
can_add_comment = view.canAddComment,
|
||||
can_add_corporate_location = view.canAddCorporateLocation,
|
||||
can_add_image = view.canAddImage,
|
||||
can_add_image_url = view.canAddImageURL,
|
||||
can_add_more_info = view.canAddMoreInfo,
|
||||
can_add_open_corporates_url = view.canAddOpenCorporatesUrl,
|
||||
can_add_physical_location = view.canAddPhysicalLocation,
|
||||
can_add_private_alias = view.canAddPrivateAlias,
|
||||
can_add_public_alias = view.canAddPublicAlias,
|
||||
can_add_tag = view.canAddTag,
|
||||
can_add_url = view.canAddURL,
|
||||
can_add_where_tag = view.canAddWhereTag,
|
||||
can_delete_comment = view.canDeleteComment,
|
||||
can_delete_corporate_location = view.canDeleteCorporateLocation,
|
||||
can_delete_image = view.canDeleteImage,
|
||||
can_delete_physical_location = view.canDeletePhysicalLocation,
|
||||
can_delete_tag = view.canDeleteTag,
|
||||
can_delete_where_tag = view.canDeleteWhereTag,
|
||||
can_edit_owner_comment = view.canEditOwnerComment,
|
||||
can_see_bank_account_balance = view.canSeeBankAccountBalance,
|
||||
can_see_bank_account_bank_name = view.canSeeBankAccountBankName,
|
||||
can_see_bank_account_currency = view.canSeeBankAccountCurrency,
|
||||
can_see_bank_account_iban = view.canSeeBankAccountIban,
|
||||
can_see_bank_account_label = view.canSeeBankAccountLabel,
|
||||
can_see_bank_account_national_identifier = view.canSeeBankAccountNationalIdentifier,
|
||||
can_see_bank_account_number = view.canSeeBankAccountNumber,
|
||||
can_see_bank_account_owners = view.canSeeBankAccountOwners,
|
||||
can_see_bank_account_swift_bic = view.canSeeBankAccountSwift_bic,
|
||||
can_see_bank_account_type = view.canSeeBankAccountType,
|
||||
can_see_comments = view.canSeeComments,
|
||||
can_see_corporate_location = view.canSeeCorporateLocation,
|
||||
can_see_image_url = view.canSeeImageUrl,
|
||||
can_see_images = view.canSeeImages,
|
||||
can_see_more_info = view.canSeeMoreInfo,
|
||||
can_see_open_corporates_url = view.canSeeOpenCorporatesUrl,
|
||||
can_see_other_account_bank_name = view.canSeeOtherAccountBankName,
|
||||
can_see_other_account_iban = view.canSeeOtherAccountIBAN,
|
||||
can_see_other_account_kind = view.canSeeOtherAccountKind,
|
||||
can_see_other_account_metadata = view.canSeeOtherAccountMetadata,
|
||||
can_see_other_account_national_identifier = view.canSeeOtherAccountNationalIdentifier,
|
||||
can_see_other_account_number = view.canSeeOtherAccountNumber,
|
||||
can_see_other_account_swift_bic = view.canSeeOtherAccountSWIFT_BIC,
|
||||
can_see_owner_comment = view.canSeeOwnerComment,
|
||||
can_see_physical_location = view.canSeePhysicalLocation,
|
||||
can_see_private_alias = view.canSeePrivateAlias,
|
||||
can_see_public_alias = view.canSeePublicAlias,
|
||||
can_see_tags = view.canSeeTags,
|
||||
can_see_transaction_amount = view.canSeeTransactionAmount,
|
||||
can_see_transaction_balance = view.canSeeTransactionBalance,
|
||||
can_see_transaction_currency = view.canSeeTransactionCurrency,
|
||||
can_see_transaction_description = view.canSeeTransactionDescription,
|
||||
can_see_transaction_finish_date = view.canSeeTransactionFinishDate,
|
||||
can_see_transaction_metadata = view.canSeeTransactionMetadata,
|
||||
can_see_transaction_other_bank_account = view.canSeeTransactionOtherBankAccount,
|
||||
can_see_transaction_start_date = view.canSeeTransactionStartDate,
|
||||
can_see_transaction_this_bank_account = view.canSeeTransactionThisBankAccount,
|
||||
can_see_transaction_type = view.canSeeTransactionType,
|
||||
can_see_url = view.canSeeUrl,
|
||||
can_see_where_tag = view.canSeeWhereTag
|
||||
can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT),
|
||||
can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION),
|
||||
can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE),
|
||||
can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL),
|
||||
can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO),
|
||||
can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL),
|
||||
can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION),
|
||||
can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS),
|
||||
can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS),
|
||||
can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG),
|
||||
can_add_url = allowed_actions.exists(_ == CAN_ADD_URL),
|
||||
can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG),
|
||||
can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT),
|
||||
can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION),
|
||||
can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE),
|
||||
can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION),
|
||||
can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG),
|
||||
can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG),
|
||||
can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT),
|
||||
can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE),
|
||||
can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME),
|
||||
can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY),
|
||||
can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN),
|
||||
can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL),
|
||||
can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER),
|
||||
can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS),
|
||||
can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC),
|
||||
can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE),
|
||||
can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS),
|
||||
can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION),
|
||||
can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL),
|
||||
can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES),
|
||||
can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO),
|
||||
can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL),
|
||||
can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME),
|
||||
can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN),
|
||||
can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND),
|
||||
can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA),
|
||||
can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER),
|
||||
can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC),
|
||||
can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT),
|
||||
can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION),
|
||||
can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS),
|
||||
can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS),
|
||||
can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS),
|
||||
can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT),
|
||||
can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE),
|
||||
can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY),
|
||||
can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION),
|
||||
can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE),
|
||||
can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA),
|
||||
can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT),
|
||||
can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE),
|
||||
can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT),
|
||||
can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE),
|
||||
can_see_url = allowed_actions.exists(_ == CAN_SEE_URL),
|
||||
can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
package code.api.v1_4_0
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.ApiRole._
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.v1_2_1.JSONFactory
|
||||
import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
import code.api.v2_0_0.CreateCustomerJson
|
||||
@ -14,7 +16,7 @@ import code.branches.Branches
|
||||
import code.customer.CustomerX
|
||||
import code.usercustomerlinks.UserCustomerLink
|
||||
import code.util.Helper
|
||||
import code.views.system.ViewDefinition
|
||||
import code.views.system.ViewPermission
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
@ -23,7 +25,7 @@ import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json.Extraction
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.util.Helpers.tryo
|
||||
import net.liftweb.util.{Props, StringHelpers}
|
||||
import net.liftweb.util.Props
|
||||
|
||||
import scala.collection.immutable.{List, Nil}
|
||||
import scala.concurrent.Future
|
||||
@ -450,12 +452,12 @@ trait APIMethods140 extends MdcLoggable with APIMethods130 with APIMethods121{
|
||||
(fromAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
failMsg = ErrorMessages.InvalidISOCurrencyCode.concat("Please specify a valid value for CURRENCY of your Bank Account. ")
|
||||
_ <- NewStyle.function.isValidCurrencyISOCode(fromAccount.currency, failMsg, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(fromAccount.bankId, fromAccount.accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(fromAccount.bankId, fromAccount.accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionRequestTypes_)).dropRight(1)}` permission on the View(${viewId.value} )",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUEST_TYPES)}` permission on the View(${viewId.value} )",
|
||||
cc = callContext
|
||||
) {
|
||||
view.canSeeTransactionRequestTypes
|
||||
ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_SEE_TRANSACTION_REQUEST_TYPES)
|
||||
}
|
||||
// TODO: Consider storing allowed_transaction_request_types (List of String) in View Definition.
|
||||
// TODO: This would allow us to restrict transaction request types available to the User for an Account
|
||||
|
||||
@ -2,6 +2,7 @@ package code.api.v2_0_0
|
||||
|
||||
import code.TransactionTypes.TransactionType
|
||||
import code.api.APIFailureNewStyle
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiTag._
|
||||
@ -25,8 +26,6 @@ import code.users.Users
|
||||
import code.util.Helper
|
||||
import code.util.Helper.{booleanToBox, booleanToFuture}
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
@ -1051,9 +1050,9 @@ trait APIMethods200 {
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canSeeViewsWithPermissionsForAllUsers).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeViewsWithPermissionsForAllUsers_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ALL_USERS)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanSeeViewsWithPermissionsForAllUsersPermission
|
||||
@ -1093,11 +1092,12 @@ trait APIMethods200 {
|
||||
(bank, callContext) <- BankX(bankId, Some(cc)) ?~! BankNotFound // Check bank exists.
|
||||
account <- BankAccountX(bank.bankId, accountId) ?~! {ErrorMessages.AccountNotFound} // Check Account exists.
|
||||
loggedInUserPermissionBox = Views.views.vend.permission(BankIdAccountId(bankId, accountId), loggedInUser)
|
||||
anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.canSeeViewsWithPermissionsForOneUser)
|
||||
.find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
anyViewContainsCanSeePermissionForOneUserPermission = loggedInUserPermissionBox.map(_.views.map(_.allowed_actions.exists( _ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)))
|
||||
.getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanSeePermissionForOneUserPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeViewsWithPermissionsForOneUser_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views"
|
||||
)
|
||||
userFromURL <- UserX.findByProviderId(provider, providerId) ?~! UserNotFoundByProviderAndProvideId
|
||||
permission <- Views.views.vend.permission(BankIdAccountId(bankId, accountId), userFromURL)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package code.api.v2_1_0
|
||||
|
||||
import code.TransactionTypes.TransactionType
|
||||
import code.api.Constant.CAN_SEE_TRANSACTION_REQUESTS
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.ErrorMessages.TransactionDisabled
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
@ -24,8 +25,6 @@ import code.sandbox.SandboxData
|
||||
import code.usercustomerlinks.UserCustomerLink
|
||||
import code.users.Users
|
||||
import code.util.Helper.booleanToBox
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.dto.GetProductsParam
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.model.enums.TransactionRequestTypes._
|
||||
@ -744,8 +743,8 @@ trait APIMethods210 {
|
||||
(bank, callContext ) <- BankX(bankId, Some(cc)) ?~! {BankNotFound}
|
||||
(fromAccount, callContext) <- BankAccountX(bankId, accountId, Some(cc)) ?~! {AccountNotFound}
|
||||
view <- APIUtil.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToBox(view.canSeeTransactionRequests,
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionRequests_)).dropRight(1)}` permission on the View(${viewId.value} )")
|
||||
_ <- Helper.booleanToBox(view.allowed_actions.exists(_ == CAN_SEE_TRANSACTION_REQUESTS),
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value} )")
|
||||
(transactionRequests,callContext) <- Connector.connector.vend.getTransactionRequests210(u, fromAccount, callContext)
|
||||
}
|
||||
yield {
|
||||
|
||||
@ -26,12 +26,9 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
package code.api.v2_1_0
|
||||
|
||||
import java.lang
|
||||
import java.util.Date
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.ApiRole
|
||||
import code.api.v1_2_1.{BankRoutingJsonV121}
|
||||
import com.openbankproject.commons.model.{AccountRoutingJsonV121, AmountOfMoneyJsonV121}
|
||||
import code.api.v1_2_1.BankRoutingJsonV121
|
||||
import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
import code.api.v2_0_0.JSONFactory200.{UserJsonV200, UsersJsonV200, createEntitlementJSONs}
|
||||
import code.api.v2_0_0.TransactionRequestChargeJsonV200
|
||||
@ -40,13 +37,12 @@ import code.entitlement.Entitlement
|
||||
import code.metrics.APIMetric
|
||||
import code.model.dataAccess.ResourceUser
|
||||
import code.model.{Consumer, _}
|
||||
import com.openbankproject.commons.model.Product
|
||||
import code.transactionrequests.TransactionRequests._
|
||||
import code.users.Users
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.{Box, Full}
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import java.lang
|
||||
import java.util.Date
|
||||
|
||||
|
||||
|
||||
@ -797,6 +793,7 @@ object JSONFactory210{
|
||||
else
|
||||
""
|
||||
|
||||
val allowed_actions = view.allowed_actions
|
||||
new ViewJSON(
|
||||
id = view.viewId.value,
|
||||
short_name = stringOrNull(view.name),
|
||||
@ -804,66 +801,66 @@ object JSONFactory210{
|
||||
is_public = view.isPublic,
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
can_add_comment = view.canAddComment,
|
||||
can_add_corporate_location = view.canAddCorporateLocation,
|
||||
can_add_image = view.canAddImage,
|
||||
can_add_image_url = view.canAddImageURL,
|
||||
can_add_more_info = view.canAddMoreInfo,
|
||||
can_add_open_corporates_url = view.canAddOpenCorporatesUrl,
|
||||
can_add_physical_location = view.canAddPhysicalLocation,
|
||||
can_add_private_alias = view.canAddPrivateAlias,
|
||||
can_add_public_alias = view.canAddPublicAlias,
|
||||
can_add_tag = view.canAddTag,
|
||||
can_add_url = view.canAddURL,
|
||||
can_add_where_tag = view.canAddWhereTag,
|
||||
can_add_counterparty = view.canAddCounterparty,
|
||||
can_delete_comment = view.canDeleteComment,
|
||||
can_delete_corporate_location = view.canDeleteCorporateLocation,
|
||||
can_delete_image = view.canDeleteImage,
|
||||
can_delete_physical_location = view.canDeletePhysicalLocation,
|
||||
can_delete_tag = view.canDeleteTag,
|
||||
can_delete_where_tag = view.canDeleteWhereTag,
|
||||
can_edit_owner_comment = view.canEditOwnerComment,
|
||||
can_see_bank_account_balance = view.canSeeBankAccountBalance,
|
||||
can_see_bank_account_bank_name = view.canSeeBankAccountBankName,
|
||||
can_see_bank_account_currency = view.canSeeBankAccountCurrency,
|
||||
can_see_bank_account_iban = view.canSeeBankAccountIban,
|
||||
can_see_bank_account_label = view.canSeeBankAccountLabel,
|
||||
can_see_bank_account_national_identifier = view.canSeeBankAccountNationalIdentifier,
|
||||
can_see_bank_account_number = view.canSeeBankAccountNumber,
|
||||
can_see_bank_account_owners = view.canSeeBankAccountOwners,
|
||||
can_see_bank_account_swift_bic = view.canSeeBankAccountSwift_bic,
|
||||
can_see_bank_account_type = view.canSeeBankAccountType,
|
||||
can_see_comments = view.canSeeComments,
|
||||
can_see_corporate_location = view.canSeeCorporateLocation,
|
||||
can_see_image_url = view.canSeeImageUrl,
|
||||
can_see_images = view.canSeeImages,
|
||||
can_see_more_info = view.canSeeMoreInfo,
|
||||
can_see_open_corporates_url = view.canSeeOpenCorporatesUrl,
|
||||
can_see_other_account_bank_name = view.canSeeOtherAccountBankName,
|
||||
can_see_other_account_iban = view.canSeeOtherAccountIBAN,
|
||||
can_see_other_account_kind = view.canSeeOtherAccountKind,
|
||||
can_see_other_account_metadata = view.canSeeOtherAccountMetadata,
|
||||
can_see_other_account_national_identifier = view.canSeeOtherAccountNationalIdentifier,
|
||||
can_see_other_account_number = view.canSeeOtherAccountNumber,
|
||||
can_see_other_account_swift_bic = view.canSeeOtherAccountSWIFT_BIC,
|
||||
can_see_owner_comment = view.canSeeOwnerComment,
|
||||
can_see_physical_location = view.canSeePhysicalLocation,
|
||||
can_see_private_alias = view.canSeePrivateAlias,
|
||||
can_see_public_alias = view.canSeePublicAlias,
|
||||
can_see_tags = view.canSeeTags,
|
||||
can_see_transaction_amount = view.canSeeTransactionAmount,
|
||||
can_see_transaction_balance = view.canSeeTransactionBalance,
|
||||
can_see_transaction_currency = view.canSeeTransactionCurrency,
|
||||
can_see_transaction_description = view.canSeeTransactionDescription,
|
||||
can_see_transaction_finish_date = view.canSeeTransactionFinishDate,
|
||||
can_see_transaction_metadata = view.canSeeTransactionMetadata,
|
||||
can_see_transaction_other_bank_account = view.canSeeTransactionOtherBankAccount,
|
||||
can_see_transaction_start_date = view.canSeeTransactionStartDate,
|
||||
can_see_transaction_this_bank_account = view.canSeeTransactionThisBankAccount,
|
||||
can_see_transaction_type = view.canSeeTransactionType,
|
||||
can_see_url = view.canSeeUrl,
|
||||
can_see_where_tag = view.canSeeWhereTag
|
||||
can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT),
|
||||
can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION),
|
||||
can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE),
|
||||
can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL),
|
||||
can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO),
|
||||
can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL),
|
||||
can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION),
|
||||
can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS),
|
||||
can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS),
|
||||
can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG),
|
||||
can_add_url = allowed_actions.exists(_ == CAN_ADD_URL),
|
||||
can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG),
|
||||
can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY),
|
||||
can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT),
|
||||
can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION),
|
||||
can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE),
|
||||
can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION),
|
||||
can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG),
|
||||
can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG),
|
||||
can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT),
|
||||
can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE),
|
||||
can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME),
|
||||
can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY),
|
||||
can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN),
|
||||
can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL),
|
||||
can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER),
|
||||
can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS),
|
||||
can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC),
|
||||
can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE),
|
||||
can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS),
|
||||
can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION),
|
||||
can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL),
|
||||
can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES),
|
||||
can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO),
|
||||
can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL),
|
||||
can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME),
|
||||
can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN),
|
||||
can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND),
|
||||
can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA),
|
||||
can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER),
|
||||
can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC),
|
||||
can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT),
|
||||
can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION),
|
||||
can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS),
|
||||
can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS),
|
||||
can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS),
|
||||
can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT),
|
||||
can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE),
|
||||
can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY),
|
||||
can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION),
|
||||
can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE),
|
||||
can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA),
|
||||
can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT),
|
||||
can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE),
|
||||
can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT),
|
||||
can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE),
|
||||
can_see_url = allowed_actions.exists(_ == CAN_SEE_URL),
|
||||
can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package code.api.v2_2_0
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiRole._
|
||||
@ -8,6 +9,7 @@ import code.api.util.ErrorMessages.{BankAccountNotFound, _}
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.v1_2_1.{CreateViewJsonV121, JSONFactory, UpdateViewJsonV121}
|
||||
import code.api.v2_1_0._
|
||||
import code.api.v2_2_0.JSONFactory220.transformV220ToBranch
|
||||
@ -23,8 +25,7 @@ import code.model.dataAccess.BankAccountCreation
|
||||
import code.util.Helper
|
||||
import code.util.Helper._
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import code.views.system.ViewPermission
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
@ -135,9 +136,9 @@ trait APIMethods220 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
permission <- NewStyle.function.permission(bankId, accountId, u, callContext)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.canSeeAvailableViewsForBankAccount).find(_.==(true)).getOrElse(false)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)).find(true == _).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeAvailableViewsForBankAccount_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT}` permission on any your views",
|
||||
cc= callContext
|
||||
){
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission
|
||||
@ -202,12 +203,13 @@ trait APIMethods220 {
|
||||
createViewJsonV121.which_alias_to_use,
|
||||
createViewJsonV121.hide_metadata_if_alias_used,
|
||||
createViewJsonV121.allowed_actions
|
||||
)
|
||||
anyViewContainsCanCreateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canCreateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
)
|
||||
permission <- Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
anyViewContainsCanCreateCustomViewPermission = permission.views.map(_.allowed_actions.exists(_ ==CAN_CREATE_CUSTOM_VIEW)).find(_ == true).getOrElse(false)
|
||||
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCanCreateCustomViewPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canCreateCustomView_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${CAN_CREATE_CUSTOM_VIEW}` permission on any your views"
|
||||
)
|
||||
view <- Views.views.vend.createCustomView(BankIdAccountId(bankId, accountId), createViewJson) ?~ CreateCustomViewError
|
||||
} yield {
|
||||
@ -262,11 +264,13 @@ trait APIMethods220 {
|
||||
hide_metadata_if_alias_used = updateJsonV121.hide_metadata_if_alias_used,
|
||||
allowed_actions = updateJsonV121.allowed_actions
|
||||
)
|
||||
anyViewContainsCancanUpdateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canUpdateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
|
||||
permission <- Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
anyViewContainsCancanUpdateCustomViewPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW)).find(true == _).getOrElse(false)
|
||||
|
||||
_ <- booleanToBox(
|
||||
anyViewContainsCancanUpdateCustomViewPermission,
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canUpdateCustomView_)).dropRight(1)}` permission on any your views"
|
||||
s"${ErrorMessages.CreateCustomViewError} You need the `${(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views"
|
||||
)
|
||||
updatedView <- Views.views.vend.updateCustomView(BankIdAccountId(bankId, accountId), viewId, updateViewJson) ?~ CreateCustomViewError
|
||||
} yield {
|
||||
@ -365,9 +369,12 @@ trait APIMethods220 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission} can_get_counterparty", cc=callContext) {
|
||||
view.canGetCounterparty == true
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.NoViewPermission} You need the `${(CAN_GET_COUNTERPARTY)}` permission on the View(${viewId.value} )",
|
||||
cc = callContext
|
||||
) {
|
||||
ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_GET_COUNTERPARTY)
|
||||
}
|
||||
(counterparties, callContext) <- NewStyle.function.getCounterparties(bankId,accountId,viewId, callContext)
|
||||
//Here we need create the metadata for all the explicit counterparties. maybe show them in json response.
|
||||
@ -415,10 +422,15 @@ trait APIMethods220 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}can_get_counterparty", cc=callContext) {
|
||||
view.canGetCounterparty == true
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), Some(u), callContext)
|
||||
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.NoViewPermission} You need the `${(CAN_GET_COUNTERPARTY)}` permission on the View(${viewId.value} )",
|
||||
cc = callContext
|
||||
) {
|
||||
ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_GET_COUNTERPARTY)
|
||||
}
|
||||
|
||||
counterpartyMetadata <- NewStyle.function.getMetadata(bankId, accountId, counterpartyId.value, callContext)
|
||||
(counterparty, callContext) <- NewStyle.function.getCounterpartyTrait(bankId, accountId, counterpartyId.value, callContext)
|
||||
} yield {
|
||||
@ -1189,10 +1201,13 @@ trait APIMethods220 {
|
||||
postJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostCounterpartyJSON", 400, cc.callContext) {
|
||||
json.extract[PostCounterpartyJSON]
|
||||
}
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
|
||||
_ <- Helper.booleanToFuture(s"$NoViewPermission can_add_counterparty. Please use a view with that permission or add the permission to this view.", cc=callContext) {view.canAddCounterparty}
|
||||
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.NoViewPermission} You need the `${(CAN_ADD_COUNTERPARTY)}` permission on the View(${viewId.value} )",
|
||||
cc = callContext
|
||||
) {
|
||||
ViewPermission.findViewPermissions(view).exists(_.permission.get == CAN_ADD_COUNTERPARTY)
|
||||
}
|
||||
(counterparty, callContext) <- Connector.connector.vend.checkCounterpartyExists(postJson.name, bankId.value, accountId.value, viewId.value, callContext)
|
||||
|
||||
_ <- Helper.booleanToFuture(CounterpartyAlreadyExists.replace("value for BANK_ID or ACCOUNT_ID or VIEW_ID or NAME.",
|
||||
|
||||
@ -26,31 +26,27 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
package code.api.v2_2_0
|
||||
|
||||
import java.util.Date
|
||||
|
||||
import code.actorsystem.ObpActorConfig
|
||||
import code.api.util.{APIUtil, ApiPropsWithAlias, CustomJsonFormats, OptionalFieldSerializer}
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.{EndpointInfo, MessageDoc, getPropsValue}
|
||||
import code.api.util.{APIUtil, ApiPropsWithAlias, CustomJsonFormats, OptionalFieldSerializer}
|
||||
import code.api.v1_2_1.BankRoutingJsonV121
|
||||
import com.openbankproject.commons.model.{AccountRoutingJsonV121, AmountOfMoneyJsonV121}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
import code.api.v2_1_0.{JSONFactory210, LocationJsonV210, PostCounterpartyBespokeJson, ResourceUserJSON}
|
||||
import code.atms.Atms.Atm
|
||||
import code.branches.Branches.{Branch, DriveUpString, LobbyString}
|
||||
import com.openbankproject.commons.model.FXRate
|
||||
import code.metrics.ConnectorMetric
|
||||
import code.model.dataAccess.ResourceUser
|
||||
import code.model._
|
||||
import com.openbankproject.commons.model.Product
|
||||
import code.model.dataAccess.ResourceUser
|
||||
import code.users.Users
|
||||
import code.util.Helper
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.{ReflectUtils, RequiredFieldValidation, RequiredFields}
|
||||
import com.openbankproject.commons.util.{ReflectUtils, RequiredFields}
|
||||
import net.liftweb.common.{Box, Full}
|
||||
import net.liftweb.json.Extraction.decompose
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import java.util.Date
|
||||
|
||||
|
||||
case class ViewsJSONV220(
|
||||
@ -388,6 +384,7 @@ object JSONFactory220 {
|
||||
else
|
||||
""
|
||||
|
||||
val allowed_actions = view.allowed_actions
|
||||
new ViewJSONV220(
|
||||
id = view.viewId.value,
|
||||
short_name = stringOrNull(view.name),
|
||||
@ -395,66 +392,66 @@ object JSONFactory220 {
|
||||
is_public = view.isPublic,
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
can_add_comment = view.canAddComment,
|
||||
can_add_corporate_location = view.canAddCorporateLocation,
|
||||
can_add_image = view.canAddImage,
|
||||
can_add_image_url = view.canAddImageURL,
|
||||
can_add_more_info = view.canAddMoreInfo,
|
||||
can_add_open_corporates_url = view.canAddOpenCorporatesUrl,
|
||||
can_add_physical_location = view.canAddPhysicalLocation,
|
||||
can_add_private_alias = view.canAddPrivateAlias,
|
||||
can_add_public_alias = view.canAddPublicAlias,
|
||||
can_add_tag = view.canAddTag,
|
||||
can_add_url = view.canAddURL,
|
||||
can_add_where_tag = view.canAddWhereTag,
|
||||
can_add_counterparty = view.canAddCounterparty,
|
||||
can_delete_comment = view.canDeleteComment,
|
||||
can_delete_corporate_location = view.canDeleteCorporateLocation,
|
||||
can_delete_image = view.canDeleteImage,
|
||||
can_delete_physical_location = view.canDeletePhysicalLocation,
|
||||
can_delete_tag = view.canDeleteTag,
|
||||
can_delete_where_tag = view.canDeleteWhereTag,
|
||||
can_edit_owner_comment = view.canEditOwnerComment,
|
||||
can_see_bank_account_balance = view.canSeeBankAccountBalance,
|
||||
can_see_bank_account_bank_name = view.canSeeBankAccountBankName,
|
||||
can_see_bank_account_currency = view.canSeeBankAccountCurrency,
|
||||
can_see_bank_account_iban = view.canSeeBankAccountIban,
|
||||
can_see_bank_account_label = view.canSeeBankAccountLabel,
|
||||
can_see_bank_account_national_identifier = view.canSeeBankAccountNationalIdentifier,
|
||||
can_see_bank_account_number = view.canSeeBankAccountNumber,
|
||||
can_see_bank_account_owners = view.canSeeBankAccountOwners,
|
||||
can_see_bank_account_swift_bic = view.canSeeBankAccountSwift_bic,
|
||||
can_see_bank_account_type = view.canSeeBankAccountType,
|
||||
can_see_comments = view.canSeeComments,
|
||||
can_see_corporate_location = view.canSeeCorporateLocation,
|
||||
can_see_image_url = view.canSeeImageUrl,
|
||||
can_see_images = view.canSeeImages,
|
||||
can_see_more_info = view.canSeeMoreInfo,
|
||||
can_see_open_corporates_url = view.canSeeOpenCorporatesUrl,
|
||||
can_see_other_account_bank_name = view.canSeeOtherAccountBankName,
|
||||
can_see_other_account_iban = view.canSeeOtherAccountIBAN,
|
||||
can_see_other_account_kind = view.canSeeOtherAccountKind,
|
||||
can_see_other_account_metadata = view.canSeeOtherAccountMetadata,
|
||||
can_see_other_account_national_identifier = view.canSeeOtherAccountNationalIdentifier,
|
||||
can_see_other_account_number = view.canSeeOtherAccountNumber,
|
||||
can_see_other_account_swift_bic = view.canSeeOtherAccountSWIFT_BIC,
|
||||
can_see_owner_comment = view.canSeeOwnerComment,
|
||||
can_see_physical_location = view.canSeePhysicalLocation,
|
||||
can_see_private_alias = view.canSeePrivateAlias,
|
||||
can_see_public_alias = view.canSeePublicAlias,
|
||||
can_see_tags = view.canSeeTags,
|
||||
can_see_transaction_amount = view.canSeeTransactionAmount,
|
||||
can_see_transaction_balance = view.canSeeTransactionBalance,
|
||||
can_see_transaction_currency = view.canSeeTransactionCurrency,
|
||||
can_see_transaction_description = view.canSeeTransactionDescription,
|
||||
can_see_transaction_finish_date = view.canSeeTransactionFinishDate,
|
||||
can_see_transaction_metadata = view.canSeeTransactionMetadata,
|
||||
can_see_transaction_other_bank_account = view.canSeeTransactionOtherBankAccount,
|
||||
can_see_transaction_start_date = view.canSeeTransactionStartDate,
|
||||
can_see_transaction_this_bank_account = view.canSeeTransactionThisBankAccount,
|
||||
can_see_transaction_type = view.canSeeTransactionType,
|
||||
can_see_url = view.canSeeUrl,
|
||||
can_see_where_tag = view.canSeeWhereTag
|
||||
can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT),
|
||||
can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION),
|
||||
can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE),
|
||||
can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL),
|
||||
can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO),
|
||||
can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL),
|
||||
can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION),
|
||||
can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS),
|
||||
can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS),
|
||||
can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG),
|
||||
can_add_url = allowed_actions.exists(_ == CAN_ADD_URL),
|
||||
can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG),
|
||||
can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY),
|
||||
can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT),
|
||||
can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION),
|
||||
can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE),
|
||||
can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION),
|
||||
can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG),
|
||||
can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG),
|
||||
can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT),
|
||||
can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE),
|
||||
can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME),
|
||||
can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY),
|
||||
can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN),
|
||||
can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL),
|
||||
can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER),
|
||||
can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS),
|
||||
can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC),
|
||||
can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE),
|
||||
can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS),
|
||||
can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION),
|
||||
can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL),
|
||||
can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES),
|
||||
can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO),
|
||||
can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL),
|
||||
can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME),
|
||||
can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN),
|
||||
can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND),
|
||||
can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA),
|
||||
can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER),
|
||||
can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC),
|
||||
can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT),
|
||||
can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION),
|
||||
can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS),
|
||||
can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS),
|
||||
can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS),
|
||||
can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT),
|
||||
can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE),
|
||||
can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY),
|
||||
can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION),
|
||||
can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE),
|
||||
can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA),
|
||||
can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT),
|
||||
can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE),
|
||||
can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT),
|
||||
can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE),
|
||||
can_see_url = allowed_actions.exists(_ == CAN_SEE_URL),
|
||||
can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package code.api.v3_0_0
|
||||
|
||||
import code.accountattribute.AccountAttributeX
|
||||
import code.api.Constant.{PARAM_LOCALE, PARAM_TIMESTAMP}
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.{banksJSON, branchJsonV300, _}
|
||||
import code.api.util.APIUtil.{getGlossaryItems, _}
|
||||
@ -11,6 +11,7 @@ import code.api.util.ErrorMessages._
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.v1_2_1.JSONFactory
|
||||
import code.api.v2_0_0.AccountsHelper._
|
||||
import code.api.v2_0_0.JSONFactory200
|
||||
@ -28,7 +29,6 @@ import code.users.Users
|
||||
import code.util.Helper
|
||||
import code.util.Helper.{ObpS, booleanToFuture}
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.grum.geocalc.{Coordinate, EarthCalc, Point}
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
@ -41,7 +41,6 @@ import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.json.JsonAST.JField
|
||||
import net.liftweb.json.compactRender
|
||||
import net.liftweb.util.Helpers.tryo
|
||||
import net.liftweb.util.StringHelpers
|
||||
|
||||
import java.util.regex.Pattern
|
||||
import scala.collection.immutable.{List, Nil}
|
||||
@ -141,9 +140,9 @@ trait APIMethods300 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(bankAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
permission <- NewStyle.function.permission(bankId, accountId, u, callContext)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.canSeeAvailableViewsForBankAccount).find(_.==(true)).getOrElse(false)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeAvailableViewsForBankAccount_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission
|
||||
@ -211,13 +210,13 @@ trait APIMethods300 {
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
|
||||
anyViewContainsCanCreateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canCreateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_CREATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canCreateCustomView_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_CREATE_CUSTOM_VIEW)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {anyViewContainsCanCreateCustomViewPermission}
|
||||
(view, callContext) <- NewStyle.function.createCustomView(BankIdAccountId(bankId, accountId), createViewJson, callContext)
|
||||
(view, callContext) <- ViewNewStyle.createCustomView(BankIdAccountId(bankId, accountId), createViewJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory300.createViewJSON(view), HttpCode.`201`(callContext))
|
||||
}
|
||||
@ -251,9 +250,9 @@ trait APIMethods300 {
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
anyViewContainsCanSeePermissionForOneUserPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), loggedInUser)
|
||||
.map(_.views.map(_.canSeeViewsWithPermissionsForOneUser).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeViewsWithPermissionsForOneUser_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_VIEWS_WITH_PERMISSIONS_FOR_ONE_USER)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanSeePermissionForOneUserPermission
|
||||
@ -310,22 +309,22 @@ trait APIMethods300 {
|
||||
x => fullBoxOrException(
|
||||
x ~> APIFailureNewStyle(s"$ViewNotFound. Check your post json body, metadata_view = ${updateJson.metadata_view}. It should be an existing VIEW_ID, eg: owner", 400, callContext.map(_.toLight)))
|
||||
} map { unboxFull(_) }
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId),Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId),Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = SystemViewsCanNotBeModified, cc=callContext) {
|
||||
!view.isSystem
|
||||
}
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
|
||||
anyViewContainsCancanUpdateCustomViewPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canUpdateCustomView).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_CUSTOM_VIEW))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canUpdateCustomView_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_UPDATE_CUSTOM_VIEW)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCancanUpdateCustomViewPermission
|
||||
}
|
||||
(view, callContext) <- NewStyle.function.updateCustomView(BankIdAccountId(bankId, accountId), viewId, updateJson.toUpdateViewJson, callContext)
|
||||
(view, callContext) <- ViewNewStyle.updateCustomView(BankIdAccountId(bankId, accountId), viewId, updateJson.toUpdateViewJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory300.createViewJSON(view), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -365,7 +364,7 @@ trait APIMethods300 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId),Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId),Some(u), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, Full(u), callContext)
|
||||
} yield {
|
||||
(createCoreBankAccountJSON(moderatedAccount), HttpCode.`200`(callContext))
|
||||
@ -408,7 +407,7 @@ trait APIMethods300 {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, Some(cc))
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId),cc.user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId),cc.user, callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, Empty, callContext)
|
||||
} yield {
|
||||
(createCoreBankAccountJSON(moderatedAccount), HttpCode.`200`(callContext))
|
||||
@ -452,7 +451,7 @@ trait APIMethods300 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
// Assume owner view was requested
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, Full(u), callContext)
|
||||
} yield {
|
||||
val availableViews: List[View] = Views.views.vend.privateViewsUserCanAccessForAccount(u, BankIdAccountId(account.bankId, account.accountId))
|
||||
@ -550,7 +549,7 @@ trait APIMethods300 {
|
||||
}
|
||||
_ <- NewStyle.function.hasAtLeastOneEntitlement(bankId.value, u.userId, ApiRole.canUseAccountFirehose :: canUseAccountFirehoseAtAnyBank :: Nil, callContext)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, AccountId("")), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, AccountId("")), Some(u), callContext)
|
||||
availableBankIdAccountIdList <- Future {
|
||||
Views.views.vend.getAllFirehoseAccounts(bank.bankId).map(a => BankIdAccountId(a.bankId,a.accountId))
|
||||
}
|
||||
@ -642,7 +641,7 @@ trait APIMethods300 {
|
||||
_ <- NewStyle.function.hasAtLeastOneEntitlement(failMsg = UserHasMissingRoles + allowedEntitlementsTxt)(bankId.value, u.userId, allowedEntitlements, callContext)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.getBankAccount(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId),Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId),Some(u), callContext)
|
||||
allowedParams = List("sort_direction", "limit", "offset", "from_date", "to_date")
|
||||
httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
|
||||
(obpQueryParams, callContext) <- NewStyle.function.createObpParams(httpParams, allowedParams, callContext)
|
||||
@ -709,7 +708,7 @@ trait APIMethods300 {
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
// Assume owner view was requested
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(user, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(user, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
httpParams <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
|
||||
(params, callContext) <- createQueriesByHttpParamsFuture(httpParams, callContext)
|
||||
(transactionsCore, callContext) <- bankAccount.getModeratedTransactionsCore(bank, Some(user), view, BankIdAccountId(bankId, accountId), params, callContext) map {
|
||||
@ -766,7 +765,7 @@ trait APIMethods300 {
|
||||
(user, callContext) <- authenticatedAccess(cc)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), user, callContext)
|
||||
(params, callContext) <- createQueriesByHttpParamsFuture(callContext.get.requestHeaders, callContext)
|
||||
//Note: error handling and messages for getTransactionParams are in the sub method
|
||||
(transactions, callContext) <- bankAccount.getModeratedTransactionsFuture(bank, user, view, callContext, params) map {
|
||||
@ -1789,7 +1788,7 @@ trait APIMethods300 {
|
||||
for {
|
||||
(u, callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
(otherBankAccounts, callContext) <- NewStyle.function.moderatedOtherBankAccounts(account, view, u, callContext)
|
||||
} yield {
|
||||
val otherBankAccountsJson = createOtherBankAccountsJson(otherBankAccounts)
|
||||
@ -1825,7 +1824,7 @@ trait APIMethods300 {
|
||||
for {
|
||||
(u, callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(account.bankId, account.accountId), u, callContext)
|
||||
(otherBankAccount,callContext) <- NewStyle.function.moderatedOtherBankAccount(account, other_account_id, view, u, callContext)
|
||||
} yield {
|
||||
val otherBankAccountJson = createOtherBankAccount(otherBankAccount)
|
||||
|
||||
@ -26,14 +26,12 @@ Berlin 13359, Germany
|
||||
*/
|
||||
package code.api.v3_0_0
|
||||
|
||||
import java.lang
|
||||
import java.util.Date
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.Glossary.GlossaryItem
|
||||
import code.api.util.{APIUtil, PegdownOptions}
|
||||
import code.api.v1_2_1.JSONFactory._
|
||||
import code.api.v1_2_1.{UserJSONV121, _}
|
||||
import code.api.v1_2_1._
|
||||
import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
import code.api.v2_0_0.EntitlementJSONs
|
||||
import code.api.v2_0_0.JSONFactory200.{UserJsonV200, UsersJsonV200}
|
||||
@ -51,10 +49,11 @@ import code.model.dataAccess.ResourceUser
|
||||
import code.scope.Scope
|
||||
import code.views.Views
|
||||
import com.openbankproject.commons.dto.CustomerAndAttribute
|
||||
import com.openbankproject.commons.model.{Customer, _}
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.{Box, Full}
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import java.lang
|
||||
import java.util.Date
|
||||
|
||||
//import code.api.v1_4_0.JSONFactory1_4_0._
|
||||
import code.api.v2_0_0.JSONFactory200
|
||||
@ -731,6 +730,7 @@ object JSONFactory300{
|
||||
else
|
||||
""
|
||||
|
||||
val allowed_actions = view.allowed_actions
|
||||
ViewJsonV300(
|
||||
id = view.viewId.value,
|
||||
short_name = stringOrNull(view.name),
|
||||
@ -740,81 +740,81 @@ object JSONFactory300{
|
||||
is_system = view.isSystem,
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
can_add_comment = view.canAddComment,
|
||||
can_add_corporate_location = view.canAddCorporateLocation,
|
||||
can_add_image = view.canAddImage,
|
||||
can_add_image_url = view.canAddImageURL,
|
||||
can_add_more_info = view.canAddMoreInfo,
|
||||
can_add_open_corporates_url = view.canAddOpenCorporatesUrl,
|
||||
can_add_physical_location = view.canAddPhysicalLocation,
|
||||
can_add_private_alias = view.canAddPrivateAlias,
|
||||
can_add_public_alias = view.canAddPublicAlias,
|
||||
can_add_tag = view.canAddTag,
|
||||
can_add_url = view.canAddURL,
|
||||
can_add_where_tag = view.canAddWhereTag,
|
||||
can_delete_comment = view.canDeleteComment,
|
||||
can_add_counterparty = view.canAddCounterparty,
|
||||
can_delete_corporate_location = view.canDeleteCorporateLocation,
|
||||
can_delete_image = view.canDeleteImage,
|
||||
can_delete_physical_location = view.canDeletePhysicalLocation,
|
||||
can_delete_tag = view.canDeleteTag,
|
||||
can_delete_where_tag = view.canDeleteWhereTag,
|
||||
can_edit_owner_comment = view.canEditOwnerComment,
|
||||
can_see_bank_account_balance = view.canSeeBankAccountBalance,
|
||||
can_query_available_funds = view.canQueryAvailableFunds,
|
||||
can_see_bank_account_bank_name = view.canSeeBankAccountBankName,
|
||||
can_see_bank_account_currency = view.canSeeBankAccountCurrency,
|
||||
can_see_bank_account_iban = view.canSeeBankAccountIban,
|
||||
can_see_bank_account_label = view.canSeeBankAccountLabel,
|
||||
can_see_bank_account_national_identifier = view.canSeeBankAccountNationalIdentifier,
|
||||
can_see_bank_account_number = view.canSeeBankAccountNumber,
|
||||
can_see_bank_account_owners = view.canSeeBankAccountOwners,
|
||||
can_see_bank_account_swift_bic = view.canSeeBankAccountSwift_bic,
|
||||
can_see_bank_account_type = view.canSeeBankAccountType,
|
||||
can_see_comments = view.canSeeComments,
|
||||
can_see_corporate_location = view.canSeeCorporateLocation,
|
||||
can_see_image_url = view.canSeeImageUrl,
|
||||
can_see_images = view.canSeeImages,
|
||||
can_see_more_info = view.canSeeMoreInfo,
|
||||
can_see_open_corporates_url = view.canSeeOpenCorporatesUrl,
|
||||
can_see_other_account_bank_name = view.canSeeOtherAccountBankName,
|
||||
can_see_other_account_iban = view.canSeeOtherAccountIBAN,
|
||||
can_see_other_account_kind = view.canSeeOtherAccountKind,
|
||||
can_see_other_account_metadata = view.canSeeOtherAccountMetadata,
|
||||
can_see_other_account_national_identifier = view.canSeeOtherAccountNationalIdentifier,
|
||||
can_see_other_account_number = view.canSeeOtherAccountNumber,
|
||||
can_see_other_account_swift_bic = view.canSeeOtherAccountSWIFT_BIC,
|
||||
can_see_owner_comment = view.canSeeOwnerComment,
|
||||
can_see_physical_location = view.canSeePhysicalLocation,
|
||||
can_see_private_alias = view.canSeePrivateAlias,
|
||||
can_see_public_alias = view.canSeePublicAlias,
|
||||
can_see_tags = view.canSeeTags,
|
||||
can_see_transaction_amount = view.canSeeTransactionAmount,
|
||||
can_see_transaction_balance = view.canSeeTransactionBalance,
|
||||
can_see_transaction_currency = view.canSeeTransactionCurrency,
|
||||
can_see_transaction_description = view.canSeeTransactionDescription,
|
||||
can_see_transaction_finish_date = view.canSeeTransactionFinishDate,
|
||||
can_see_transaction_metadata = view.canSeeTransactionMetadata,
|
||||
can_see_transaction_other_bank_account = view.canSeeTransactionOtherBankAccount,
|
||||
can_see_transaction_start_date = view.canSeeTransactionStartDate,
|
||||
can_see_transaction_this_bank_account = view.canSeeTransactionThisBankAccount,
|
||||
can_see_transaction_type = view.canSeeTransactionType,
|
||||
can_see_url = view.canSeeUrl,
|
||||
can_see_where_tag = view.canSeeWhereTag,
|
||||
can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT),
|
||||
can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION),
|
||||
can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE),
|
||||
can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL),
|
||||
can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO),
|
||||
can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL),
|
||||
can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION),
|
||||
can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS),
|
||||
can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS),
|
||||
can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG),
|
||||
can_add_url = allowed_actions.exists(_ == CAN_ADD_URL),
|
||||
can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG),
|
||||
can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT),
|
||||
can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY),
|
||||
can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION),
|
||||
can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE),
|
||||
can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION),
|
||||
can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG),
|
||||
can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG),
|
||||
can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT),
|
||||
can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE),
|
||||
can_query_available_funds = allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS),
|
||||
can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME),
|
||||
can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY),
|
||||
can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN),
|
||||
can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL),
|
||||
can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER),
|
||||
can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS),
|
||||
can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC),
|
||||
can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE),
|
||||
can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS),
|
||||
can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION),
|
||||
can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL),
|
||||
can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES),
|
||||
can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO),
|
||||
can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL),
|
||||
can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME),
|
||||
can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN),
|
||||
can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND),
|
||||
can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA),
|
||||
can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER),
|
||||
can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC),
|
||||
can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT),
|
||||
can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION),
|
||||
can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS),
|
||||
can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS),
|
||||
can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS),
|
||||
can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT),
|
||||
can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE),
|
||||
can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY),
|
||||
can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION),
|
||||
can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE),
|
||||
can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA),
|
||||
can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT),
|
||||
can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE),
|
||||
can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT),
|
||||
can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE),
|
||||
can_see_url = allowed_actions.exists(_ == CAN_SEE_URL),
|
||||
can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG),
|
||||
//V300 new
|
||||
can_see_bank_routing_scheme = view.canSeeBankRoutingScheme,
|
||||
can_see_bank_routing_address = view.canSeeBankRoutingAddress,
|
||||
can_see_bank_account_routing_scheme = view.canSeeBankAccountRoutingScheme,
|
||||
can_see_bank_account_routing_address = view.canSeeBankAccountRoutingAddress,
|
||||
can_see_other_bank_routing_scheme = view.canSeeOtherBankRoutingScheme,
|
||||
can_see_other_bank_routing_address = view.canSeeOtherBankRoutingAddress,
|
||||
can_see_other_account_routing_scheme = view.canSeeOtherAccountRoutingScheme,
|
||||
can_see_other_account_routing_address= view.canSeeOtherAccountRoutingAddress,
|
||||
can_add_transaction_request_to_own_account = view.canAddTransactionRequestToOwnAccount, //added following two for payments
|
||||
can_add_transaction_request_to_any_account = view.canAddTransactionRequestToAnyAccount,
|
||||
can_see_bank_account_credit_limit = view.canSeeBankAccountCreditLimit,
|
||||
can_create_direct_debit = view.canCreateDirectDebit,
|
||||
can_create_standing_order = view.canCreateStandingOrder
|
||||
can_see_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME),
|
||||
can_see_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS),
|
||||
can_see_bank_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME),
|
||||
can_see_bank_account_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS),
|
||||
can_see_other_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME),
|
||||
can_see_other_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS),
|
||||
can_see_other_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME),
|
||||
can_see_other_account_routing_address= allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS),
|
||||
can_add_transaction_request_to_own_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments
|
||||
can_add_transaction_request_to_any_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT),
|
||||
can_see_bank_account_credit_limit = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT),
|
||||
can_create_direct_debit = allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT),
|
||||
can_create_standing_order = allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER)
|
||||
)
|
||||
}
|
||||
def createBasicViewJSON(view : View) : BasicViewJson = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
package code.api.v3_1_0
|
||||
|
||||
import code.api.Constant
|
||||
import code.api.Constant.localIdentityProvider
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.ResourceDocs1_4_0.{MessageDocsSwaggerDefinitions, ResourceDocsAPIMethodsUtil, SwaggerDefinitionsJSON, SwaggerJSONFactory}
|
||||
import code.api.cache.Caching
|
||||
@ -13,7 +13,7 @@ import code.api.util.ExampleValue._
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.BalanceNewStyle
|
||||
import code.api.util.newstyle.{BalanceNewStyle, ViewNewStyle}
|
||||
import code.api.v1_2_1.{JSONFactory, RateLimiting}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0
|
||||
import code.api.v2_0_0.CreateMeetingJson
|
||||
@ -37,7 +37,6 @@ import code.users.Users
|
||||
import code.util.Helper
|
||||
import code.util.Helper.ObpS
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import code.webhook.AccountWebhook
|
||||
import code.webuiprops.{MappedWebUiPropsProvider, WebUiPropsCommons}
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
@ -53,7 +52,7 @@ import net.liftweb.json
|
||||
import net.liftweb.json._
|
||||
import net.liftweb.mapper.By
|
||||
import net.liftweb.util.Helpers.tryo
|
||||
import net.liftweb.util.{Helpers, Props, StringHelpers}
|
||||
import net.liftweb.util.{Helpers, Props}
|
||||
import org.apache.commons.lang3.{StringUtils, Validate}
|
||||
|
||||
import java.text.SimpleDateFormat
|
||||
@ -137,7 +136,7 @@ trait APIMethods310 {
|
||||
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
|
||||
(checkbookOrders, callContext)<- Connector.connector.vend.getCheckbookOrders(bankId.value,accountId.value, callContext) map {
|
||||
unboxFullOrFail(_, callContext, InvalidConnectorResponseForGetCheckbookOrdersFuture)
|
||||
@ -178,7 +177,7 @@ trait APIMethods310 {
|
||||
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
|
||||
//TODO need error handling here
|
||||
(checkbookOrders,callContext) <- Connector.connector.vend.getStatusOfCreditCardOrder(bankId.value,accountId.value, callContext) map {
|
||||
@ -653,9 +652,9 @@ trait APIMethods310 {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$ViewDoesNotPermitAccess + You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canQueryAvailableFunds_)).dropRight(1)}` permission on any your views", cc=callContext) {
|
||||
view.canQueryAvailableFunds
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$ViewDoesNotPermitAccess + You need the `${(CAN_QUERY_AVAILABLE_FUNDS)}` permission on any your views", cc=callContext) {
|
||||
view.allowed_actions.exists(_ ==CAN_QUERY_AVAILABLE_FUNDS)
|
||||
}
|
||||
httpParams: List[HTTPParam] <- NewStyle.function.extractHttpParamsFromUrl(cc.url)
|
||||
_ <- Helper.booleanToFuture(failMsg = MissingQueryParams + amount, cc=callContext) {
|
||||
@ -672,7 +671,7 @@ trait APIMethods310 {
|
||||
_ <- NewStyle.function.moderatedBankAccountCore(account, view, Full(u), callContext)
|
||||
} yield {
|
||||
val ccy = httpParams.filter(_.name == currency).map(_.values.head).head
|
||||
val fundsAvailable = (view.canQueryAvailableFunds, account.balance, account.currency) match {
|
||||
val fundsAvailable = ( view.allowed_actions.exists(_ ==CAN_QUERY_AVAILABLE_FUNDS), account.balance, account.currency) match {
|
||||
case (false, _, _) => "" // 1st condition: MUST have a view can_query_available_funds
|
||||
case (true, _, c) if c != ccy => "no" // 2nd condition: Currency has to be matched
|
||||
case (true, b, _) if b.compare(available) >= 0 => "yes" // We have the vew, the right currency and enough funds
|
||||
@ -1058,7 +1057,7 @@ trait APIMethods310 {
|
||||
_ <- passesPsd2Pisp(callContext)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), user, callContext)
|
||||
(moderatedTransaction, callContext) <- account.moderatedTransactionFuture(transactionId, view, user, callContext) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionsException)
|
||||
}
|
||||
@ -1123,11 +1122,11 @@ trait APIMethods310 {
|
||||
_ <- NewStyle.function.isEnabledTransactionRequests(callContext)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionRequests_)).dropRight(1)}` permission on the View(${viewId.value})",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value})",
|
||||
cc=callContext){
|
||||
view.canSeeTransactionRequests
|
||||
view.allowed_actions.exists(_ ==CAN_SEE_TRANSACTION_REQUESTS)
|
||||
}
|
||||
(transactionRequests, callContext) <- Future(Connector.connector.vend.getTransactionRequests210(u, fromAccount, callContext)) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionRequestsException)
|
||||
@ -1870,7 +1869,7 @@ trait APIMethods310 {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(_, callContext) <- anonymousAccess(cc)
|
||||
connectorVersion = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
connectorVersion = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
starConnectorProps = APIUtil.getPropsValue("starConnector_supported_types").openOr("notfound")
|
||||
//TODO we need to decide what kind of connector should we use.
|
||||
obpApiLoopback = ObpApiLoopback(
|
||||
@ -3944,7 +3943,7 @@ trait APIMethods310 {
|
||||
for {
|
||||
(Full(user), callContext) <- authenticatedAccess(cc)
|
||||
_ <- NewStyle.function.hasEntitlement("", user.userId, canGetSystemView, callContext)
|
||||
view <- NewStyle.function.systemView(ViewId(viewId), callContext)
|
||||
view <- ViewNewStyle.systemView(ViewId(viewId), callContext)
|
||||
} yield {
|
||||
(JSONFactory310.createViewJSON(view), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -4004,7 +4003,7 @@ trait APIMethods310 {
|
||||
_ <- Helper.booleanToFuture(SystemViewCannotBePublicError, failCode=400, cc=callContext) {
|
||||
createViewJson.is_public == false
|
||||
}
|
||||
view <- NewStyle.function.createSystemView(createViewJson.toCreateViewJson, callContext)
|
||||
view <- ViewNewStyle.createSystemView(createViewJson.toCreateViewJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory310.createViewJSON(view), HttpCode.`201`(callContext))
|
||||
}
|
||||
@ -4038,8 +4037,8 @@ trait APIMethods310 {
|
||||
for {
|
||||
(Full(user), callContext) <- authenticatedAccess(cc)
|
||||
_ <- NewStyle.function.hasEntitlement("", user.userId, canDeleteSystemView, callContext)
|
||||
_ <- NewStyle.function.systemView(ViewId(viewId), callContext)
|
||||
view <- NewStyle.function.deleteSystemView(ViewId(viewId), callContext)
|
||||
_ <- ViewNewStyle.systemView(ViewId(viewId), callContext)
|
||||
view <- ViewNewStyle.deleteSystemView(ViewId(viewId), callContext)
|
||||
} yield {
|
||||
(Full(view), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -4086,8 +4085,8 @@ trait APIMethods310 {
|
||||
_ <- Helper.booleanToFuture(SystemViewCannotBePublicError, failCode=400, cc=callContext) {
|
||||
updateJson.is_public == false
|
||||
}
|
||||
_ <- NewStyle.function.systemView(ViewId(viewId), callContext)
|
||||
updatedView <- NewStyle.function.updateSystemView(ViewId(viewId), updateJson, callContext)
|
||||
_ <- ViewNewStyle.systemView(ViewId(viewId), callContext)
|
||||
updatedView <- ViewNewStyle.updateSystemView(ViewId(viewId), updateJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory310.createViewJSON(updatedView), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -5531,7 +5530,7 @@ trait APIMethods310 {
|
||||
for {
|
||||
(Full(u), callContext) <- authenticatedAccess(cc)
|
||||
(account, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, accountId), Some(u), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, Full(u), callContext)
|
||||
(accountAttributes, callContext) <- NewStyle.function.getAccountAttributesByAccount(
|
||||
bankId,
|
||||
|
||||
@ -1,35 +1,30 @@
|
||||
package code.api.v4_0_0
|
||||
|
||||
import java.net.URLEncoder
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util
|
||||
import java.util.{Calendar, Date}
|
||||
import code.DynamicData.{DynamicData, DynamicDataProvider}
|
||||
import code.DynamicData.DynamicData
|
||||
import code.DynamicEndpoint.DynamicEndpointSwagger
|
||||
import code.accountattribute.AccountAttributeX
|
||||
import code.api.Constant.{CREATE_LOCALISED_RESOURCE_DOC_JSON_TTL, PARAM_LOCALE, PARAM_TIMESTAMP, SYSTEM_OWNER_VIEW_ID, localIdentityProvider}
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON.{jsonDynamicResourceDoc, _}
|
||||
import code.api.UKOpenBanking.v2_0_0.OBP_UKOpenBanking_200
|
||||
import code.api.UKOpenBanking.v3_1_0.OBP_UKOpenBanking_310
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.dynamic.endpoint.helper.practise.{DynamicEndpointCodeGenerator, PractiseEndpoint}
|
||||
import code.api.dynamic.endpoint.helper.{CompiledObjects, DynamicEndpointHelper, DynamicEndpoints}
|
||||
import code.api.dynamic.endpoint.helper.{CompiledObjects, DynamicEndpointHelper}
|
||||
import code.api.dynamic.entity.helper.DynamicEntityInfo
|
||||
import code.api.util.APIUtil.{fullBoxOrException, _}
|
||||
import code.api.util.ApiRole._
|
||||
import code.api.util.ApiTag._
|
||||
import code.api.util.DynamicUtil.Validation
|
||||
import code.api.util.ErrorMessages.{BankNotFound, _}
|
||||
import code.api.util.ExampleValue._
|
||||
import code.api.util.Glossary.{getGlossaryItem, getGlossaryItemSimple}
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.Glossary.getGlossaryItem
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util.NewStyle.function.{isValidCurrencyISOCode => isValidCurrencyISOCodeNS, _}
|
||||
import code.api.util.NewStyle.function._
|
||||
import code.api.util._
|
||||
import code.api.util.migration.Migration
|
||||
import code.api.util.newstyle.AttributeDefinition._
|
||||
import code.api.util.newstyle.Consumer._
|
||||
import code.api.util.newstyle.{BalanceNewStyle, UserCustomerLinkNewStyle}
|
||||
import code.api.util.newstyle.UserCustomerLinkNewStyle.getUserCustomerLinks
|
||||
import code.api.util.newstyle.{BalanceNewStyle, UserCustomerLinkNewStyle, ViewNewStyle}
|
||||
import code.api.v1_2_1.{JSONFactory, PostTransactionTagJSON}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.TransactionRequestAccountJsonV140
|
||||
@ -38,21 +33,15 @@ import code.api.v2_0_0.{CreateEntitlementJSON, CreateUserCustomerLinkJson, Entit
|
||||
import code.api.v2_1_0._
|
||||
import code.api.v3_0_0.{CreateScopeJson, JSONFactory300}
|
||||
import code.api.v3_1_0._
|
||||
import code.api.v4_0_0.APIMethods400.{createTransactionRequest, transactionRequestGeneralText}
|
||||
import code.api.v4_0_0.JSONFactory400._
|
||||
import code.fx.{MappedFXRate, fx}
|
||||
import code.api.dynamic.endpoint.helper._
|
||||
import code.api.dynamic.endpoint.helper.practise.PractiseEndpoint
|
||||
import code.api.dynamic.entity.helper.{DynamicEntityHelper, DynamicEntityInfo}
|
||||
import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.v4_0_0.APIMethods400.{createTransactionRequest, lowAmount, sharedChargePolicy, transactionRequestGeneralText}
|
||||
import code.api.v4_0_0.TransactionRequestBodyAgentJsonV400
|
||||
import code.api.{ChargePolicy, Constant, JsonResponseException}
|
||||
import code.apicollection.MappedApiCollectionsProvider
|
||||
import code.apicollectionendpoint.MappedApiCollectionEndpointsProvider
|
||||
import code.authtypevalidation.JsonAuthTypeValidation
|
||||
import code.bankconnectors.{Connector, DynamicConnector, InternalConnector}
|
||||
import code.connectormethod.{JsonConnectorMethod, JsonConnectorMethodMethodBody}
|
||||
import code.consent.{ConsentRequests, ConsentStatus, Consents}
|
||||
import code.consent.{ConsentStatus, Consents}
|
||||
import code.dynamicEntity.{DynamicEntityCommons, ReferenceType}
|
||||
import code.dynamicMessageDoc.JsonDynamicMessageDoc
|
||||
import code.dynamicResourceDoc.JsonDynamicResourceDoc
|
||||
@ -62,13 +51,11 @@ import code.fx.fx
|
||||
import code.loginattempts.LoginAttempt
|
||||
import code.metadata.counterparties.{Counterparties, MappedCounterparty}
|
||||
import code.metadata.tags.Tags
|
||||
import code.model.dataAccess.{AuthUser, BankAccountCreation}
|
||||
import code.model._
|
||||
import code.model.dataAccess.{AuthUser, BankAccountCreation}
|
||||
import code.ratelimiting.RateLimitingDI
|
||||
import code.scope.Scope
|
||||
import code.snippet.{WebUIPlaceholder, WebUITemplate}
|
||||
import code.transactionChallenge.MappedExpectedChallengeAnswer
|
||||
import code.transactionrequests.MappedTransactionRequestProvider
|
||||
import code.usercustomerlinks.UserCustomerLink
|
||||
import code.userlocks.UserLocksProvider
|
||||
import code.users.Users
|
||||
@ -76,41 +63,39 @@ import code.util.Helper.{MdcLoggable, ObpS, SILENCE_IS_GOLDEN, booleanToFuture}
|
||||
import code.util.{Helper, JsonSchemaUtil}
|
||||
import code.validation.JsonValidation
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import code.webhook.{AccountWebhook, BankAccountNotificationWebhookTrait, SystemAccountNotificationWebhookTrait}
|
||||
import code.webhook.{BankAccountNotificationWebhookTrait, SystemAccountNotificationWebhookTrait}
|
||||
import code.webuiprops.MappedWebUiPropsProvider.getWebUiPropsValue
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.networknt.schema.ValidationMessage
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.dto.GetProductsParam
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.model.enums.ChallengeType.OBP_TRANSACTION_REQUEST_CHALLENGE
|
||||
import com.openbankproject.commons.model.enums.DynamicEntityOperation._
|
||||
import com.openbankproject.commons.model.enums.{TransactionRequestStatus, _}
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.model.enums.TransactionRequestTypes._
|
||||
import com.openbankproject.commons.model.enums.PaymentServiceTypes._
|
||||
import com.openbankproject.commons.util.{ApiVersion, JsonUtils, ScannedApiVersion}
|
||||
import com.openbankproject.commons.model.enums.{TransactionRequestStatus, _}
|
||||
import com.openbankproject.commons.util.{ApiVersion, ScannedApiVersion}
|
||||
import deletion._
|
||||
import net.liftweb.common._
|
||||
import net.liftweb.http.rest.RestHelper
|
||||
import net.liftweb.http.{JsonResponse, Req, S}
|
||||
import net.liftweb.json.JsonAST.JValue
|
||||
import net.liftweb.json.JsonDSL._
|
||||
import net.liftweb.json.Serialization.write
|
||||
import net.liftweb.json._
|
||||
import net.liftweb.mapper.By
|
||||
import net.liftweb.util.Helpers.{now, tryo}
|
||||
import net.liftweb.util.Mailer.{From, PlainMailBodyType, Subject, To, XHTMLMailBodyType}
|
||||
import net.liftweb.util.{Helpers, Mailer, StringHelpers}
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
|
||||
import java.time.{LocalDate, ZoneId, ZonedDateTime}
|
||||
import java.util.Date
|
||||
import java.net.URLEncoder
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.{LocalDate, ZoneId}
|
||||
import java.util
|
||||
import java.util.{Calendar, Date}
|
||||
import scala.collection.immutable.{List, Nil}
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import scala.concurrent.Future
|
||||
import scala.jdk.CollectionConverters.collectionAsScalaIterableConverter
|
||||
import scala.math.BigDecimal
|
||||
import scala.xml.XML
|
||||
|
||||
trait APIMethods400 extends MdcLoggable {
|
||||
@ -427,7 +412,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(doubleEntryTransaction, callContext) <- NewStyle.function.getBalancingTransaction(transactionId, cc.callContext)
|
||||
_ <- NewStyle.function.checkBalancingTransactionAccountAccessAndReturnView(doubleEntryTransaction, cc.user, cc.callContext)
|
||||
_ <- ViewNewStyle.checkBalancingTransactionAccountAccessAndReturnView(doubleEntryTransaction, cc.user, cc.callContext)
|
||||
} yield {
|
||||
(JSONFactory400.createDoubleEntryTransactionJson(doubleEntryTransaction), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -501,7 +486,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
}
|
||||
_ <- Helper.booleanToFuture(InitialBalanceMustBeZero, cc=callContext){0 == initialBalanceAsNumber}
|
||||
currency = createAccountJson.balance.currency
|
||||
_ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc=callContext){isValidCurrencyISOCode(currency)}
|
||||
_ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc=callContext){APIUtil.isValidCurrencyISOCode(currency)}
|
||||
|
||||
(_, callContext ) <- NewStyle.function.getBank(bankId, callContext)
|
||||
_ <- Helper.booleanToFuture(s"$InvalidAccountRoutings Duplication detected in account routings, please specify only one value per routing scheme", cc=callContext) {
|
||||
@ -1029,7 +1014,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
"POST",
|
||||
"/banks/BANK_ID/accounts/ACCOUNT_ID/VIEW_ID/transaction-request-types/TRANSACTION_REQUEST_TYPE/transaction-requests/TRANSACTION_REQUEST_ID/challenge",
|
||||
"Answer Transaction Request Challenge",
|
||||
"""In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.
|
||||
s"""In Sandbox mode, any string that can be converted to a positive integer will be accepted as an answer.
|
||||
|
|
||||
|This endpoint totally depends on createTransactionRequest, it need get the following data from createTransactionRequest response body.
|
||||
|
|
||||
@ -1066,7 +1051,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
|
|
||||
|Rule for calculating number of security challenges:
|
||||
|If Product Account attribute REQUIRED_CHALLENGE_ANSWERS=N then create N challenges
|
||||
|(one for every user that has a View where permission "can_add_transaction_request_to_any_account"=true)
|
||||
|(one for every user that has a View where permission $CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT=true)
|
||||
|In the case REQUIRED_CHALLENGE_ANSWERS is not defined as an account attribute, the default number of security challenges created is one.
|
||||
|
|
||||
""".stripMargin,
|
||||
@ -2150,7 +2135,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
BigDecimal(initialBalanceAsString)
|
||||
}
|
||||
_ <- Helper.booleanToFuture(InitialBalanceMustBeZero, cc=callContext){0 == initialBalanceAsNumber}
|
||||
_ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc=callContext){isValidCurrencyISOCode(createAccountJson.balance.currency)}
|
||||
_ <- Helper.booleanToFuture(InvalidISOCurrencyCode, cc=callContext){APIUtil.isValidCurrencyISOCode(createAccountJson.balance.currency)}
|
||||
currency = createAccountJson.balance.currency
|
||||
(_, callContext ) <- NewStyle.function.getBank(bankId, callContext)
|
||||
_ <- Helper.booleanToFuture(s"$InvalidAccountRoutings Duplication detected in account routings, please specify only one value per routing scheme", cc=callContext) {
|
||||
@ -2320,9 +2305,9 @@ trait APIMethods400 extends MdcLoggable {
|
||||
json.extract[UpdateAccountJsonV400]
|
||||
}
|
||||
anyViewContainsCanUpdateBankAccountLabelPermission = Views.views.vend.permission(BankIdAccountId(account.bankId, account.accountId), u)
|
||||
.map(_.views.map(_.canUpdateBankAccountLabel).find(_.==(true)).getOrElse(false)).getOrElse(false)
|
||||
.map(_.views.map(_.allowed_actions.exists(_ == CAN_UPDATE_BANK_ACCOUNT_LABEL))).getOrElse(Nil).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canUpdateBankAccountLabel_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_UPDATE_BANK_ACCOUNT_LABEL)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanUpdateBankAccountLabelPermission
|
||||
@ -2564,7 +2549,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_add_tag. Current ViewId($viewId)", cc=callContext) {
|
||||
view.canAddTag
|
||||
view.allowed_actions.exists( _ == CAN_ADD_TAG)
|
||||
}
|
||||
tagJson <- NewStyle.function.tryons(s"$InvalidJsonFormat The Json body should be the $PostTransactionTagJSON ", 400, callContext) {
|
||||
json.extract[PostTransactionTagJSON]
|
||||
@ -2608,7 +2593,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_delete_tag. Current ViewId($viewId)", cc=callContext) {
|
||||
view.canDeleteTag
|
||||
view.allowed_actions.exists(_ ==CAN_DELETE_TAG)
|
||||
}
|
||||
deleted <- Future(Tags.tags.vend.deleteTagOnAccount(bankId, accountId)(tagId)) map {
|
||||
i => (connectorEmptyResponse(i, callContext), callContext)
|
||||
@ -2650,7 +2635,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_see_tags. Current ViewId($viewId)", cc=callContext) {
|
||||
view.canSeeTags
|
||||
view.allowed_actions.exists(_ ==CAN_SEE_TAGS)
|
||||
}
|
||||
tags <- Future(Tags.tags.vend.getTagsOnAccount(bankId, accountId)(viewId))
|
||||
} yield {
|
||||
@ -2696,7 +2681,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(user @Full(u), account, callContext) <- SS.userAccount
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, user, callContext)
|
||||
} yield {
|
||||
val availableViews: List[View] = Views.views.vend.privateViewsUserCanAccessForAccount(u, BankIdAccountId(account.bankId, account.accountId))
|
||||
@ -2797,7 +2782,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
postJson.account_routing.scheme, postJson.account_routing.address, cc.callContext)
|
||||
|
||||
user @Full(u) = cc.user
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, user, callContext)
|
||||
|
||||
(accountAttributes, callContext) <- NewStyle.function.getAccountAttributesByAccount(
|
||||
@ -2876,7 +2861,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
|
||||
accountsJson <- Future.sequence(filteredAccountRoutings.map(accountRouting => for {
|
||||
(account, callContext) <- NewStyle.function.getBankAccount(accountRouting.bankId, accountRouting.accountId, callContext)
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(u, BankIdAccountId(account.bankId, account.accountId), callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, user, callContext)
|
||||
(accountAttributes, callContext) <- NewStyle.function.getAccountAttributesByAccount(
|
||||
account.bankId,
|
||||
@ -2999,7 +2984,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
allowAccountFirehose
|
||||
}
|
||||
// here must be a system view, not accountIds in the URL
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, AccountId("")), Some(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, BankIdAccountId(bankId, AccountId("")), Some(u), callContext)
|
||||
availableBankIdAccountIdList <- Future {
|
||||
Views.views.vend.getAllFirehoseAccounts(bank.bankId).map(a => BankIdAccountId(a.bankId,a.accountId))
|
||||
}
|
||||
@ -3688,7 +3673,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_create_direct_debit. Current ViewId($viewId)", cc=callContext) {
|
||||
view.canCreateDirectDebit
|
||||
view.allowed_actions.exists(_ ==CAN_CREATE_DIRECT_DEBIT)
|
||||
}
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $PostDirectDebitJsonV400 "
|
||||
postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
@ -3807,7 +3792,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"$NoViewPermission can_create_standing_order. Current ViewId($viewId)", cc=callContext) {
|
||||
view.canCreateStandingOrder
|
||||
view.allowed_actions.exists(_ ==CAN_CREATE_STANDING_ORDER)
|
||||
}
|
||||
failMsg = s"$InvalidJsonFormat The Json body should be the $PostStandingOrderJsonV400 "
|
||||
postJson <- NewStyle.function.tryons(failMsg, 400, callContext) {
|
||||
@ -3817,7 +3802,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
BigDecimal(postJson.amount.amount)
|
||||
}
|
||||
_ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${postJson.amount.currency}'", cc=callContext) {
|
||||
code.api.util.APIUtil.isValidCurrencyISOCode(postJson.amount.currency)
|
||||
APIUtil.isValidCurrencyISOCode(postJson.amount.currency)
|
||||
}
|
||||
(_, callContext) <- NewStyle.function.getCustomerByCustomerId(postJson.customer_id, callContext)
|
||||
_ <- Users.users.vend.getUserByUserIdFuture(postJson.user_id) map {
|
||||
@ -3888,7 +3873,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
BigDecimal(postJson.amount.amount)
|
||||
}
|
||||
_ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${postJson.amount.currency}'", cc=cc.callContext) {
|
||||
isValidCurrencyISOCode(postJson.amount.currency)
|
||||
APIUtil.isValidCurrencyISOCode(postJson.amount.currency)
|
||||
}
|
||||
(_, callContext) <- NewStyle.function.getCustomerByCustomerId(postJson.customer_id, cc.callContext)
|
||||
_ <- Users.users.vend.getUserByUserIdFuture(postJson.user_id) map {
|
||||
@ -4074,12 +4059,12 @@ trait APIMethods400 extends MdcLoggable {
|
||||
}
|
||||
(user, callContext) <- NewStyle.function.findByUserId(postJson.user_id, cc.callContext)
|
||||
view <- postJson.view.is_system match {
|
||||
case true => NewStyle.function.systemView(viewId, callContext)
|
||||
case false => NewStyle.function.customView(viewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
case true => ViewNewStyle.systemView(viewId, callContext)
|
||||
case false => ViewNewStyle.customView(viewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
}
|
||||
revoked <- postJson.view.is_system match {
|
||||
case true => NewStyle.function.revokeAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => NewStyle.function.revokeAccessToCustomView(view, user, callContext)
|
||||
case true => ViewNewStyle.revokeAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => ViewNewStyle.revokeAccessToCustomView(view, user, callContext)
|
||||
}
|
||||
} yield {
|
||||
(RevokedJsonV400(revoked), HttpCode.`201`(callContext))
|
||||
@ -4655,7 +4640,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
}
|
||||
// Prevent default value for transaction request type (at least).
|
||||
_ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
|
||||
isValidCurrencyISOCode(transDetailsJson.value.currency)
|
||||
APIUtil.isValidCurrencyISOCode(transDetailsJson.value.currency)
|
||||
}
|
||||
amountOfMoneyJson = AmountOfMoneyJsonV121(transDetailsJson.value.currency, transDetailsJson.value.amount)
|
||||
chargePolicy = transDetailsJson.charge_policy
|
||||
@ -4736,11 +4721,11 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- NewStyle.function.isEnabledTransactionRequests(callContext)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionRequests_)).dropRight(1)}` permission on the View(${viewId.value})",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value})",
|
||||
cc = callContext) {
|
||||
view.canSeeTransactionRequests
|
||||
view.allowed_actions.exists(_ ==CAN_SEE_TRANSACTION_REQUESTS)
|
||||
}
|
||||
(transactionRequest, callContext) <- NewStyle.function.getTransactionRequestImpl(requestId, callContext)
|
||||
} yield {
|
||||
@ -7500,7 +7485,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
}
|
||||
|
||||
_ <- Helper.booleanToFuture(s"$NoViewPermission can_add_counterparty. Please use a view with that permission or add the permission to this view.", 403, cc=callContext) {
|
||||
view.canAddCounterparty
|
||||
view.allowed_actions.exists(_ ==CAN_ADD_COUNTERPARTY)
|
||||
}
|
||||
|
||||
(counterparty, callContext) <- Connector.connector.vend.checkCounterpartyExists(postJson.name, bankId.value, accountId.value, viewId.value, callContext)
|
||||
@ -7513,7 +7498,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
postJson.description.length <= 36
|
||||
}
|
||||
_ <- Helper.booleanToFuture(s"$InvalidISOCurrencyCode Current input is: '${postJson.currency}'", cc=callContext) {
|
||||
isValidCurrencyISOCode(postJson.currency)
|
||||
APIUtil.isValidCurrencyISOCode(postJson.currency)
|
||||
}
|
||||
|
||||
//If other_account_routing_scheme=="OBP" or other_account_secondary_routing_address=="OBP" we will check if it is a real obp bank account.
|
||||
@ -7617,7 +7602,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
_ <- Helper.booleanToFuture(InvalidBankIdFormat, cc=callContext) {isValidID(bankId.value)}
|
||||
|
||||
_ <- Helper.booleanToFuture(s"$NoViewPermission can_delete_counterparty. Please use a view with that permission or add the permission to this view.",403, cc=callContext) {
|
||||
view.canDeleteCounterparty
|
||||
view.allowed_actions.exists(_ ==CAN_DELETE_COUNTERPARTY)
|
||||
}
|
||||
|
||||
(counterparty, callContext) <- NewStyle.function.deleteCounterpartyByCounterpartyId(counterpartyId, callContext)
|
||||
@ -7729,7 +7714,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
}
|
||||
|
||||
_ <- Helper.booleanToFuture(s"$InvalidISOCurrencyCode Current input is: '${postJson.currency}'", cc=callContext) {
|
||||
isValidCurrencyISOCode(postJson.currency)
|
||||
APIUtil.isValidCurrencyISOCode(postJson.currency)
|
||||
}
|
||||
|
||||
//If other_account_routing_scheme=="OBP" or other_account_secondary_routing_address=="OBP" we will check if it is a real obp bank account.
|
||||
@ -7825,7 +7810,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}can_get_counterparty", 403, cc=callContext) {
|
||||
view.canGetCounterparty == true
|
||||
view.allowed_actions.exists(_ ==CAN_GET_COUNTERPARTY)
|
||||
}
|
||||
(counterparties, callContext) <- NewStyle.function.getCounterparties(bankId,accountId,viewId, callContext)
|
||||
//Here we need create the metadata for all the explicit counterparties. maybe show them in json response.
|
||||
@ -7926,7 +7911,7 @@ trait APIMethods400 extends MdcLoggable {
|
||||
for {
|
||||
(user @Full(u), _, account, view, callContext) <- SS.userBankAccountView
|
||||
_ <- Helper.booleanToFuture(failMsg = s"${NoViewPermission}can_get_counterparty", 403, cc=callContext) {
|
||||
view.canGetCounterparty == true
|
||||
view.allowed_actions.exists(_ ==CAN_GET_COUNTERPARTY)
|
||||
}
|
||||
(counterparty, callContext) <- NewStyle.function.getCounterpartyByCounterpartyId(counterpartyId, callContext)
|
||||
counterpartyMetadata <- NewStyle.function.getMetadata(bankId, accountId, counterpartyId.value, callContext)
|
||||
@ -12307,7 +12292,7 @@ object APIMethods400 extends RestHelper with APIMethods400 {
|
||||
}
|
||||
|
||||
_ <- Helper.booleanToFuture(s"${InvalidISOCurrencyCode} Current input is: '${transDetailsJson.value.currency}'", cc=callContext) {
|
||||
isValidCurrencyISOCode(transDetailsJson.value.currency)
|
||||
APIUtil.isValidCurrencyISOCode(transDetailsJson.value.currency)
|
||||
}
|
||||
|
||||
(createdTransactionRequest, callContext) <- transactionRequestTypeValue match {
|
||||
|
||||
@ -30,7 +30,8 @@ import code.api.Constant
|
||||
import code.api.attributedefinition.AttributeDefinition
|
||||
import code.api.util.APIUtil.{DateWithDay, DateWithSeconds, gitCommit, stringOptionOrNull, stringOrNull}
|
||||
import code.api.util.ErrorMessages.MandatoryPropertyIsNotSet
|
||||
import code.api.util.{APIUtil, CallContext, NewStyle}
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import code.api.v1_2_1.JSONFactory.{createAmountOfMoneyJSON, createOwnersJSON}
|
||||
import code.api.v1_2_1.{BankRoutingJsonV121, JSONFactory, UserJSONV121, ViewJSONV121}
|
||||
import code.api.v1_4_0.JSONFactory1_4_0.{LocationJsonV140, MetaJsonV140, TransactionRequestAccountJsonV140, transformToLocationFromV140, transformToMetaFromV140}
|
||||
@ -1108,7 +1109,7 @@ object JSONFactory400 {
|
||||
val organisationWebsiteEnergySource = APIUtil.getPropsValue("energy_source.organisation_website", "")
|
||||
val energySource = new EnergySource400(organisationEnergySource, organisationWebsiteEnergySource)
|
||||
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val resourceDocsRequiresRole = APIUtil.getPropsAsBoolValue("resource_docs_requires_role", false)
|
||||
|
||||
APIInfoJson400(
|
||||
@ -2059,15 +2060,15 @@ object JSONFactory400 {
|
||||
|
||||
def getView(bankId: BankId, accountId: AccountId, postView: PostViewJsonV400, callContext: Option[CallContext]) = {
|
||||
postView.is_system match {
|
||||
case true => NewStyle.function.systemView(ViewId(postView.view_id), callContext)
|
||||
case false => NewStyle.function.customView(ViewId(postView.view_id), BankIdAccountId(bankId, accountId), callContext)
|
||||
case true => ViewNewStyle.systemView(ViewId(postView.view_id), callContext)
|
||||
case false => ViewNewStyle.customView(ViewId(postView.view_id), BankIdAccountId(bankId, accountId), callContext)
|
||||
}
|
||||
}
|
||||
|
||||
def grantAccountAccessToUser(bankId: BankId, accountId: AccountId, user: User, view: View, callContext: Option[CallContext]) = {
|
||||
view.isSystem match {
|
||||
case true => NewStyle.function.grantAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => NewStyle.function.grantAccessToCustomView(view, user, callContext)
|
||||
case true => ViewNewStyle.grantAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => ViewNewStyle.grantAccessToCustomView(view, user, callContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import code.accountattribute.AccountAttributeX
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ApiRole._
|
||||
@ -10,6 +11,7 @@ import code.api.util.FutureUtil.EndpointContext
|
||||
import code.api.util.NewStyle.HttpCode
|
||||
import code.api.util.NewStyle.function.extractQueryParams
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.v2_1_0.JSONFactory210
|
||||
import code.api.v3_0_0.JSONFactory300
|
||||
import code.api.v3_1_0._
|
||||
@ -27,7 +29,6 @@ import code.model.dataAccess.BankAccountCreation
|
||||
import code.util.Helper
|
||||
import code.util.Helper.{SILENCE_IS_GOLDEN, booleanToFuture}
|
||||
import code.views.Views
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
@ -776,7 +777,7 @@ trait APIMethods500 {
|
||||
val accountId = AccountId(viewsFromJwtToken.head.account_id)
|
||||
val viewId = ViewId(viewsFromJwtToken.head.view_id)
|
||||
val helperInfoFromJwtToken = viewsFromJwtToken.head.helper_info
|
||||
val viewCanGetCounterparty = Views.views.vend.customView(viewId, BankIdAccountId(bankId, accountId)).map(_.canGetCounterparty)
|
||||
val viewCanGetCounterparty = Views.views.vend.customView(viewId, BankIdAccountId(bankId, accountId)).map(_.allowed_actions.exists( _ == CAN_GET_COUNTERPARTY))
|
||||
val helperInfo = if(viewCanGetCounterparty==Full(true)) helperInfoFromJwtToken else None
|
||||
(Some(bankId), Some(accountId), Some(viewId), helperInfo)
|
||||
}else{
|
||||
@ -985,9 +986,9 @@ trait APIMethods500 {
|
||||
|
||||
val vrpViewId = s"_vrp-${UUID.randomUUID.toString}".dropRight(5)// to make sure the length of the viewId is 36.
|
||||
val targetPermissions = List(//may need getTransactionRequest . so far only these payments.
|
||||
"can_add_transaction_request_to_beneficiary",
|
||||
"can_get_counterparty",
|
||||
"can_see_transaction_requests"
|
||||
CAN_ADD_TRANSACTION_REQUEST_TO_BENEFICIARY,
|
||||
CAN_GET_COUNTERPARTY,
|
||||
CAN_SEE_TRANSACTION_REQUESTS,
|
||||
)
|
||||
|
||||
val targetCreateCustomViewJson = CreateCustomViewJson(
|
||||
@ -1014,7 +1015,7 @@ trait APIMethods500 {
|
||||
//2rd: create the Custom View for the fromAccount.
|
||||
//we do not need sourceViewId so far, we need to get all the view access for the login user, and
|
||||
permission <- NewStyle.function.permission(fromAccount.bankId, fromAccount.accountId, user, callContext)
|
||||
permissionsFromSource = permission.views.map(view =>APIUtil.getViewPermissions(view.asInstanceOf[ViewDefinition]).toList).flatten.toSet
|
||||
permissionsFromSource = permission.views.map(_.allowed_actions).flatten.toSet
|
||||
permissionsFromTarget = targetCreateCustomViewJson.allowed_permissions
|
||||
|
||||
//eg: permissionsFromTarget=List(1,2), permissionsFromSource = List(1,3,4) => userMissingPermissions = List(2)
|
||||
@ -1025,9 +1026,9 @@ trait APIMethods500 {
|
||||
_ <- Helper.booleanToFuture(failMsg, cc = callContext) {
|
||||
userMissingPermissions.isEmpty
|
||||
}
|
||||
(vrpView, callContext) <- NewStyle.function.createCustomView(fromBankIdAccountId, targetCreateCustomViewJson.toCreateViewJson, callContext)
|
||||
(vrpView, callContext) <- ViewNewStyle.createCustomView(fromBankIdAccountId, targetCreateCustomViewJson.toCreateViewJson, callContext)
|
||||
|
||||
_ <-NewStyle.function.grantAccessToCustomView(vrpView, user, callContext)
|
||||
_ <-ViewNewStyle.grantAccessToCustomView(vrpView, user, callContext)
|
||||
|
||||
//3rd: Create a new counterparty on that view (_VRP-9d429899-24f5-42c8-8565-943ffa6a7945)
|
||||
postJson = PostCounterpartyJson400(
|
||||
@ -1884,9 +1885,9 @@ trait APIMethods500 {
|
||||
for {
|
||||
(Full(u), callContext) <- SS.user
|
||||
permission <- NewStyle.function.permission(bankId, accountId, u, callContext)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.canSeeAvailableViewsForBankAccount).find(_.==(true)).getOrElse(false)
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission = permission.views.map(_.allowed_actions.exists(_ == CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)).find(_.==(true)).getOrElse(false)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeAvailableViewsForBankAccount_)).dropRight(1)}` permission on any your views",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_AVAILABLE_VIEWS_FOR_BANK_ACCOUNT)}` permission on any your views",
|
||||
cc = callContext
|
||||
) {
|
||||
anyViewContainsCanSeeAvailableViewsForBankAccountPermission
|
||||
@ -1926,8 +1927,8 @@ trait APIMethods500 {
|
||||
case "system-views" :: viewId :: Nil JsonDelete req => {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
_ <- NewStyle.function.systemView(ViewId(viewId), cc.callContext)
|
||||
view <- NewStyle.function.deleteSystemView(ViewId(viewId), cc.callContext)
|
||||
_ <- ViewNewStyle.systemView(ViewId(viewId), cc.callContext)
|
||||
view <- ViewNewStyle.deleteSystemView(ViewId(viewId), cc.callContext)
|
||||
} yield {
|
||||
(Full(view), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
@ -2050,7 +2051,7 @@ trait APIMethods500 {
|
||||
case "system-views" :: viewId :: Nil JsonGet _ => {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
view <- NewStyle.function.systemView(ViewId(viewId), cc.callContext)
|
||||
view <- ViewNewStyle.systemView(ViewId(viewId), cc.callContext)
|
||||
} yield {
|
||||
(createViewJsonV500(view), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
@ -2084,7 +2085,7 @@ trait APIMethods500 {
|
||||
case "system-views-ids" :: Nil JsonGet _ => {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
views <- NewStyle.function.systemViews()
|
||||
views <- ViewNewStyle.systemViews()
|
||||
} yield {
|
||||
(createViewsIdsJsonV500(views), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
@ -2142,7 +2143,7 @@ trait APIMethods500 {
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidSystemViewFormat +s"Current view_name (${createViewJson.name})", cc = cc.callContext) {
|
||||
isValidSystemViewName(createViewJson.name)
|
||||
}
|
||||
view <- NewStyle.function.createSystemView(createViewJson.toCreateViewJson, cc.callContext)
|
||||
view <- ViewNewStyle.createSystemView(createViewJson.toCreateViewJson, cc.callContext)
|
||||
} yield {
|
||||
(createViewJsonV500(view), HttpCode.`201`(cc.callContext))
|
||||
}
|
||||
@ -2187,8 +2188,8 @@ trait APIMethods500 {
|
||||
_ <- Helper.booleanToFuture(SystemViewCannotBePublicError, failCode=400, cc=cc.callContext) {
|
||||
updateJson.is_public == false
|
||||
}
|
||||
_ <- NewStyle.function.systemView(ViewId(viewId), cc.callContext)
|
||||
updatedView <- NewStyle.function.updateSystemView(ViewId(viewId), updateJson.toUpdateViewJson, cc.callContext)
|
||||
_ <- ViewNewStyle.systemView(ViewId(viewId), cc.callContext)
|
||||
updatedView <- ViewNewStyle.updateSystemView(ViewId(viewId), updateJson.toUpdateViewJson, cc.callContext)
|
||||
} yield {
|
||||
(createViewJsonV500(updatedView), HttpCode.`200`(cc.callContext))
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
package code.api.v5_0_0
|
||||
|
||||
import code.api.Constant
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.{gitCommit, nullToString, stringOptionOrNull, stringOrNull}
|
||||
import code.api.util.ErrorMessages.MandatoryPropertyIsNotSet
|
||||
@ -559,7 +560,7 @@ object JSONFactory500 {
|
||||
val organisationWebsiteEnergySource = APIUtil.getPropsValue("energy_source.organisation_website", "")
|
||||
val energySource = new EnergySource400(organisationEnergySource, organisationWebsiteEnergySource)
|
||||
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val resourceDocsRequiresRole = APIUtil.getPropsAsBoolValue("resource_docs_requires_role", false)
|
||||
|
||||
APIInfoJson400(
|
||||
@ -809,6 +810,8 @@ object JSONFactory500 {
|
||||
}
|
||||
|
||||
def createViewJsonV500(view : View) : ViewJsonV500 = {
|
||||
val allowed_actions = view.allowed_actions
|
||||
|
||||
val alias =
|
||||
if(view.usePublicAliasIfOneExists)
|
||||
"public"
|
||||
@ -827,81 +830,81 @@ object JSONFactory500 {
|
||||
is_firehose = Some(view.isFirehose),
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
can_add_comment = view.canAddComment,
|
||||
can_add_corporate_location = view.canAddCorporateLocation,
|
||||
can_add_image = view.canAddImage,
|
||||
can_add_image_url = view.canAddImageURL,
|
||||
can_add_more_info = view.canAddMoreInfo,
|
||||
can_add_open_corporates_url = view.canAddOpenCorporatesUrl,
|
||||
can_add_physical_location = view.canAddPhysicalLocation,
|
||||
can_add_private_alias = view.canAddPrivateAlias,
|
||||
can_add_public_alias = view.canAddPublicAlias,
|
||||
can_add_tag = view.canAddTag,
|
||||
can_add_url = view.canAddURL,
|
||||
can_add_where_tag = view.canAddWhereTag,
|
||||
can_delete_comment = view.canDeleteComment,
|
||||
can_add_counterparty = view.canAddCounterparty,
|
||||
can_delete_corporate_location = view.canDeleteCorporateLocation,
|
||||
can_delete_image = view.canDeleteImage,
|
||||
can_delete_physical_location = view.canDeletePhysicalLocation,
|
||||
can_delete_tag = view.canDeleteTag,
|
||||
can_delete_where_tag = view.canDeleteWhereTag,
|
||||
can_edit_owner_comment = view.canEditOwnerComment,
|
||||
can_see_bank_account_balance = view.canSeeBankAccountBalance,
|
||||
can_query_available_funds = view.canQueryAvailableFunds,
|
||||
can_see_bank_account_bank_name = view.canSeeBankAccountBankName,
|
||||
can_see_bank_account_currency = view.canSeeBankAccountCurrency,
|
||||
can_see_bank_account_iban = view.canSeeBankAccountIban,
|
||||
can_see_bank_account_label = view.canSeeBankAccountLabel,
|
||||
can_see_bank_account_national_identifier = view.canSeeBankAccountNationalIdentifier,
|
||||
can_see_bank_account_number = view.canSeeBankAccountNumber,
|
||||
can_see_bank_account_owners = view.canSeeBankAccountOwners,
|
||||
can_see_bank_account_swift_bic = view.canSeeBankAccountSwift_bic,
|
||||
can_see_bank_account_type = view.canSeeBankAccountType,
|
||||
can_see_comments = view.canSeeComments,
|
||||
can_see_corporate_location = view.canSeeCorporateLocation,
|
||||
can_see_image_url = view.canSeeImageUrl,
|
||||
can_see_images = view.canSeeImages,
|
||||
can_see_more_info = view.canSeeMoreInfo,
|
||||
can_see_open_corporates_url = view.canSeeOpenCorporatesUrl,
|
||||
can_see_other_account_bank_name = view.canSeeOtherAccountBankName,
|
||||
can_see_other_account_iban = view.canSeeOtherAccountIBAN,
|
||||
can_see_other_account_kind = view.canSeeOtherAccountKind,
|
||||
can_see_other_account_metadata = view.canSeeOtherAccountMetadata,
|
||||
can_see_other_account_national_identifier = view.canSeeOtherAccountNationalIdentifier,
|
||||
can_see_other_account_number = view.canSeeOtherAccountNumber,
|
||||
can_see_other_account_swift_bic = view.canSeeOtherAccountSWIFT_BIC,
|
||||
can_see_owner_comment = view.canSeeOwnerComment,
|
||||
can_see_physical_location = view.canSeePhysicalLocation,
|
||||
can_see_private_alias = view.canSeePrivateAlias,
|
||||
can_see_public_alias = view.canSeePublicAlias,
|
||||
can_see_tags = view.canSeeTags,
|
||||
can_see_transaction_amount = view.canSeeTransactionAmount,
|
||||
can_see_transaction_balance = view.canSeeTransactionBalance,
|
||||
can_see_transaction_currency = view.canSeeTransactionCurrency,
|
||||
can_see_transaction_description = view.canSeeTransactionDescription,
|
||||
can_see_transaction_finish_date = view.canSeeTransactionFinishDate,
|
||||
can_see_transaction_metadata = view.canSeeTransactionMetadata,
|
||||
can_see_transaction_other_bank_account = view.canSeeTransactionOtherBankAccount,
|
||||
can_see_transaction_start_date = view.canSeeTransactionStartDate,
|
||||
can_see_transaction_this_bank_account = view.canSeeTransactionThisBankAccount,
|
||||
can_see_transaction_type = view.canSeeTransactionType,
|
||||
can_see_url = view.canSeeUrl,
|
||||
can_see_where_tag = view.canSeeWhereTag,
|
||||
can_add_comment = allowed_actions.exists(_ == CAN_ADD_COMMENT),
|
||||
can_add_corporate_location = allowed_actions.exists(_ == CAN_ADD_CORPORATE_LOCATION),
|
||||
can_add_image = allowed_actions.exists(_ == CAN_ADD_IMAGE),
|
||||
can_add_image_url = allowed_actions.exists(_ == CAN_ADD_IMAGE_URL),
|
||||
can_add_more_info = allowed_actions.exists(_ == CAN_ADD_MORE_INFO),
|
||||
can_add_open_corporates_url = allowed_actions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL),
|
||||
can_add_physical_location = allowed_actions.exists(_ == CAN_ADD_PHYSICAL_LOCATION),
|
||||
can_add_private_alias = allowed_actions.exists(_ == CAN_ADD_PRIVATE_ALIAS),
|
||||
can_add_public_alias = allowed_actions.exists(_ == CAN_ADD_PUBLIC_ALIAS),
|
||||
can_add_tag = allowed_actions.exists(_ == CAN_ADD_TAG),
|
||||
can_add_url = allowed_actions.exists(_ == CAN_ADD_URL),
|
||||
can_add_where_tag = allowed_actions.exists(_ == CAN_ADD_WHERE_TAG),
|
||||
can_delete_comment = allowed_actions.exists(_ == CAN_DELETE_COMMENT),
|
||||
can_add_counterparty = allowed_actions.exists(_ == CAN_ADD_COUNTERPARTY),
|
||||
can_delete_corporate_location = allowed_actions.exists(_ == CAN_DELETE_CORPORATE_LOCATION),
|
||||
can_delete_image = allowed_actions.exists(_ == CAN_DELETE_IMAGE),
|
||||
can_delete_physical_location = allowed_actions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION),
|
||||
can_delete_tag = allowed_actions.exists(_ == CAN_DELETE_TAG),
|
||||
can_delete_where_tag = allowed_actions.exists(_ == CAN_DELETE_WHERE_TAG),
|
||||
can_edit_owner_comment = allowed_actions.exists(_ == CAN_EDIT_OWNER_COMMENT),
|
||||
can_see_bank_account_balance = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE),
|
||||
can_query_available_funds = allowed_actions.exists(_ == CAN_QUERY_AVAILABLE_FUNDS),
|
||||
can_see_bank_account_bank_name = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME),
|
||||
can_see_bank_account_currency = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY),
|
||||
can_see_bank_account_iban = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN),
|
||||
can_see_bank_account_label = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL),
|
||||
can_see_bank_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_bank_account_number = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER),
|
||||
can_see_bank_account_owners = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS),
|
||||
can_see_bank_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_SWIFT_BIC),
|
||||
can_see_bank_account_type = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE),
|
||||
can_see_comments = allowed_actions.exists(_ == CAN_SEE_COMMENTS),
|
||||
can_see_corporate_location = allowed_actions.exists(_ == CAN_SEE_CORPORATE_LOCATION),
|
||||
can_see_image_url = allowed_actions.exists(_ == CAN_SEE_IMAGE_URL),
|
||||
can_see_images = allowed_actions.exists(_ == CAN_SEE_IMAGES),
|
||||
can_see_more_info = allowed_actions.exists(_ == CAN_SEE_MORE_INFO),
|
||||
can_see_open_corporates_url = allowed_actions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL),
|
||||
can_see_other_account_bank_name = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME),
|
||||
can_see_other_account_iban = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN),
|
||||
can_see_other_account_kind = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND),
|
||||
can_see_other_account_metadata = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA),
|
||||
can_see_other_account_national_identifier = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER),
|
||||
can_see_other_account_number = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER),
|
||||
can_see_other_account_swift_bic = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC),
|
||||
can_see_owner_comment = allowed_actions.exists(_ == CAN_SEE_OWNER_COMMENT),
|
||||
can_see_physical_location = allowed_actions.exists(_ == CAN_SEE_PHYSICAL_LOCATION),
|
||||
can_see_private_alias = allowed_actions.exists(_ == CAN_SEE_PRIVATE_ALIAS),
|
||||
can_see_public_alias = allowed_actions.exists(_ == CAN_SEE_PUBLIC_ALIAS),
|
||||
can_see_tags = allowed_actions.exists(_ == CAN_SEE_TAGS),
|
||||
can_see_transaction_amount = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT),
|
||||
can_see_transaction_balance = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_BALANCE),
|
||||
can_see_transaction_currency = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY),
|
||||
can_see_transaction_description = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION),
|
||||
can_see_transaction_finish_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE),
|
||||
can_see_transaction_metadata = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_METADATA),
|
||||
can_see_transaction_other_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT),
|
||||
can_see_transaction_start_date = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_START_DATE),
|
||||
can_see_transaction_this_bank_account = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT),
|
||||
can_see_transaction_type = allowed_actions.exists(_ == CAN_SEE_TRANSACTION_TYPE),
|
||||
can_see_url = allowed_actions.exists(_ == CAN_SEE_URL),
|
||||
can_see_where_tag = allowed_actions.exists(_ == CAN_SEE_WHERE_TAG),
|
||||
//V300 new
|
||||
can_see_bank_routing_scheme = view.canSeeBankRoutingScheme,
|
||||
can_see_bank_routing_address = view.canSeeBankRoutingAddress,
|
||||
can_see_bank_account_routing_scheme = view.canSeeBankAccountRoutingScheme,
|
||||
can_see_bank_account_routing_address = view.canSeeBankAccountRoutingAddress,
|
||||
can_see_other_bank_routing_scheme = view.canSeeOtherBankRoutingScheme,
|
||||
can_see_other_bank_routing_address = view.canSeeOtherBankRoutingAddress,
|
||||
can_see_other_account_routing_scheme = view.canSeeOtherAccountRoutingScheme,
|
||||
can_see_other_account_routing_address= view.canSeeOtherAccountRoutingAddress,
|
||||
can_add_transaction_request_to_own_account = view.canAddTransactionRequestToOwnAccount, //added following two for payments
|
||||
can_add_transaction_request_to_any_account = view.canAddTransactionRequestToAnyAccount,
|
||||
can_see_bank_account_credit_limit = view.canSeeBankAccountCreditLimit,
|
||||
can_create_direct_debit = view.canCreateDirectDebit,
|
||||
can_create_standing_order = view.canCreateStandingOrder,
|
||||
can_see_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME),
|
||||
can_see_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS),
|
||||
can_see_bank_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME),
|
||||
can_see_bank_account_routing_address = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS),
|
||||
can_see_other_bank_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME),
|
||||
can_see_other_bank_routing_address = allowed_actions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS),
|
||||
can_see_other_account_routing_scheme = allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME),
|
||||
can_see_other_account_routing_address= allowed_actions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS),
|
||||
can_add_transaction_request_to_own_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_OWN_ACCOUNT), //added following two for payments
|
||||
can_add_transaction_request_to_any_account = allowed_actions.exists(_ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT),
|
||||
can_see_bank_account_credit_limit = allowed_actions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT),
|
||||
can_create_direct_debit = allowed_actions.exists(_ == CAN_CREATE_DIRECT_DEBIT),
|
||||
can_create_standing_order = allowed_actions.exists(_ == CAN_CREATE_STANDING_ORDER),
|
||||
// Version 5.0.0
|
||||
can_grant_access_to_views = view.canGrantAccessToViews.getOrElse(Nil),
|
||||
can_revoke_access_to_views = view.canRevokeAccessToViews.getOrElse(Nil),
|
||||
|
||||
@ -2,6 +2,7 @@ package code.api.v5_1_0
|
||||
|
||||
|
||||
import code.api.Constant
|
||||
import code.api.Constant._
|
||||
import code.api.OAuth2Login.Keycloak
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.berlin.group.v1_3.JSONFactory_BERLIN_GROUP_1_3.{ConsentAccessAccountsJson, ConsentAccessJson}
|
||||
@ -17,7 +18,7 @@ import code.api.util.X509.{getCommonName, getEmailAddress, getOrganization}
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.Consumer.createConsumerNewStyle
|
||||
import code.api.util.newstyle.RegulatedEntityNewStyle.{createRegulatedEntityNewStyle, deleteRegulatedEntityNewStyle, getRegulatedEntitiesNewStyle, getRegulatedEntityByEntityIdNewStyle}
|
||||
import code.api.util.newstyle.{BalanceNewStyle, RegulatedEntityAttributeNewStyle}
|
||||
import code.api.util.newstyle.{BalanceNewStyle, RegulatedEntityAttributeNewStyle, ViewNewStyle}
|
||||
import code.api.v2_0_0.AccountsHelper.{accountTypeFilterText, getFilteredCoreAccounts}
|
||||
import code.api.v2_1_0.{ConsumerRedirectUrlJSON, JSONFactory210}
|
||||
import code.api.v3_0_0.JSONFactory300
|
||||
@ -43,7 +44,7 @@ import code.users.Users
|
||||
import code.util.Helper
|
||||
import code.util.Helper.ObpS
|
||||
import code.views.Views
|
||||
import code.views.system.{AccountAccess, ViewDefinition}
|
||||
import code.views.system.{AccountAccess, ViewDefinition, ViewPermission}
|
||||
import code.webuiprops.{MappedWebUiPropsProvider, WebUiPropsCommons}
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
@ -3534,8 +3535,8 @@ trait APIMethods510 {
|
||||
}
|
||||
(user, callContext) <- NewStyle.function.findByUserId(postJson.user_id, callContext)
|
||||
view <- isValidSystemViewId(targetViewId.value) match {
|
||||
case true => NewStyle.function.systemView(targetViewId, callContext)
|
||||
case false => NewStyle.function.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
case true => ViewNewStyle.systemView(targetViewId, callContext)
|
||||
case false => ViewNewStyle.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
}
|
||||
addedView <- JSONFactory400.grantAccountAccessToUser(bankId, accountId, user, view, callContext)
|
||||
|
||||
@ -3598,12 +3599,12 @@ trait APIMethods510 {
|
||||
}
|
||||
(user, callContext) <- NewStyle.function.findByUserId(postJson.user_id, cc.callContext)
|
||||
view <- isValidSystemViewId(targetViewId.value) match {
|
||||
case true => NewStyle.function.systemView(targetViewId, callContext)
|
||||
case false => NewStyle.function.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
case true => ViewNewStyle.systemView(targetViewId, callContext)
|
||||
case false => ViewNewStyle.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
}
|
||||
revoked <- isValidSystemViewId(targetViewId.value) match {
|
||||
case true => NewStyle.function.revokeAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => NewStyle.function.revokeAccessToCustomView(view, user, callContext)
|
||||
case true => ViewNewStyle.revokeAccessToSystemView(bankId, accountId, view, user, callContext)
|
||||
case false => ViewNewStyle.revokeAccessToCustomView(view, user, callContext)
|
||||
}
|
||||
} yield {
|
||||
(RevokedJsonV400(revoked), HttpCode.`201`(callContext))
|
||||
@ -3672,12 +3673,12 @@ trait APIMethods510 {
|
||||
}
|
||||
(targetUser, callContext) <- NewStyle.function.getOrCreateResourceUser(postJson.provider, postJson.username, cc.callContext)
|
||||
view <- isValidSystemViewId(targetViewId.value) match {
|
||||
case true => NewStyle.function.systemView(targetViewId, callContext)
|
||||
case false => NewStyle.function.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
case true => ViewNewStyle.systemView(targetViewId, callContext)
|
||||
case false => ViewNewStyle.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
}
|
||||
addedView <- isValidSystemViewId(targetViewId.value) match {
|
||||
case true => NewStyle.function.grantAccessToSystemView(bankId, accountId, view, targetUser, callContext)
|
||||
case false => NewStyle.function.grantAccessToCustomView(view, targetUser, callContext)
|
||||
case true => ViewNewStyle.grantAccessToSystemView(bankId, accountId, view, targetUser, callContext)
|
||||
case false => ViewNewStyle.grantAccessToCustomView(view, targetUser, callContext)
|
||||
}
|
||||
} yield {
|
||||
val viewsJson = JSONFactory300.createViewJSON(addedView)
|
||||
@ -3775,11 +3776,11 @@ trait APIMethods510 {
|
||||
_ <- NewStyle.function.isEnabledTransactionRequests(callContext)
|
||||
(_, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
(fromAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, BankIdAccountId(bankId, accountId), Full(u), callContext)
|
||||
_ <- Helper.booleanToFuture(
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionRequests_)).dropRight(1)}` permission on the View(${viewId.value})",
|
||||
s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_REQUESTS)}` permission on the View(${viewId.value})",
|
||||
cc=callContext){
|
||||
view.canSeeTransactionRequests
|
||||
view.allowed_actions.exists(_ ==CAN_SEE_TRANSACTION_REQUESTS)
|
||||
}
|
||||
(transactionRequests, callContext) <- Future(Connector.connector.vend.getTransactionRequests210(u, fromAccount, callContext)) map {
|
||||
unboxFullOrFail(_, callContext, GetTransactionRequestsException)
|
||||
@ -3929,7 +3930,7 @@ trait APIMethods510 {
|
||||
for {
|
||||
(user @Full(u), account, callContext) <- SS.userAccount
|
||||
bankIdAccountId = BankIdAccountId(account.bankId, account.accountId)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId , bankIdAccountId, user, callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId , bankIdAccountId, user, callContext)
|
||||
moderatedAccount <- NewStyle.function.moderatedBankAccountCore(account, view, user, callContext)
|
||||
} yield {
|
||||
val availableViews: List[View] = Views.views.vend.privateViewsUserCanAccessForAccount(u, BankIdAccountId(account.bankId, account.accountId))
|
||||
@ -3964,11 +3965,11 @@ trait APIMethods510 {
|
||||
for {
|
||||
(Full(u), callContext) <- SS.user
|
||||
bankIdAccountId = BankIdAccountId(bankId, accountId)
|
||||
view <- NewStyle.function.checkViewAccessAndReturnView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
view <- ViewNewStyle.checkViewAccessAndReturnView(viewId, bankIdAccountId, Full(u), callContext)
|
||||
// Note we do one explicit check here rather than use moderated account because this provides an explicit message
|
||||
failMsg = ViewDoesNotPermitAccess + s" You need the `${StringHelpers.snakify(nameOf(view.canSeeBankAccountBalance))}` permission on VIEW_ID(${viewId.value})"
|
||||
failMsg = ViewDoesNotPermitAccess + s" You need the `${(CAN_SEE_BANK_ACCOUNT_BALANCE)}` permission on VIEW_ID(${viewId.value})"
|
||||
_ <- Helper.booleanToFuture(failMsg, 403, cc = callContext) {
|
||||
view.canSeeBankAccountBalance
|
||||
view.allowed_actions.exists(_ ==CAN_SEE_BANK_ACCOUNT_BALANCE)
|
||||
}
|
||||
(accountBalances, callContext) <- BalanceNewStyle.getBankAccountBalances(bankIdAccountId, callContext)
|
||||
} yield {
|
||||
@ -4458,19 +4459,19 @@ trait APIMethods510 {
|
||||
isValidCustomViewName(createCustomViewJson.name)
|
||||
}
|
||||
|
||||
permissionsFromSource = APIUtil.getViewPermissions(view.asInstanceOf[ViewDefinition])
|
||||
permissionsFromSource = view.asInstanceOf[ViewDefinition].allowed_actions.toSet
|
||||
permissionsFromTarget = createCustomViewJson.allowed_permissions
|
||||
|
||||
_ <- Helper.booleanToFuture(failMsg = SourceViewHasLessPermission + s"Current source viewId($viewId) permissions ($permissionsFromSource), target viewName${createCustomViewJson.name} permissions ($permissionsFromTarget)", cc = callContext) {
|
||||
permissionsFromTarget.toSet.subsetOf(permissionsFromSource)
|
||||
}
|
||||
|
||||
failMsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(view.canCreateCustomView))}` permission on VIEW_ID(${viewId.value})"
|
||||
failMsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_CREATE_CUSTOM_VIEW)}` permission on VIEW_ID(${viewId.value})"
|
||||
|
||||
_ <- Helper.booleanToFuture(failMsg, cc = callContext) {
|
||||
view.canCreateCustomView
|
||||
view.allowed_actions.exists(_ ==CAN_CREATE_CUSTOM_VIEW)
|
||||
}
|
||||
(view, callContext) <- NewStyle.function.createCustomView(BankIdAccountId(bankId, accountId), createCustomViewJson.toCreateViewJson, callContext)
|
||||
(view, callContext) <- ViewNewStyle.createCustomView(BankIdAccountId(bankId, accountId), createCustomViewJson.toCreateViewJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory510.createViewJson(view), HttpCode.`201`(callContext))
|
||||
}
|
||||
@ -4515,20 +4516,20 @@ trait APIMethods510 {
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidCustomViewFormat + s"Current TARGET_VIEW_ID (${targetViewId})", cc = callContext) {
|
||||
isValidCustomViewId(targetViewId.value)
|
||||
}
|
||||
permissionsFromSource = APIUtil.getViewPermissions(view.asInstanceOf[ViewDefinition])
|
||||
permissionsFromSource = view.asInstanceOf[ViewDefinition].allowed_actions.toSet
|
||||
permissionsFromTarget = targetCreateCustomViewJson.allowed_permissions
|
||||
|
||||
_ <- Helper.booleanToFuture(failMsg = SourceViewHasLessPermission + s"Current source view permissions ($permissionsFromSource), target view permissions ($permissionsFromTarget)", cc = callContext) {
|
||||
permissionsFromTarget.toSet.subsetOf(permissionsFromSource)
|
||||
}
|
||||
|
||||
failmsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(view.canUpdateCustomView))}` permission on VIEW_ID(${viewId.value})"
|
||||
failmsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_UPDATE_CUSTOM_VIEW)}` permission on VIEW_ID(${viewId.value})"
|
||||
|
||||
_ <- Helper.booleanToFuture(failmsg, cc = callContext) {
|
||||
view.canCreateCustomView
|
||||
view.allowed_actions.exists(_ ==CAN_CREATE_CUSTOM_VIEW)
|
||||
}
|
||||
|
||||
(view, callContext) <- NewStyle.function.updateCustomView(BankIdAccountId(bankId, accountId), targetViewId, targetCreateCustomViewJson.toUpdateViewJson, callContext)
|
||||
(view, callContext) <- ViewNewStyle.updateCustomView(BankIdAccountId(bankId, accountId), targetViewId, targetCreateCustomViewJson.toUpdateViewJson, callContext)
|
||||
} yield {
|
||||
(JSONFactory510.createViewJson(view), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -4588,11 +4589,11 @@ trait APIMethods510 {
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidCustomViewFormat + s"Current TARGET_VIEW_ID (${targetViewId.value})", cc = callContext) {
|
||||
isValidCustomViewId(targetViewId.value)
|
||||
}
|
||||
failmsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(view.canGetCustomView))}`permission on any your views. Current VIEW_ID (${viewId.value})"
|
||||
failmsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_GET_CUSTOM_VIEW)}`permission on any your views. Current VIEW_ID (${viewId.value})"
|
||||
_ <- Helper.booleanToFuture(failmsg, cc = callContext) {
|
||||
view.canGetCustomView
|
||||
view.allowed_actions.exists(_ ==CAN_GET_CUSTOM_VIEW)
|
||||
}
|
||||
targetView <- NewStyle.function.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
targetView <- ViewNewStyle.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
} yield {
|
||||
(JSONFactory510.createViewJson(targetView), HttpCode.`200`(callContext))
|
||||
}
|
||||
@ -4630,12 +4631,12 @@ trait APIMethods510 {
|
||||
_ <- Helper.booleanToFuture(failMsg = InvalidCustomViewFormat + s"Current TARGET_VIEW_ID (${targetViewId.value})", cc = callContext) {
|
||||
isValidCustomViewId(targetViewId.value)
|
||||
}
|
||||
failMsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(view.canDeleteCustomView))}` permission on any your views.Current VIEW_ID (${viewId.value})"
|
||||
failMsg = s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_DELETE_CUSTOM_VIEW)}` permission on any your views.Current VIEW_ID (${viewId.value})"
|
||||
_ <- Helper.booleanToFuture(failMsg, cc = callContext) {
|
||||
view.canDeleteCustomView
|
||||
view.allowed_actions.exists(_ ==CAN_DELETE_CUSTOM_VIEW)
|
||||
}
|
||||
_ <- NewStyle.function.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
deleted <- NewStyle.function.removeCustomView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
_ <- ViewNewStyle.customView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
deleted <- ViewNewStyle.removeCustomView(targetViewId, BankIdAccountId(bankId, accountId), callContext)
|
||||
} yield {
|
||||
(Full(deleted), HttpCode.`204`(callContext))
|
||||
}
|
||||
@ -5240,6 +5241,79 @@ trait APIMethods510 {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
addSystemViewPermission,
|
||||
implementedInApiVersion,
|
||||
nameOf(addSystemViewPermission),
|
||||
"POST",
|
||||
"/system-views/VIEW_ID/permissions",
|
||||
"Add Permission to a System View",
|
||||
"""Add Permission to a System View.""",
|
||||
createViewPermissionJson,
|
||||
entitlementJSON,
|
||||
List(
|
||||
$UserNotLoggedIn,
|
||||
InvalidJsonFormat,
|
||||
IncorrectRoleName,
|
||||
EntitlementAlreadyExists,
|
||||
UnknownError
|
||||
),
|
||||
List(apiTagSystemView),
|
||||
Some(List(canCreateSystemViewPermission))
|
||||
)
|
||||
|
||||
lazy val addSystemViewPermission : OBPEndpoint = {
|
||||
case "system-views" :: ViewId(viewId) :: "permissions" :: Nil JsonPost json -> _ => {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
failMsg <- Future.successful(s"$InvalidJsonFormat The Json body should be the $CreateViewPermissionJson ")
|
||||
createViewPermissionJson <- NewStyle.function.tryons(failMsg, 400, cc.callContext) {
|
||||
json.extract[CreateViewPermissionJson]
|
||||
}
|
||||
_ <- Helper.booleanToFuture(s"$InvalidViewPermissionName The current value is ${createViewPermissionJson.permission_name}", 400, cc.callContext) {
|
||||
ALL_VIEW_PERMISSION_NAMES.exists( _ == createViewPermissionJson.permission_name)
|
||||
}
|
||||
_ <- ViewNewStyle.systemView(viewId, cc.callContext)
|
||||
_ <- Helper.booleanToFuture(s"$ViewPermissionNameExists The current value is ${createViewPermissionJson.permission_name}", 400, cc.callContext) {
|
||||
ViewPermission.findSystemViewPermission(viewId, createViewPermissionJson.permission_name).isEmpty
|
||||
}
|
||||
(viewPermission,callContext) <- ViewNewStyle.createSystemViewPermission(viewId, createViewPermissionJson.permission_name, createViewPermissionJson.extra_data, cc.callContext)
|
||||
} yield {
|
||||
(JSONFactory510.createViewPermissionJson(viewPermission), HttpCode.`201`(callContext))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
deleteSystemViewPermission,
|
||||
implementedInApiVersion,
|
||||
nameOf(deleteSystemViewPermission),
|
||||
"DELETE",
|
||||
"/system-views/VIEW_ID/permissions/PERMISSION_NAME",
|
||||
"Delete Permission to a System View",
|
||||
"""Delete Permission to a System View
|
||||
""".stripMargin,
|
||||
EmptyBody,
|
||||
EmptyBody,
|
||||
List(UserNotLoggedIn, UserHasMissingRoles, UnknownError),
|
||||
List(apiTagSystemView),
|
||||
Some(List(canDeleteSystemViewPermission))
|
||||
)
|
||||
lazy val deleteSystemViewPermission: OBPEndpoint = {
|
||||
case "system-views" :: ViewId(viewId) :: "permissions" :: permissionName :: Nil JsonDelete _ => {
|
||||
cc => implicit val ec = EndpointContext(Some(cc))
|
||||
for {
|
||||
(viewPermission, callContext) <- ViewNewStyle.findSystemViewPermission(viewId, permissionName, cc.callContext)
|
||||
_ <- Helper.booleanToFuture(s"$DeleteViewPermissionError The current value is ${createViewPermissionJson.permission_name}", 400, cc.callContext) {
|
||||
viewPermission.delete_!
|
||||
}
|
||||
} yield (true, HttpCode.`204`(cc.callContext))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ import code.consent.MappedConsent
|
||||
import code.metrics.APIMetric
|
||||
import code.model.Consumer
|
||||
import code.users.{UserAttribute, Users}
|
||||
import code.views.system.{AccountAccess, ViewDefinition}
|
||||
import code.views.system.{AccountAccess, ViewDefinition, ViewPermission}
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import net.liftweb.common.{Box, Full}
|
||||
@ -578,6 +578,11 @@ case class ConsentRequestToAccountJson(
|
||||
limit: PostCounterpartyLimitV510
|
||||
)
|
||||
|
||||
case class CreateViewPermissionJson(
|
||||
permission_name: String,
|
||||
extra_data: Option[List[String]]
|
||||
)
|
||||
|
||||
case class PostVRPConsentRequestJsonInternalV510(
|
||||
consent_type: String,
|
||||
from_account: ConsentRequestFromAccountJson,
|
||||
@ -664,6 +669,11 @@ case class BankAccountBalanceResponseJsonV510(
|
||||
case class BankAccountBalancesJsonV510(
|
||||
balances: List[BankAccountBalanceResponseJsonV510]
|
||||
)
|
||||
case class ViewPermissionJson(
|
||||
view_id: String,
|
||||
permission_name:String,
|
||||
extra_data: Option[List[String]]
|
||||
)
|
||||
|
||||
object JSONFactory510 extends CustomJsonFormats {
|
||||
|
||||
@ -722,7 +732,7 @@ object JSONFactory510 extends CustomJsonFormats {
|
||||
is_public = view.isPublic,
|
||||
alias = alias,
|
||||
hide_metadata_if_alias_used = view.hideOtherAccountMetadataIfAlias,
|
||||
allowed_permissions = APIUtil.getViewPermissions(view.asInstanceOf[ViewDefinition]).toList
|
||||
allowed_permissions = view.asInstanceOf[ViewDefinition].allowed_actions.toList
|
||||
)
|
||||
}
|
||||
def createCustomersIds(customers : List[Customer]): CustomersIdsJsonV510 =
|
||||
@ -1002,7 +1012,7 @@ object JSONFactory510 extends CustomJsonFormats {
|
||||
val organisationWebsiteEnergySource = APIUtil.getPropsValue("energy_source.organisation_website", "")
|
||||
val energySource = EnergySource400(organisationEnergySource, organisationWebsiteEnergySource)
|
||||
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val resourceDocsRequiresRole = APIUtil.getPropsAsBoolValue("resource_docs_requires_role", false)
|
||||
|
||||
APIInfoJsonV510(
|
||||
@ -1207,6 +1217,16 @@ object JSONFactory510 extends CustomJsonFormats {
|
||||
is_pending_agent = agent.isPendingAgent
|
||||
)
|
||||
}
|
||||
|
||||
def createViewPermissionJson(viewPermission: ViewPermission): ViewPermissionJson = {
|
||||
val value = viewPermission.extraData.get
|
||||
ViewPermissionJson(
|
||||
viewPermission.view_id.get,
|
||||
viewPermission.permission.get,
|
||||
if(value == null || value.isEmpty) None else Some(value.split(",").toList)
|
||||
)
|
||||
}
|
||||
|
||||
def createMinimalAgentsJson(agents: List[Agent]): MinimalAgentsJsonV510 = {
|
||||
MinimalAgentsJsonV510(
|
||||
agents
|
||||
|
||||
@ -80,7 +80,7 @@ object Connector extends SimpleInjector {
|
||||
val connector = new Inject(buildOne _) {}
|
||||
|
||||
def buildOne: Connector = {
|
||||
val connectorProps = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
val connectorProps = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
getConnectorInstance(connectorProps)
|
||||
|
||||
}
|
||||
|
||||
@ -4719,7 +4719,8 @@ object LocalMappedConnector extends Connector with MdcLoggable {
|
||||
for (
|
||||
permission <- Views.views.vend.permissions(BankIdAccountId(bankId, accountId))
|
||||
) yield {
|
||||
permission.views.exists(_.canAddTransactionRequestToAnyAccount == true) match {
|
||||
permission.views.exists(view =>view.view.allowed_actions.exists( _ == CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT))
|
||||
match {
|
||||
case true => Some(permission.user)
|
||||
case _ => None
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ import code.api.cache.Caching
|
||||
import code.api.util.APIUtil._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util._
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.branches.MappedBranch
|
||||
import code.fx.fx.TTL
|
||||
import code.management.ImporterAPI.ImporterTransaction
|
||||
@ -69,9 +70,10 @@ object LocalMappedConnectorInternal extends MdcLoggable {
|
||||
// Removed view SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_VIEW_ID
|
||||
viewId = ViewId(SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_VIEW_ID)
|
||||
fromBankIdAccountId = BankIdAccountId(fromAccount.bankId, fromAccount.accountId)
|
||||
view <- NewStyle.function.checkAccountAccessAndGetView(viewId, fromBankIdAccountId, Full(user), callContext)
|
||||
view <- ViewNewStyle.checkAccountAccessAndGetView(viewId, fromBankIdAccountId, Full(user), callContext)
|
||||
_ <- Helper.booleanToFuture(InsufficientAuthorisationToCreateTransactionRequest, cc = callContext) {
|
||||
view.canAddTransactionRequestToAnyAccount
|
||||
val allowed_actions = view.allowed_actions
|
||||
allowed_actions.exists(_ ==CAN_ADD_TRANSACTION_REQUEST_TO_ANY_ACCOUNT)
|
||||
}
|
||||
|
||||
(paymentLimit, callContext) <- Connector.connector.vend.getPaymentLimit(
|
||||
|
||||
@ -53,7 +53,6 @@ object AkkaConnectorActorConfig {
|
||||
"code.api.APIFailure" = kryo,
|
||||
"com.openbankproject.commons.model.BankAccount" = kryo,
|
||||
"com.openbankproject.commons.model.View" = kryo,
|
||||
"code.model.dataAccess.ViewImpl" = kryo,
|
||||
"com.openbankproject.commons.model.User" = kryo,
|
||||
"com.openbankproject.commons.model.ViewId" = kryo,
|
||||
"com.openbankproject.commons.model.BankIdAccountIdViewId" = kryo,
|
||||
|
||||
@ -26,6 +26,7 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
|
||||
package code.model
|
||||
import code.api.Constant._
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import code.model.Moderation.Moderated
|
||||
@ -123,7 +124,7 @@ class ModeratedTransactionMetadata(
|
||||
u <- Box(user) ?~ { UserNotLoggedIn}
|
||||
tagList <- Box(tags) ?~ { s"$NoViewPermission can_delete_tag. " }
|
||||
tag <- Box(tagList.find(tag => tag.id_ == tagId)) ?~ {"Tag with id " + tagId + "not found for this transaction"}
|
||||
deleteFunc <- if(tag.postedBy == user||view.canDeleteTag)
|
||||
deleteFunc <- if(tag.postedBy == user||view.allowed_actions.exists(_ == CAN_DELETE_TAG))
|
||||
Box(deleteTag) ?~ "Deleting tags not permitted for this view"
|
||||
else
|
||||
Failure("deleting tags not permitted for the current user")
|
||||
@ -140,7 +141,7 @@ class ModeratedTransactionMetadata(
|
||||
u <- Box(user) ?~ { UserNotLoggedIn}
|
||||
imageList <- Box(images) ?~ { s"$NoViewPermission can_delete_image." }
|
||||
image <- Box(imageList.find(image => image.id_ == imageId)) ?~ {"Image with id " + imageId + "not found for this transaction"}
|
||||
deleteFunc <- if(image.postedBy == user || view.canDeleteImage)
|
||||
deleteFunc <- if(image.postedBy == user || view.allowed_actions.exists(_ ==CAN_DELETE_IMAGE))
|
||||
Box(deleteImage) ?~ "Deleting images not permitted for this view"
|
||||
else
|
||||
Failure("Deleting images not permitted for the current user")
|
||||
@ -154,7 +155,7 @@ class ModeratedTransactionMetadata(
|
||||
u <- Box(user) ?~ { UserNotLoggedIn}
|
||||
commentList <- Box(comments) ?~ { s"$NoViewPermission can_delete_comment." }
|
||||
comment <- Box(commentList.find(comment => comment.id_ == commentId)) ?~ {"Comment with id "+commentId+" not found for this transaction"}
|
||||
deleteFunc <- if(comment.postedBy == user || view.canDeleteComment)
|
||||
deleteFunc <- if(comment.postedBy == user || view.allowed_actions.exists(_ ==CAN_DELETE_COMMENT))
|
||||
Box(deleteComment) ?~ "Deleting comments not permitted for this view"
|
||||
else
|
||||
Failure("Deleting comments not permitted for the current user")
|
||||
@ -168,7 +169,7 @@ class ModeratedTransactionMetadata(
|
||||
u <- Box(user) ?~ { UserNotLoggedIn}
|
||||
whereTagOption <- Box(whereTag) ?~ { s"$NoViewPermission can_delete_where_tag. Current ViewId($viewId)" }
|
||||
whereTag <- Box(whereTagOption) ?~ {"there is no tag to delete"}
|
||||
deleteFunc <- if(whereTag.postedBy == user || view.canDeleteWhereTag)
|
||||
deleteFunc <- if(whereTag.postedBy == user || view.allowed_actions.exists(_ ==CAN_DELETE_WHERE_TAG))
|
||||
Box(deleteWhereTag) ?~ "Deleting tag is not permitted for this view"
|
||||
else
|
||||
Failure("Deleting tags not permitted for the current user")
|
||||
|
||||
@ -28,10 +28,10 @@ TESOBE (http://www.tesobe.com/)
|
||||
|
||||
package code.model
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.ErrorMessages
|
||||
import code.metadata.counterparties.Counterparties
|
||||
import code.views.system.ViewDefinition
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import code.views.system.ViewPermission
|
||||
import com.openbankproject.commons.model._
|
||||
import com.openbankproject.commons.model.enums.AccountRoutingScheme
|
||||
import net.liftweb.common._
|
||||
@ -43,6 +43,13 @@ case class ViewExtended(val view: View) {
|
||||
|
||||
val viewLogger = Logger(classOf[ViewExtended])
|
||||
|
||||
def getViewPermissions: List[String] =
|
||||
if (view.isSystem) {
|
||||
ViewPermission.findSystemViewPermissions(view.viewId).map(_.permission.get)
|
||||
} else {
|
||||
ViewPermission.findCustomViewPermissions(view.bankId, view.accountId, view.viewId).map(_.permission.get)
|
||||
}
|
||||
|
||||
def moderateTransaction(transaction : Transaction): Box[ModeratedTransaction] = {
|
||||
moderateTransactionUsingModeratedAccount(transaction, moderateAccountLegacy(transaction.thisAccount))
|
||||
}
|
||||
@ -50,6 +57,8 @@ case class ViewExtended(val view: View) {
|
||||
// In the future we can add a method here to allow someone to show only transactions over a certain limit
|
||||
private def moderateTransactionUsingModeratedAccount(transaction: Transaction, moderatedAccount : Option[ModeratedBankAccount]): Box[ModeratedTransaction] = {
|
||||
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
lazy val moderatedTransaction = {
|
||||
//transaction data
|
||||
val transactionId = transaction.id
|
||||
@ -58,60 +67,60 @@ case class ViewExtended(val view: View) {
|
||||
|
||||
//transaction metadata
|
||||
val transactionMetadata =
|
||||
if(view.canSeeTransactionMetadata)
|
||||
if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_METADATA))
|
||||
{
|
||||
val ownerComment = if (view.canSeeOwnerComment) Some(transaction.metadata.ownerComment()) else None
|
||||
val ownerComment = if (viewPermissions.exists(_ == CAN_SEE_OWNER_COMMENT)) Some(transaction.metadata.ownerComment()) else None
|
||||
val comments =
|
||||
if (view.canSeeComments)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_COMMENTS))
|
||||
Some(transaction.metadata.comments(view.viewId))
|
||||
else None
|
||||
val addCommentFunc= if(view.canAddComment) Some(transaction.metadata.addComment) else None
|
||||
val addCommentFunc= if(viewPermissions.exists(_ == CAN_ADD_COMMENT)) Some(transaction.metadata.addComment) else None
|
||||
val deleteCommentFunc =
|
||||
if(view.canDeleteComment)
|
||||
if(viewPermissions.exists(_ == CAN_DELETE_COMMENT))
|
||||
Some(transaction.metadata.deleteComment)
|
||||
else
|
||||
None
|
||||
val addOwnerCommentFunc:Option[String=> Boolean] = if (view.canEditOwnerComment) Some(transaction.metadata.addOwnerComment) else None
|
||||
val addOwnerCommentFunc:Option[String=> Boolean] = if (viewPermissions.exists(_ == CAN_EDIT_OWNER_COMMENT)) Some(transaction.metadata.addOwnerComment) else None
|
||||
val tags =
|
||||
if(view.canSeeTags)
|
||||
if(viewPermissions.exists(_ == CAN_SEE_TAGS))
|
||||
Some(transaction.metadata.tags(view.viewId))
|
||||
else None
|
||||
val addTagFunc =
|
||||
if(view.canAddTag)
|
||||
if(viewPermissions.exists(_ == CAN_ADD_TAG))
|
||||
Some(transaction.metadata.addTag)
|
||||
else
|
||||
None
|
||||
val deleteTagFunc =
|
||||
if(view.canDeleteTag)
|
||||
if(viewPermissions.exists(_ == CAN_DELETE_TAG))
|
||||
Some(transaction.metadata.deleteTag)
|
||||
else
|
||||
None
|
||||
val images =
|
||||
if(view.canSeeImages) Some(transaction.metadata.images(view.viewId))
|
||||
if(viewPermissions.exists(_ == CAN_SEE_IMAGES)) Some(transaction.metadata.images(view.viewId))
|
||||
else None
|
||||
|
||||
val addImageFunc =
|
||||
if(view.canAddImage) Some(transaction.metadata.addImage)
|
||||
if(viewPermissions.exists(_ == CAN_ADD_IMAGE)) Some(transaction.metadata.addImage)
|
||||
else None
|
||||
|
||||
val deleteImageFunc =
|
||||
if(view.canDeleteImage) Some(transaction.metadata.deleteImage)
|
||||
if(viewPermissions.exists(_ == CAN_DELETE_IMAGE)) Some(transaction.metadata.deleteImage)
|
||||
else None
|
||||
|
||||
val whereTag =
|
||||
if(view.canSeeWhereTag)
|
||||
if(viewPermissions.exists(_ == CAN_SEE_WHERE_TAG))
|
||||
Some(transaction.metadata.whereTags(view.viewId))
|
||||
else
|
||||
None
|
||||
|
||||
val addWhereTagFunc : Option[(UserPrimaryKey, ViewId, Date, Double, Double) => Boolean] =
|
||||
if(view.canAddWhereTag)
|
||||
if(viewPermissions.exists(_ == CAN_ADD_WHERE_TAG))
|
||||
Some(transaction.metadata.addWhereTag)
|
||||
else
|
||||
Empty
|
||||
|
||||
val deleteWhereTagFunc : Option[(ViewId) => Boolean] =
|
||||
if (view.canDeleteWhereTag)
|
||||
if (viewPermissions.exists(_ == CAN_DELETE_WHERE_TAG))
|
||||
Some(transaction.metadata.deleteWhereTag)
|
||||
else
|
||||
Empty
|
||||
@ -140,35 +149,35 @@ case class ViewExtended(val view: View) {
|
||||
None
|
||||
|
||||
val transactionType =
|
||||
if (view.canSeeTransactionType) Some(transaction.transactionType)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_TYPE)) Some(transaction.transactionType)
|
||||
else None
|
||||
|
||||
val transactionAmount =
|
||||
if (view.canSeeTransactionAmount) Some(transaction.amount)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT)) Some(transaction.amount)
|
||||
else None
|
||||
|
||||
val transactionCurrency =
|
||||
if (view.canSeeTransactionCurrency) Some(transaction.currency)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY)) Some(transaction.currency)
|
||||
else None
|
||||
|
||||
val transactionDescription =
|
||||
if (view.canSeeTransactionDescription) transaction.description
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION)) transaction.description
|
||||
else None
|
||||
|
||||
val transactionStartDate =
|
||||
if (view.canSeeTransactionStartDate) Some(transaction.startDate)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_START_DATE)) Some(transaction.startDate)
|
||||
else None
|
||||
|
||||
val transactionFinishDate =
|
||||
if (view.canSeeTransactionFinishDate) transaction.finishDate
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE)) transaction.finishDate
|
||||
else None
|
||||
|
||||
val transactionBalance =
|
||||
if (view.canSeeTransactionBalance && transaction.balance != null) transaction.balance.toString()
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_BALANCE) && transaction.balance != null) transaction.balance.toString()
|
||||
else ""
|
||||
|
||||
val transactionStatus =
|
||||
if (view.canSeeTransactionStatus) transaction.status
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_STATUS)) transaction.status
|
||||
else ""
|
||||
|
||||
new ModeratedTransaction(
|
||||
@ -206,37 +215,39 @@ case class ViewExtended(val view: View) {
|
||||
|
||||
private def moderateCore(transactionCore: TransactionCore, moderatedAccount : Option[ModeratedBankAccount]): Box[ModeratedTransactionCore] = {
|
||||
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
lazy val moderatedTransaction = {
|
||||
//transaction data
|
||||
val transactionId = transactionCore.id
|
||||
val otherBankAccount = moderateCore(transactionCore.otherAccount)
|
||||
|
||||
val transactionType =
|
||||
if (view.canSeeTransactionType) Some(transactionCore.transactionType)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_TYPE)) Some(transactionCore.transactionType)
|
||||
else None
|
||||
|
||||
val transactionAmount =
|
||||
if (view.canSeeTransactionAmount) Some(transactionCore.amount)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_AMOUNT)) Some(transactionCore.amount)
|
||||
else None
|
||||
|
||||
val transactionCurrency =
|
||||
if (view.canSeeTransactionCurrency) Some(transactionCore.currency)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_CURRENCY)) Some(transactionCore.currency)
|
||||
else None
|
||||
|
||||
val transactionDescription =
|
||||
if (view.canSeeTransactionDescription) transactionCore.description
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_DESCRIPTION)) transactionCore.description
|
||||
else None
|
||||
|
||||
val transactionStartDate =
|
||||
if (view.canSeeTransactionStartDate) Some(transactionCore.startDate)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_START_DATE)) Some(transactionCore.startDate)
|
||||
else None
|
||||
|
||||
val transactionFinishDate =
|
||||
if (view.canSeeTransactionFinishDate) Some(transactionCore.finishDate)
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_FINISH_DATE)) Some(transactionCore.finishDate)
|
||||
else None
|
||||
|
||||
val transactionBalance =
|
||||
if (view.canSeeTransactionBalance && transactionCore.balance != null) transactionCore.balance.toString()
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_BALANCE) && transactionCore.balance != null) transactionCore.balance.toString()
|
||||
else ""
|
||||
|
||||
new ModeratedTransactionCore(
|
||||
@ -314,27 +325,29 @@ case class ViewExtended(val view: View) {
|
||||
* no need to call the Connector.connector.vend.getBankLegacy several times.
|
||||
*/
|
||||
def moderateAccount(bank: Bank, bankAccount: BankAccount) : Box[ModeratedBankAccount] = {
|
||||
if(view.canSeeTransactionThisBankAccount)
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT))
|
||||
{
|
||||
val owners : Set[User] = if(view.canSeeBankAccountOwners) bankAccount.userOwners else Set()
|
||||
val balance = if(view.canSeeBankAccountBalance && bankAccount.balance != null) bankAccount.balance.toString else ""
|
||||
val accountType = if(view.canSeeBankAccountType) Some(bankAccount.accountType) else None
|
||||
val currency = if(view.canSeeBankAccountCurrency) Some(bankAccount.currency) else None
|
||||
val label = if(view.canSeeBankAccountLabel) Some(bankAccount.label) else None
|
||||
val iban = if(view.canSeeBankAccountIban) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None
|
||||
val number = if(view.canSeeBankAccountNumber) Some(bankAccount.number) else None
|
||||
val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set()
|
||||
val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance != null) bankAccount.balance.toString else ""
|
||||
val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None
|
||||
val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None
|
||||
val label = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None
|
||||
val iban = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN)) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None
|
||||
val number = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None
|
||||
//From V300, use scheme and address stuff...
|
||||
val accountRoutingScheme = if(view.canSeeBankAccountRoutingScheme) bankAccount.accountRoutings.headOption.map(_.scheme) else None
|
||||
val accountRoutingAddress = if(view.canSeeBankAccountRoutingAddress) bankAccount.accountRoutings.headOption.map(_.address) else None
|
||||
val accountRoutings = if(view.canSeeBankAccountRoutingScheme && view.canSeeBankAccountRoutingAddress) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if(view.canSeeBankAccountCreditLimit) bankAccount.accountRules else Nil
|
||||
val accountRoutingScheme = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME)) bankAccount.accountRoutings.headOption.map(_.scheme) else None
|
||||
val accountRoutingAddress = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings.headOption.map(_.address) else None
|
||||
val accountRoutings = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil
|
||||
|
||||
//followings are from the bank object.
|
||||
val bankId = bank.bankId
|
||||
val bankName = if(view.canSeeBankAccountBankName) Some(bank.fullName) else None
|
||||
val nationalIdentifier = if(view.canSeeBankAccountNationalIdentifier) Some(bank.nationalIdentifier) else None
|
||||
val bankRoutingScheme = if(view.canSeeBankRoutingScheme) Some(bank.bankRoutingScheme) else None
|
||||
val bankRoutingAddress = if(view.canSeeBankRoutingAddress) Some(bank.bankRoutingAddress) else None
|
||||
val bankName = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME)) Some(bank.fullName) else None
|
||||
val nationalIdentifier = if (viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER)) Some(bank.nationalIdentifier) else None
|
||||
val bankRoutingScheme = if (viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME)) Some(bank.bankRoutingScheme) else None
|
||||
val bankRoutingAddress = if (viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS)) Some(bank.bankRoutingAddress) else None
|
||||
|
||||
Some(
|
||||
new ModeratedBankAccount(
|
||||
@ -359,30 +372,34 @@ case class ViewExtended(val view: View) {
|
||||
)
|
||||
}
|
||||
else
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionThisBankAccount_)).dropRight(1)}` permission on the view(${view.viewId.value})")
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)}` permission on the view(${view.viewId.value})")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@deprecated("This have the performance issue, call `Connector.connector.vend.getBankLegacy` four times in the backend. use @moderateAccount instead ","08-01-2020")
|
||||
def moderateAccountLegacy(bankAccount: BankAccount) : Box[ModeratedBankAccount] = {
|
||||
if(view.canSeeTransactionThisBankAccount)
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT))
|
||||
{
|
||||
val owners : Set[User] = if(view.canSeeBankAccountOwners) bankAccount.userOwners else Set()
|
||||
val balance = if(view.canSeeBankAccountBalance && bankAccount.balance !=null) bankAccount.balance.toString else ""
|
||||
val accountType = if(view.canSeeBankAccountType) Some(bankAccount.accountType) else None
|
||||
val currency = if(view.canSeeBankAccountCurrency) Some(bankAccount.currency) else None
|
||||
val label = if(view.canSeeBankAccountLabel) Some(bankAccount.label) else None
|
||||
val nationalIdentifier = if(view.canSeeBankAccountNationalIdentifier) Some(bankAccount.nationalIdentifier) else None
|
||||
val iban = if(view.canSeeBankAccountIban) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None
|
||||
val number = if(view.canSeeBankAccountNumber) Some(bankAccount.number) else None
|
||||
val bankName = if(view.canSeeBankAccountBankName) Some(bankAccount.bankName) else None
|
||||
val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set()
|
||||
val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance !=null) bankAccount.balance.toString else ""
|
||||
val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None
|
||||
val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None
|
||||
val label = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None
|
||||
val nationalIdentifier = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER)) Some(bankAccount.nationalIdentifier) else None
|
||||
val iban = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_IBAN)) bankAccount.accountRoutings.find(_.scheme == AccountRoutingScheme.IBAN.toString).map(_.address) else None
|
||||
val number = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None
|
||||
val bankName = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BANK_NAME)) Some(bankAccount.bankName) else None
|
||||
val bankId = bankAccount.bankId
|
||||
//From V300, use scheme and address stuff...
|
||||
val bankRoutingScheme = if(view.canSeeBankRoutingScheme) Some(bankAccount.bankRoutingScheme) else None
|
||||
val bankRoutingAddress = if(view.canSeeBankRoutingAddress) Some(bankAccount.bankRoutingAddress) else None
|
||||
val accountRoutingScheme = if(view.canSeeBankAccountRoutingScheme) bankAccount.accountRoutings.headOption.map(_.scheme) else None
|
||||
val accountRoutingAddress = if(view.canSeeBankAccountRoutingAddress) bankAccount.accountRoutings.headOption.map(_.address) else None
|
||||
val accountRoutings = if(view.canSeeBankAccountRoutingScheme && view.canSeeBankAccountRoutingAddress) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if(view.canSeeBankAccountCreditLimit) bankAccount.accountRules else Nil
|
||||
val bankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_SCHEME)) Some(bankAccount.bankRoutingScheme) else None
|
||||
val bankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_BANK_ROUTING_ADDRESS)) Some(bankAccount.bankRoutingAddress) else None
|
||||
val accountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME)) bankAccount.accountRoutings.headOption.map(_.scheme) else None
|
||||
val accountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings.headOption.map(_.address) else None
|
||||
val accountRoutings = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil
|
||||
|
||||
Some(
|
||||
new ModeratedBankAccount(
|
||||
@ -407,22 +424,24 @@ case class ViewExtended(val view: View) {
|
||||
)
|
||||
}
|
||||
else
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionThisBankAccount_)).dropRight(1)}` permission on the view(${view.viewId.value})")
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)}` permission on the view(${view.viewId.value})")
|
||||
}
|
||||
|
||||
def moderateAccountCore(bankAccount: BankAccount) : Box[ModeratedBankAccountCore] = {
|
||||
if(view.canSeeTransactionThisBankAccount)
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
if(viewPermissions.exists(_ == CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT))
|
||||
{
|
||||
val owners : Set[User] = if(view.canSeeBankAccountOwners) bankAccount.userOwners else Set()
|
||||
val balance = if(view.canSeeBankAccountBalance && bankAccount.balance != null) Some(bankAccount.balance.toString) else None
|
||||
val accountType = if(view.canSeeBankAccountType) Some(bankAccount.accountType) else None
|
||||
val currency = if(view.canSeeBankAccountCurrency) Some(bankAccount.currency) else None
|
||||
val label = if(view.canSeeBankAccountLabel) Some(bankAccount.label) else None
|
||||
val number = if(view.canSeeBankAccountNumber) Some(bankAccount.number) else None
|
||||
val owners : Set[User] = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_OWNERS)) bankAccount.userOwners else Set()
|
||||
val balance = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_BALANCE) && bankAccount.balance != null) Some(bankAccount.balance.toString) else None
|
||||
val accountType = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_TYPE)) Some(bankAccount.accountType) else None
|
||||
val currency = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CURRENCY)) Some(bankAccount.currency) else None
|
||||
val label = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_LABEL)) Some(bankAccount.label) else None
|
||||
val number = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_NUMBER)) Some(bankAccount.number) else None
|
||||
val bankId = bankAccount.bankId
|
||||
//From V300, use scheme and address stuff...
|
||||
val accountRoutings = if(view.canSeeBankAccountRoutingScheme && view.canSeeBankAccountRoutingAddress) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if(view.canSeeBankAccountCreditLimit) bankAccount.accountRules else Nil
|
||||
val accountRoutings = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME) && viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS)) bankAccount.accountRoutings else Nil
|
||||
val accountRules = if(viewPermissions.exists(_ == CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT)) bankAccount.accountRules else Nil
|
||||
|
||||
Some(
|
||||
ModeratedBankAccountCore(
|
||||
@ -440,12 +459,14 @@ case class ViewExtended(val view: View) {
|
||||
)
|
||||
}
|
||||
else
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionThisBankAccount_)).dropRight(1)}` permission on the view(${view.viewId.value})")
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT)}` permission on the view(${view.viewId.value})")
|
||||
}
|
||||
|
||||
// Moderate the Counterparty side of the Transaction (i.e. the Other Account involved in the transaction)
|
||||
def moderateOtherAccount(otherBankAccount : Counterparty) : Box[ModeratedOtherBankAccount] = {
|
||||
if (view.canSeeTransactionOtherBankAccount)
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT))
|
||||
{
|
||||
//other account data
|
||||
val otherAccountId = otherBankAccount.counterpartyId
|
||||
@ -479,44 +500,44 @@ case class ViewExtended(val view: View) {
|
||||
if(isAlias & view.hideOtherAccountMetadataIfAlias)
|
||||
None
|
||||
else
|
||||
if(canSeeField)
|
||||
Some(field)
|
||||
else
|
||||
None
|
||||
if(canSeeField)
|
||||
Some(field)
|
||||
else
|
||||
None
|
||||
}
|
||||
|
||||
implicit def optionStringToString(x : Option[String]) : String = x.getOrElse("")
|
||||
val otherAccountNationalIdentifier = if(view.canSeeOtherAccountNationalIdentifier) Some(otherBankAccount.nationalIdentifier) else None
|
||||
val otherAccountSWIFT_BIC = if(view.canSeeOtherAccountSWIFT_BIC) otherBankAccount.otherBankRoutingAddress else None
|
||||
val otherAccountIBAN = if(view.canSeeOtherAccountIBAN) otherBankAccount.otherAccountRoutingAddress else None
|
||||
val otherAccountBankName = if(view.canSeeOtherAccountBankName) Some(otherBankAccount.thisBankId.value) else None
|
||||
val otherAccountNumber = if(view.canSeeOtherAccountNumber) Some(otherBankAccount.thisAccountId.value) else None
|
||||
val otherAccountKind = if(view.canSeeOtherAccountKind) Some(otherBankAccount.kind) else None
|
||||
val otherBankRoutingScheme = if(view.canSeeOtherBankRoutingScheme) Some(otherBankAccount.otherBankRoutingScheme) else None
|
||||
val otherBankRoutingAddress = if(view.canSeeOtherBankRoutingAddress) otherBankAccount.otherBankRoutingAddress else None
|
||||
val otherAccountRoutingScheme = if(view.canSeeOtherAccountRoutingScheme) Some(otherBankAccount.otherAccountRoutingScheme) else None
|
||||
val otherAccountRoutingAddress = if(view.canSeeOtherAccountRoutingAddress) otherBankAccount.otherAccountRoutingAddress else None
|
||||
val otherAccountNationalIdentifier = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER)) Some(otherBankAccount.nationalIdentifier) else None
|
||||
val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC)) otherBankAccount.otherBankRoutingAddress else None
|
||||
val otherAccountIBAN = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN)) otherBankAccount.otherAccountRoutingAddress else None
|
||||
val otherAccountBankName = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME)) Some(otherBankAccount.thisBankId.value) else None
|
||||
val otherAccountNumber = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER)) Some(otherBankAccount.thisAccountId.value) else None
|
||||
val otherAccountKind = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND)) Some(otherBankAccount.kind) else None
|
||||
val otherBankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME)) Some(otherBankAccount.otherBankRoutingScheme) else None
|
||||
val otherBankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS)) otherBankAccount.otherBankRoutingAddress else None
|
||||
val otherAccountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME)) Some(otherBankAccount.otherAccountRoutingScheme) else None
|
||||
val otherAccountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS)) otherBankAccount.otherAccountRoutingAddress else None
|
||||
val otherAccountMetadata =
|
||||
if(view.canSeeOtherAccountMetadata){
|
||||
if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_METADATA)){
|
||||
//other bank account metadata
|
||||
val moreInfo = moderateField(view.canSeeMoreInfo, Counterparties.counterparties.vend.getMoreInfo(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val url = moderateField(view.canSeeUrl, Counterparties.counterparties.vend.getUrl(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val imageUrl = moderateField(view.canSeeImageUrl, Counterparties.counterparties.vend.getImageURL(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val openCorporatesUrl = moderateField (view.canSeeOpenCorporatesUrl, Counterparties.counterparties.vend.getOpenCorporatesURL(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val corporateLocation : Option[Option[GeoTag]] = moderateField(view.canSeeCorporateLocation, Counterparties.counterparties.vend.getCorporateLocation(otherBankAccount.counterpartyId).toOption)
|
||||
val physicalLocation : Option[Option[GeoTag]] = moderateField(view.canSeePhysicalLocation, Counterparties.counterparties.vend.getPhysicalLocation(otherBankAccount.counterpartyId).toOption)
|
||||
val addMoreInfo = moderateField(view.canAddMoreInfo, otherBankAccount.metadata.addMoreInfo)
|
||||
val addURL = moderateField(view.canAddURL, otherBankAccount.metadata.addURL)
|
||||
val addImageURL = moderateField(view.canAddImageURL, otherBankAccount.metadata.addImageURL)
|
||||
val addOpenCorporatesUrl = moderateField(view.canAddOpenCorporatesUrl, otherBankAccount.metadata.addOpenCorporatesURL)
|
||||
val addCorporateLocation = moderateField(view.canAddCorporateLocation, otherBankAccount.metadata.addCorporateLocation)
|
||||
val addPhysicalLocation = moderateField(view.canAddPhysicalLocation, otherBankAccount.metadata.addPhysicalLocation)
|
||||
val publicAlias = moderateField(view.canSeePublicAlias, Counterparties.counterparties.vend.getPublicAlias(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val privateAlias = moderateField(view.canSeePrivateAlias, Counterparties.counterparties.vend.getPrivateAlias(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val addPublicAlias = moderateField(view.canAddPublicAlias, otherBankAccount.metadata.addPublicAlias)
|
||||
val addPrivateAlias = moderateField(view.canAddPrivateAlias, otherBankAccount.metadata.addPrivateAlias)
|
||||
val deleteCorporateLocation = moderateField(view.canDeleteCorporateLocation, otherBankAccount.metadata.deleteCorporateLocation)
|
||||
val deletePhysicalLocation= moderateField(view.canDeletePhysicalLocation, otherBankAccount.metadata.deletePhysicalLocation)
|
||||
val moreInfo = moderateField(viewPermissions.exists(_ == CAN_SEE_MORE_INFO), Counterparties.counterparties.vend.getMoreInfo(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val url = moderateField(viewPermissions.exists(_ == CAN_SEE_URL), Counterparties.counterparties.vend.getUrl(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val imageUrl = moderateField(viewPermissions.exists(_ == CAN_SEE_IMAGE_URL), Counterparties.counterparties.vend.getImageURL(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val openCorporatesUrl = moderateField (viewPermissions.exists(_ == CAN_SEE_OPEN_CORPORATES_URL), Counterparties.counterparties.vend.getOpenCorporatesURL(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val corporateLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == CAN_SEE_CORPORATE_LOCATION), Counterparties.counterparties.vend.getCorporateLocation(otherBankAccount.counterpartyId).toOption)
|
||||
val physicalLocation : Option[Option[GeoTag]] = moderateField(viewPermissions.exists(_ == CAN_SEE_PHYSICAL_LOCATION), Counterparties.counterparties.vend.getPhysicalLocation(otherBankAccount.counterpartyId).toOption)
|
||||
val addMoreInfo = moderateField(viewPermissions.exists(_ == CAN_ADD_MORE_INFO), otherBankAccount.metadata.addMoreInfo)
|
||||
val addURL = moderateField(viewPermissions.exists(_ == CAN_ADD_URL), otherBankAccount.metadata.addURL)
|
||||
val addImageURL = moderateField(viewPermissions.exists(_ == CAN_ADD_IMAGE_URL), otherBankAccount.metadata.addImageURL)
|
||||
val addOpenCorporatesUrl = moderateField(viewPermissions.exists(_ == CAN_ADD_OPEN_CORPORATES_URL), otherBankAccount.metadata.addOpenCorporatesURL)
|
||||
val addCorporateLocation = moderateField(viewPermissions.exists(_ == CAN_ADD_CORPORATE_LOCATION), otherBankAccount.metadata.addCorporateLocation)
|
||||
val addPhysicalLocation = moderateField(viewPermissions.exists(_ == CAN_ADD_PHYSICAL_LOCATION), otherBankAccount.metadata.addPhysicalLocation)
|
||||
val publicAlias = moderateField(viewPermissions.exists(_ == CAN_SEE_PUBLIC_ALIAS), Counterparties.counterparties.vend.getPublicAlias(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val privateAlias = moderateField(viewPermissions.exists(_ == CAN_SEE_PRIVATE_ALIAS), Counterparties.counterparties.vend.getPrivateAlias(otherBankAccount.counterpartyId).getOrElse("Unknown"))
|
||||
val addPublicAlias = moderateField(viewPermissions.exists(_ == CAN_ADD_PUBLIC_ALIAS), otherBankAccount.metadata.addPublicAlias)
|
||||
val addPrivateAlias = moderateField(viewPermissions.exists(_ == CAN_ADD_PRIVATE_ALIAS), otherBankAccount.metadata.addPrivateAlias)
|
||||
val deleteCorporateLocation = moderateField(viewPermissions.exists(_ == CAN_DELETE_CORPORATE_LOCATION), otherBankAccount.metadata.deleteCorporateLocation)
|
||||
val deletePhysicalLocation= moderateField(viewPermissions.exists(_ == CAN_DELETE_PHYSICAL_LOCATION), otherBankAccount.metadata.deletePhysicalLocation)
|
||||
|
||||
Some(
|
||||
new ModeratedOtherBankAccountMetadata(
|
||||
@ -563,11 +584,13 @@ case class ViewExtended(val view: View) {
|
||||
)
|
||||
}
|
||||
else
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionOtherBankAccount_)).dropRight(1)}` permission on the view(${view.viewId.value})")
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT)}` permission on the view(${view.viewId.value})")
|
||||
}
|
||||
|
||||
def moderateCore(counterpartyCore : CounterpartyCore) : Box[ModeratedOtherBankAccountCore] = {
|
||||
if (view.canSeeTransactionOtherBankAccount)
|
||||
val viewPermissions = getViewPermissions
|
||||
|
||||
if (viewPermissions.exists(_ == CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT))
|
||||
{
|
||||
//other account data
|
||||
val otherAccountId = counterpartyCore.counterpartyId
|
||||
@ -586,15 +609,15 @@ case class ViewExtended(val view: View) {
|
||||
}
|
||||
|
||||
implicit def optionStringToString(x : Option[String]) : String = x.getOrElse("")
|
||||
val otherAccountSWIFT_BIC = if(view.canSeeOtherAccountSWIFT_BIC) counterpartyCore.otherBankRoutingAddress else None
|
||||
val otherAccountIBAN = if(view.canSeeOtherAccountIBAN) counterpartyCore.otherAccountRoutingAddress else None
|
||||
val otherAccountBankName = if(view.canSeeOtherAccountBankName) Some(counterpartyCore.thisBankId.value) else None
|
||||
val otherAccountNumber = if(view.canSeeOtherAccountNumber) Some(counterpartyCore.thisAccountId.value) else None
|
||||
val otherAccountKind = if(view.canSeeOtherAccountKind) Some(counterpartyCore.kind) else None
|
||||
val otherBankRoutingScheme = if(view.canSeeOtherBankRoutingScheme) Some(counterpartyCore.otherBankRoutingScheme) else None
|
||||
val otherBankRoutingAddress = if(view.canSeeOtherBankRoutingAddress) counterpartyCore.otherBankRoutingAddress else None
|
||||
val otherAccountRoutingScheme = if(view.canSeeOtherAccountRoutingScheme) Some(counterpartyCore.otherAccountRoutingScheme) else None
|
||||
val otherAccountRoutingAddress = if(view.canSeeOtherAccountRoutingAddress) counterpartyCore.otherAccountRoutingAddress else None
|
||||
val otherAccountSWIFT_BIC = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC)) counterpartyCore.otherBankRoutingAddress else None
|
||||
val otherAccountIBAN = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_IBAN)) counterpartyCore.otherAccountRoutingAddress else None
|
||||
val otherAccountBankName = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_BANK_NAME)) Some(counterpartyCore.thisBankId.value) else None
|
||||
val otherAccountNumber = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_NUMBER)) Some(counterpartyCore.thisAccountId.value) else None
|
||||
val otherAccountKind = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_KIND)) Some(counterpartyCore.kind) else None
|
||||
val otherBankRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_SCHEME)) Some(counterpartyCore.otherBankRoutingScheme) else None
|
||||
val otherBankRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_BANK_ROUTING_ADDRESS)) counterpartyCore.otherBankRoutingAddress else None
|
||||
val otherAccountRoutingScheme = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME)) Some(counterpartyCore.otherAccountRoutingScheme) else None
|
||||
val otherAccountRoutingAddress = if(viewPermissions.exists(_ == CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS)) counterpartyCore.otherAccountRoutingAddress else None
|
||||
Some(
|
||||
new ModeratedOtherBankAccountCore(
|
||||
id = counterpartyCore.counterpartyId,
|
||||
@ -612,6 +635,6 @@ case class ViewExtended(val view: View) {
|
||||
)
|
||||
}
|
||||
else
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${StringHelpers.snakify(nameOf(ViewDefinition.canSeeTransactionOtherBankAccount_)).dropRight(1)}` permission on the view(${view.viewId.value})")
|
||||
Failure(s"${ErrorMessages.ViewDoesNotPermitAccess} You need the `${(CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT)}` permission on the view(${view.viewId.value})")
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,7 +419,7 @@ import net.liftweb.util.Helpers._
|
||||
/**Marking the locked state to show different error message */
|
||||
val usernameLockedStateCode = Long.MaxValue
|
||||
|
||||
val connector = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val connector = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet. The missing prop is `connector` ")
|
||||
val starConnectorSupportedTypes = APIUtil.getPropsValue("starConnector_supported_types","")
|
||||
|
||||
override def dbIndexes: List[BaseIndex[AuthUser]] = UniqueIndex(username, provider) ::super.dbIndexes
|
||||
|
||||
@ -1,604 +0,0 @@
|
||||
/**
|
||||
Open Bank Project - API
|
||||
Copyright (C) 2011-2019, TESOBE GmbH.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Email: contact@tesobe.com
|
||||
TESOBE GmbH.
|
||||
Osloer Strasse 16/17
|
||||
Berlin 13359, Germany
|
||||
|
||||
This product includes software developed at
|
||||
TESOBE (http://www.tesobe.com/)
|
||||
|
||||
*/
|
||||
|
||||
package code.model.dataAccess
|
||||
|
||||
import code.util.{AccountIdString, UUIDString}
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.mapper._
|
||||
|
||||
/**
|
||||
* This code is deprecated via a migration process.
|
||||
* Please take a look at TableViewDefinition.populate for more details.
|
||||
*/
|
||||
@deprecated("Migrated to the table AccountAccess","10-05-2019")
|
||||
class ViewPrivileges extends LongKeyedMapper[ViewPrivileges] with IdPK with CreatedUpdated {
|
||||
def getSingleton = ViewPrivileges
|
||||
object user extends MappedLongForeignKey(this, ResourceUser)
|
||||
object view extends MappedLongForeignKey(this, ViewImpl)
|
||||
}
|
||||
object ViewPrivileges extends ViewPrivileges with LongKeyedMetaMapper[ViewPrivileges]
|
||||
|
||||
/**
|
||||
* This code is deprecated via a migration process.
|
||||
* Please take a look at TableAccountAccess.populate for more details.
|
||||
*/
|
||||
@deprecated("Migrated to the table ViewDefinition","10-05-2019")
|
||||
class ViewImpl extends View with LongKeyedMapper[ViewImpl] with ManyToMany with CreatedUpdated{
|
||||
def getSingleton = ViewImpl
|
||||
|
||||
def primaryKeyField = id_
|
||||
|
||||
//This field used ManyToMany
|
||||
object users_ extends MappedManyToMany(ViewPrivileges, ViewPrivileges.view, ViewPrivileges.user, ResourceUser)
|
||||
|
||||
object bankPermalink extends UUIDString(this) {
|
||||
override def defaultValue: Null = null
|
||||
}
|
||||
object accountPermalink extends AccountIdString(this) {
|
||||
override def defaultValue: Null = null
|
||||
}
|
||||
|
||||
object id_ extends MappedLongIndex(this)
|
||||
object name_ extends MappedString(this, 125)
|
||||
object description_ extends MappedString(this, 255)
|
||||
//view.permalink (UUID) is view.name without spaces. (view.name = my life) <---> (view-permalink = mylife)
|
||||
//we only constraint it when we create it : code.views.MapperViews.createView
|
||||
object permalink_ extends UUIDString(this)
|
||||
object metadataView_ extends UUIDString(this)
|
||||
|
||||
//if metadataView_ = null or empty, we need use the current view's viewId.
|
||||
def metadataView = if (metadataView_.get ==null || metadataView_.get == "") permalink_.get else metadataView_.get
|
||||
def users : List[User] = users_.toList
|
||||
|
||||
//Important! If you add a field, be sure to handle it here in this function
|
||||
def setFromViewData(viewData : ViewSpecification) = {
|
||||
|
||||
if(viewData.which_alias_to_use == "public"){
|
||||
usePublicAliasIfOneExists_(true)
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
} else if(viewData.which_alias_to_use == "private"){
|
||||
usePublicAliasIfOneExists_(false)
|
||||
usePrivateAliasIfOneExists_(true)
|
||||
} else {
|
||||
usePublicAliasIfOneExists_(false)
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
}
|
||||
|
||||
hideOtherAccountMetadataIfAlias_(viewData.hide_metadata_if_alias_used)
|
||||
description_(viewData.description)
|
||||
isPublic_(viewData.is_public)
|
||||
metadataView_(viewData.metadata_view)
|
||||
|
||||
val actions = viewData.allowed_actions
|
||||
|
||||
canSeeTransactionThisBankAccount_(actions.exists(_ =="can_see_transaction_this_bank_account"))
|
||||
canSeeTransactionOtherBankAccount_(actions.exists(_ =="can_see_transaction_other_bank_account"))
|
||||
canSeeTransactionMetadata_(actions.exists(_ == "can_see_transaction_metadata"))
|
||||
canSeeTransactionDescription_(actions.exists(a => a == "can_see_transaction_label" || a == "can_see_transaction_description"))
|
||||
canSeeTransactionAmount_(actions.exists(_ == "can_see_transaction_amount"))
|
||||
canSeeTransactionType_(actions.exists(_ == "can_see_transaction_type"))
|
||||
canSeeTransactionCurrency_(actions.exists(_ == "can_see_transaction_currency"))
|
||||
canSeeTransactionStartDate_(actions.exists(_ == "can_see_transaction_start_date"))
|
||||
canSeeTransactionFinishDate_(actions.exists(_ == "can_see_transaction_finish_date"))
|
||||
canSeeTransactionBalance_(actions.exists(_ == "can_see_transaction_balance"))
|
||||
canSeeComments_(actions.exists(_ == "can_see_comments"))
|
||||
canSeeOwnerComment_(actions.exists(_ == "can_see_narrative"))
|
||||
canSeeTags_(actions.exists(_ == "can_see_tags"))
|
||||
canSeeImages_(actions.exists(_ == "can_see_images"))
|
||||
canSeeBankAccountOwners_(actions.exists(_ == "can_see_bank_account_owners"))
|
||||
canSeeBankAccountType_(actions.exists(_ == "can_see_bank_account_type"))
|
||||
canSeeBankAccountBalance_(actions.exists(_ == "can_see_bank_account_balance"))
|
||||
canQueryAvailableFunds_(actions.exists(_ == "can_query_available_funds"))
|
||||
canSeeBankAccountCurrency_(actions.exists(_ == "can_see_bank_account_currency"))
|
||||
canSeeBankAccountLabel_(actions.exists(_ == "can_see_bank_account_label"))
|
||||
canSeeBankAccountNationalIdentifier_(actions.exists(_ == "can_see_bank_account_national_identifier"))
|
||||
canSeeBankAccountSwift_bic_(actions.exists(_ == "can_see_bank_account_swift_bic"))
|
||||
canSeeBankAccountIban_(actions.exists(_ == "can_see_bank_account_iban"))
|
||||
canSeeBankAccountNumber_(actions.exists(_ == "can_see_bank_account_number"))
|
||||
canSeeBankAccountBankName_(actions.exists(_ == "can_see_bank_account_bank_name"))
|
||||
canSeeBankAccountBankPermalink_(actions.exists(_ == "can_see_bank_account_bank_permalink"))
|
||||
canSeeBankRoutingScheme_(actions.exists(_ == "can_see_bank_routing_scheme"))
|
||||
canSeeBankRoutingAddress_(actions.exists(_ == "can_see_bank_routing_address"))
|
||||
canSeeBankAccountRoutingScheme_(actions.exists(_ == "can_see_bank_account_routing_scheme"))
|
||||
canSeeBankAccountRoutingAddress_(actions.exists(_ == "can_see_bank_account_routing_address"))
|
||||
canSeeOtherAccountNationalIdentifier_(actions.exists(_ == "can_see_other_account_national_identifier"))
|
||||
canSeeOtherAccountSWIFT_BIC_(actions.exists(_ == "can_see_other_account_swift_bic"))
|
||||
canSeeOtherAccountIBAN_(actions.exists(_ == "can_see_other_account_iban"))
|
||||
canSeeOtherAccountBankName_(actions.exists(_ == "can_see_other_account_bank_name"))
|
||||
canSeeOtherAccountNumber_(actions.exists(_ == "can_see_other_account_number"))
|
||||
canSeeOtherAccountMetadata_(actions.exists(_ == "can_see_other_account_metadata"))
|
||||
canSeeOtherAccountKind_(actions.exists(_ == "can_see_other_account_kind"))
|
||||
canSeeOtherBankRoutingScheme_(actions.exists(_ == "can_see_other_bank_routing_scheme"))
|
||||
canSeeOtherBankRoutingAddress_(actions.exists(_ == "can_see_other_bank_routing_address"))
|
||||
canSeeOtherAccountRoutingScheme_(actions.exists(_ == "can_see_other_account_routing_scheme"))
|
||||
canSeeOtherAccountRoutingAddress_(actions.exists(_ == "can_see_other_account_routing_address"))
|
||||
canSeeMoreInfo_(actions.exists(_ == "can_see_more_info"))
|
||||
canSeeUrl_(actions.exists(_ == "can_see_url"))
|
||||
canSeeImageUrl_(actions.exists(_ == "can_see_image_url"))
|
||||
canSeeOpenCorporatesUrl_(actions.exists(_ == "can_see_open_corporates_url"))
|
||||
canSeeCorporateLocation_(actions.exists(_ == "can_see_corporate_location"))
|
||||
canSeePhysicalLocation_(actions.exists(_ == "can_see_physical_location"))
|
||||
canSeePublicAlias_(actions.exists(_ == "can_see_public_alias"))
|
||||
canSeePrivateAlias_(actions.exists(_ == "can_see_private_alias"))
|
||||
canAddMoreInfo_(actions.exists(_ == "can_add_more_info"))
|
||||
canAddURL_(actions.exists(_ == "can_add_url"))
|
||||
canAddImageURL_(actions.exists(_ == "can_add_image_url"))
|
||||
canAddOpenCorporatesUrl_(actions.exists(_ == "can_add_open_corporates_url"))
|
||||
canAddCorporateLocation_(actions.exists(_ == "can_add_corporate_location"))
|
||||
canAddPhysicalLocation_(actions.exists(_ == "can_add_physical_location"))
|
||||
canAddPublicAlias_(actions.exists(_ == "can_add_public_alias"))
|
||||
canAddPrivateAlias_(actions.exists(_ == "can_add_private_alias"))
|
||||
canAddCounterparty_(actions.exists(_ == "can_add_counterparty"))
|
||||
canGetCounterparty_(actions.exists(_ == "can_get_counterparty"))
|
||||
canDeleteCounterparty_(actions.exists(_ == "can_delete_counterparty"))
|
||||
canDeleteCorporateLocation_(actions.exists(_ == "can_delete_corporate_location"))
|
||||
canDeletePhysicalLocation_(actions.exists(_ == "can_delete_physical_location"))
|
||||
canEditOwnerComment_(actions.exists(_ == "can_edit_narrative"))
|
||||
canAddComment_(actions.exists(_ == "can_add_comment"))
|
||||
canDeleteComment_(actions.exists(_ == "can_delete_comment"))
|
||||
canAddTag_(actions.exists(_ == "can_add_tag"))
|
||||
canDeleteTag_(actions.exists(_ == "can_delete_tag"))
|
||||
canAddImage_(actions.exists(_ == "can_add_image"))
|
||||
canDeleteImage_(actions.exists(_ == "can_delete_image"))
|
||||
canAddWhereTag_(actions.exists(_ == "can_add_where_tag"))
|
||||
canSeeWhereTag_(actions.exists(_ == "can_see_where_tag"))
|
||||
canDeleteWhereTag_(actions.exists(_ == "can_delete_where_tag"))
|
||||
canAddTransactionRequestToOwnAccount_(actions.exists(_ == "can_add_transaction_request_to_own_account")) //added following two for payments
|
||||
canAddTransactionRequestToAnyAccount_(actions.exists(_ == "can_add_transaction_request_to_any_account"))
|
||||
canSeeBankAccountCreditLimit_(actions.exists(_ == "can_see_bank_account_credit_limit"))
|
||||
}
|
||||
|
||||
object isSystem_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
override def dbIndexed_? = true
|
||||
}
|
||||
|
||||
object isPublic_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
override def dbIndexed_? = true
|
||||
}
|
||||
|
||||
object isFirehose_ extends MappedBoolean(this){
|
||||
override def defaultValue = true
|
||||
override def dbIndexed_? = true
|
||||
}
|
||||
|
||||
object usePrivateAliasIfOneExists_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object usePublicAliasIfOneExists_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object hideOtherAccountMetadataIfAlias_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
|
||||
object canSeeTransactionThisBankAccount_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
|
||||
object canSeeTransactionRequests_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
|
||||
object canSeeTransactionRequestTypes_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionOtherBankAccount_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionMetadata_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionDescription_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionAmount_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionType_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionCurrency_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionStartDate_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionFinishDate_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionBalance_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeComments_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOwnerComment_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTags_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeImages_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountOwners_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeAvailableViewsForBankAccount_ extends MappedBoolean(this){
|
||||
override def defaultValue = true
|
||||
}
|
||||
object canSeeBankAccountType_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountBalance_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canQueryAvailableFunds_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountCurrency_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountLabel_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canUpdateBankAccountLabel_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountNationalIdentifier_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountSwift_bic_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountIban_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountNumber_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountBankName_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountBankPermalink_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankRoutingScheme_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankRoutingAddress_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountRoutingScheme_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountRoutingAddress_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeViewsWithPermissionsForOneUser_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeViewsWithPermissionsForAllUsers_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountNationalIdentifier_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountSWIFT_BIC_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountIBAN_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountBankName_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountNumber_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountMetadata_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountKind_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherBankRoutingScheme_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherBankRoutingAddress_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountRoutingScheme_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOtherAccountRoutingAddress_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeMoreInfo_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeUrl_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeImageUrl_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeOpenCorporatesUrl_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeCorporateLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeePhysicalLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeePublicAlias_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeePrivateAlias_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddMoreInfo_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddURL_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddImageURL_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddOpenCorporatesUrl_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddCorporateLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddPhysicalLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddPublicAlias_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddPrivateAlias_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddCounterparty_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canGetCounterparty_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteCounterparty_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteCorporateLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeletePhysicalLocation_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canEditOwnerComment_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddComment_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteComment_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddTag_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteTag_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddImage_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteImage_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddWhereTag_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeWhereTag_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteWhereTag_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddTransactionRequestToOwnAccount_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddTransactionRequestToAnyAccount_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canAddTransactionRequestToBeneficiary_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeTransactionStatus_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canSeeBankAccountCreditLimit_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canCreateCustomView_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canDeleteCustomView_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canUpdateCustomView_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canGetCustomView_ extends MappedBoolean(this){
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canRevokeAccessToCustomViews_ extends MappedBoolean(this) {
|
||||
override def defaultValue = false
|
||||
}
|
||||
object canGrantAccessToCustomViews_ extends MappedBoolean(this) {
|
||||
override def defaultValue = false
|
||||
}
|
||||
|
||||
def id: Long = id_.get
|
||||
def isSystem: Boolean = isSystem_.get
|
||||
|
||||
def viewId : ViewId = ViewId(permalink_.get)
|
||||
def accountId : AccountId = AccountId(accountPermalink.get)
|
||||
def bankId : BankId = BankId(bankPermalink.get)
|
||||
|
||||
def name: String = name_.get
|
||||
def description : String = description_.get
|
||||
def isPublic : Boolean = isPublic_.get
|
||||
def isPrivate : Boolean = !isPublic_.get
|
||||
def isFirehose : Boolean = isFirehose_.get
|
||||
|
||||
//the view settings
|
||||
def usePrivateAliasIfOneExists: Boolean = usePrivateAliasIfOneExists_.get
|
||||
def usePublicAliasIfOneExists: Boolean = usePublicAliasIfOneExists_.get
|
||||
def hideOtherAccountMetadataIfAlias: Boolean = hideOtherAccountMetadataIfAlias_.get
|
||||
|
||||
//reading access
|
||||
|
||||
//transaction fields
|
||||
def canSeeTransactionThisBankAccount : Boolean = canSeeTransactionThisBankAccount_.get
|
||||
def canSeeTransactionRequests : Boolean = canSeeTransactionRequests_.get
|
||||
def canSeeTransactionRequestTypes : Boolean = canSeeTransactionRequestTypes_.get
|
||||
def canSeeTransactionOtherBankAccount : Boolean = canSeeTransactionOtherBankAccount_.get
|
||||
def canSeeTransactionMetadata : Boolean = canSeeTransactionMetadata_.get
|
||||
def canSeeTransactionDescription: Boolean = canSeeTransactionDescription_.get
|
||||
def canSeeTransactionAmount: Boolean = canSeeTransactionAmount_.get
|
||||
def canSeeTransactionType: Boolean = canSeeTransactionType_.get
|
||||
def canSeeTransactionCurrency: Boolean = canSeeTransactionCurrency_.get
|
||||
def canSeeTransactionStartDate: Boolean = canSeeTransactionStartDate_.get
|
||||
def canSeeTransactionFinishDate: Boolean = canSeeTransactionFinishDate_.get
|
||||
def canSeeTransactionBalance: Boolean = canSeeTransactionBalance_.get
|
||||
|
||||
//transaction metadata
|
||||
def canSeeComments: Boolean = canSeeComments_.get
|
||||
def canSeeOwnerComment: Boolean = canSeeOwnerComment_.get
|
||||
def canSeeTags : Boolean = canSeeTags_.get
|
||||
def canSeeImages : Boolean = canSeeImages_.get
|
||||
|
||||
//Bank account fields
|
||||
def canSeeAvailableViewsForBankAccount : Boolean = canSeeAvailableViewsForBankAccount_.get
|
||||
def canSeeBankAccountOwners : Boolean = canSeeBankAccountOwners_.get
|
||||
def canSeeBankAccountType : Boolean = canSeeBankAccountType_.get
|
||||
def canSeeBankAccountBalance : Boolean = canSeeBankAccountBalance_.get
|
||||
def canSeeBankAccountCurrency : Boolean = canSeeBankAccountCurrency_.get
|
||||
def canQueryAvailableFunds : Boolean = canQueryAvailableFunds_.get
|
||||
def canSeeBankAccountLabel : Boolean = canSeeBankAccountLabel_.get
|
||||
def canUpdateBankAccountLabel : Boolean = canUpdateBankAccountLabel_.get
|
||||
def canSeeBankAccountNationalIdentifier : Boolean = canSeeBankAccountNationalIdentifier_.get
|
||||
def canSeeBankAccountSwift_bic : Boolean = canSeeBankAccountSwift_bic_.get
|
||||
def canSeeBankAccountIban : Boolean = canSeeBankAccountIban_.get
|
||||
def canSeeBankAccountNumber : Boolean = canSeeBankAccountNumber_.get
|
||||
def canSeeBankAccountBankName : Boolean = canSeeBankAccountBankName_.get
|
||||
def canSeeBankAccountBankPermalink : Boolean = canSeeBankAccountBankPermalink_.get
|
||||
def canSeeBankRoutingScheme : Boolean = canSeeBankRoutingScheme_.get
|
||||
def canSeeBankRoutingAddress : Boolean = canSeeBankRoutingAddress_.get
|
||||
def canSeeBankAccountRoutingScheme : Boolean = canSeeBankAccountRoutingScheme_.get
|
||||
def canSeeBankAccountRoutingAddress : Boolean = canSeeBankAccountRoutingAddress_.get
|
||||
def canSeeViewsWithPermissionsForOneUser: Boolean = canSeeViewsWithPermissionsForOneUser_.get
|
||||
def canSeeViewsWithPermissionsForAllUsers: Boolean = canSeeViewsWithPermissionsForAllUsers_.get
|
||||
|
||||
//other bank account fields
|
||||
def canSeeOtherAccountNationalIdentifier : Boolean = canSeeOtherAccountNationalIdentifier_.get
|
||||
def canSeeOtherAccountSWIFT_BIC : Boolean = canSeeOtherAccountSWIFT_BIC_.get
|
||||
def canSeeOtherAccountIBAN : Boolean = canSeeOtherAccountIBAN_.get
|
||||
def canSeeOtherAccountBankName : Boolean = canSeeOtherAccountBankName_.get
|
||||
def canSeeOtherAccountNumber : Boolean = canSeeOtherAccountNumber_.get
|
||||
def canSeeOtherAccountMetadata : Boolean = canSeeOtherAccountMetadata_.get
|
||||
def canSeeOtherAccountKind : Boolean = canSeeOtherAccountKind_.get
|
||||
def canSeeOtherBankRoutingScheme : Boolean = canSeeOtherBankRoutingScheme_.get
|
||||
def canSeeOtherBankRoutingAddress : Boolean = canSeeOtherBankRoutingAddress_.get
|
||||
def canSeeOtherAccountRoutingScheme : Boolean = canSeeOtherAccountRoutingScheme_.get
|
||||
def canSeeOtherAccountRoutingAddress : Boolean = canSeeOtherAccountRoutingAddress_.get
|
||||
|
||||
//other bank account meta data
|
||||
def canSeeMoreInfo: Boolean = canSeeMoreInfo_.get
|
||||
def canSeeUrl: Boolean = canSeeUrl_.get
|
||||
def canSeeImageUrl: Boolean = canSeeImageUrl_.get
|
||||
def canSeeOpenCorporatesUrl: Boolean = canSeeOpenCorporatesUrl_.get
|
||||
def canSeeCorporateLocation : Boolean = canSeeCorporateLocation_.get
|
||||
def canSeePhysicalLocation : Boolean = canSeePhysicalLocation_.get
|
||||
def canSeePublicAlias : Boolean = canSeePublicAlias_.get
|
||||
def canSeePrivateAlias : Boolean = canSeePrivateAlias_.get
|
||||
def canAddMoreInfo : Boolean = canAddMoreInfo_.get
|
||||
def canAddURL : Boolean = canAddURL_.get
|
||||
def canAddImageURL : Boolean = canAddImageURL_.get
|
||||
def canAddOpenCorporatesUrl : Boolean = canAddOpenCorporatesUrl_.get
|
||||
def canAddCorporateLocation : Boolean = canAddCorporateLocation_.get
|
||||
def canAddPhysicalLocation : Boolean = canAddPhysicalLocation_.get
|
||||
def canAddPublicAlias : Boolean = canAddPublicAlias_.get
|
||||
def canAddPrivateAlias : Boolean = canAddPrivateAlias_.get
|
||||
def canAddCounterparty : Boolean = canAddCounterparty_.get
|
||||
def canGetCounterparty : Boolean = canGetCounterparty_.get
|
||||
def canDeleteCounterparty : Boolean = canDeleteCounterparty_.get
|
||||
def canDeleteCorporateLocation : Boolean = canDeleteCorporateLocation_.get
|
||||
def canDeletePhysicalLocation : Boolean = canDeletePhysicalLocation_.get
|
||||
|
||||
//writing access
|
||||
def canEditOwnerComment: Boolean = canEditOwnerComment_.get
|
||||
def canAddComment : Boolean = canAddComment_.get
|
||||
def canDeleteComment: Boolean = canDeleteComment_.get
|
||||
def canAddTag : Boolean = canAddTag_.get
|
||||
def canDeleteTag : Boolean = canDeleteTag_.get
|
||||
def canAddImage : Boolean = canAddImage_.get
|
||||
def canDeleteImage : Boolean = canDeleteImage_.get
|
||||
def canAddWhereTag : Boolean = canAddWhereTag_.get
|
||||
def canSeeWhereTag : Boolean = canSeeWhereTag_.get
|
||||
def canDeleteWhereTag : Boolean = canDeleteWhereTag_.get
|
||||
|
||||
def canAddTransactionRequestToOwnAccount: Boolean = canAddTransactionRequestToOwnAccount_.get //added following two for payments
|
||||
def canAddTransactionRequestToAnyAccount: Boolean = canAddTransactionRequestToAnyAccount_.get
|
||||
def canSeeBankAccountCreditLimit: Boolean = canSeeBankAccountCreditLimit_.get
|
||||
def canCreateDirectDebit: Boolean = false
|
||||
def canCreateStandingOrder: Boolean = false
|
||||
//TODO: if you add new permissions here, remember to set them wherever views are created
|
||||
// (e.g. BankAccountCreationDispatcher)
|
||||
|
||||
def canCreateCustomView: Boolean = canCreateCustomView_.get
|
||||
def canDeleteCustomView: Boolean = canDeleteCustomView_.get
|
||||
def canUpdateCustomView: Boolean = canUpdateCustomView_.get
|
||||
def canGetCustomView: Boolean = canGetCustomView_.get
|
||||
|
||||
override def canGrantAccessToCustomViews: Boolean = canGrantAccessToCustomViews_.get
|
||||
override def canRevokeAccessToCustomViews: Boolean = canRevokeAccessToCustomViews_.get
|
||||
|
||||
override def canAddTransactionRequestToBeneficiary: Boolean = canAddTransactionRequestToBeneficiary_.get
|
||||
|
||||
override def canSeeTransactionStatus: Boolean = canSeeTransactionStatus_.get
|
||||
}
|
||||
|
||||
object ViewImpl extends ViewImpl with LongKeyedMetaMapper[ViewImpl]{
|
||||
override def dbIndexes = UniqueIndex(bankPermalink, accountPermalink, permalink_) :: super.dbIndexes
|
||||
}
|
||||
@ -1,7 +1,6 @@
|
||||
package code.obp.grpc
|
||||
|
||||
import java.util.logging.Logger
|
||||
|
||||
import code.api.util.newstyle.ViewNewStyle
|
||||
import code.api.util.{APIUtil, CallContext, NewStyle}
|
||||
import code.api.v3_0_0.{CoreTransactionsJsonV300, ModeratedTransactionCoreWithAttributes}
|
||||
import code.api.v4_0_0.{BankJson400, BanksJson400, JSONFactory400, OBPAPI4_0_0}
|
||||
@ -10,6 +9,7 @@ import code.obp.grpc.api._
|
||||
import code.util.Helper
|
||||
import code.views.Views
|
||||
import com.google.protobuf.empty.Empty
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import io.grpc.{Server, ServerBuilder}
|
||||
import net.liftweb.common.Full
|
||||
@ -17,8 +17,7 @@ import net.liftweb.json.JsonAST.{JField, JObject}
|
||||
import net.liftweb.json.JsonDSL._
|
||||
import net.liftweb.json.{Extraction, JArray}
|
||||
|
||||
import scala.collection.immutable.List
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import java.util.logging.Logger
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
/**
|
||||
@ -129,7 +128,7 @@ class HelloWorldServer(executionContext: ExecutionContext) { self =>
|
||||
(user, _) <- NewStyle.function.findByUserId(request.userId, callContext)
|
||||
(bankAccount, callContext) <- NewStyle.function.checkBankAccountExists(bankId, accountId, callContext)
|
||||
(bank, callContext) <- NewStyle.function.getBank(bankId, callContext)
|
||||
view <- NewStyle.function.checkOwnerViewAccessAndReturnOwnerView(user, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
view <- ViewNewStyle.checkOwnerViewAccessAndReturnOwnerView(user, BankIdAccountId(bankAccount.bankId, bankAccount.accountId), callContext)
|
||||
(Full(transactionsCore), callContext) <- bankAccount.getModeratedTransactionsCore(bank, Full(user), view, BankIdAccountId(bankId, accountId), Nil, callContext)
|
||||
obpCoreTransactions: CoreTransactionsJsonV300 = code.api.v3_0_0.JSONFactory300.createCoreTransactionsJSON(transactionsCore.map(ModeratedTransactionCoreWithAttributes(_)))
|
||||
} yield {
|
||||
|
||||
@ -218,7 +218,7 @@ class MappedTransaction extends LongKeyedMapper[MappedTransaction] with IdPK wit
|
||||
}
|
||||
|
||||
def toTransaction : Option[Transaction] = {
|
||||
code.api.Constant.Connector match {
|
||||
code.api.Constant.CONNECTOR match {
|
||||
case Full("akka_vDec2018") =>
|
||||
for {
|
||||
acc <- getBankAccountCommon(theBankId, theAccountId, None).map(_._1)
|
||||
|
||||
@ -278,8 +278,8 @@ object MapperViews extends Views with MdcLoggable {
|
||||
}
|
||||
|
||||
//returns Full if deletable, Failure if not
|
||||
def canRevokeOwnerAccessAsBox(bankId: BankId, accountId: AccountId, viewImpl : ViewDefinition, user : User) : Box[Unit] = {
|
||||
if(canRevokeOwnerAccess(bankId: BankId, accountId: AccountId, viewImpl, user)) Full(Unit)
|
||||
def canRevokeOwnerAccessAsBox(bankId: BankId, accountId: AccountId, viewDefinition : ViewDefinition, user : User) : Box[Unit] = {
|
||||
if(canRevokeOwnerAccess(bankId: BankId, accountId: AccountId, viewDefinition, user)) Full(Unit)
|
||||
else Failure("access cannot be revoked")
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
Failure(s"$SystemViewAlreadyExistsError Current VIEW_ID($viewId)")
|
||||
case false =>
|
||||
val createdView = ViewDefinition.create.name_(view.name).view_id(viewId)
|
||||
createdView.setFromViewData(view)
|
||||
createdView.createViewAndPermissions(view)
|
||||
createdView.isSystem_(true)
|
||||
createdView.isPublic_(false)
|
||||
Full(createdView.saveMe)
|
||||
@ -434,7 +434,8 @@ object MapperViews extends Views with MdcLoggable {
|
||||
bank_id(bankAccountId.bankId.value).
|
||||
account_id(bankAccountId.accountId.value)
|
||||
|
||||
createdView.setFromViewData(view)
|
||||
createdView.createViewAndPermissions(view)
|
||||
|
||||
Full(createdView.saveMe)
|
||||
}
|
||||
}
|
||||
@ -442,11 +443,10 @@ object MapperViews extends Views with MdcLoggable {
|
||||
|
||||
/* Update the specification of the view (what data/actions are allowed) */
|
||||
def updateCustomView(bankAccountId : BankIdAccountId, viewId: ViewId, viewUpdateJson : UpdateViewJSON) : Box[View] = {
|
||||
|
||||
for {
|
||||
view <- ViewDefinition.findCustomView(bankAccountId.bankId.value, bankAccountId.accountId.value, viewId.value)
|
||||
} yield {
|
||||
view.setFromViewData(viewUpdateJson)
|
||||
view.createViewAndPermissions(viewUpdateJson)
|
||||
view.saveMe
|
||||
}
|
||||
}
|
||||
@ -455,7 +455,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
for {
|
||||
view <- ViewDefinition.findSystemView(viewId.value)
|
||||
} yield {
|
||||
view.setFromViewData(viewUpdateJson)
|
||||
view.createViewAndPermissions(viewUpdateJson)
|
||||
view.saveMe
|
||||
}
|
||||
}
|
||||
@ -472,6 +472,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
case false => Full()
|
||||
}
|
||||
} yield {
|
||||
customView.deleteViewPermissions
|
||||
customView.delete_!
|
||||
}
|
||||
}
|
||||
@ -483,6 +484,7 @@ object MapperViews extends Views with MdcLoggable {
|
||||
case false => Full()
|
||||
}
|
||||
} yield {
|
||||
view.deleteViewPermissions
|
||||
view.delete_!
|
||||
}
|
||||
}
|
||||
@ -620,113 +622,83 @@ object MapperViews extends Views with MdcLoggable {
|
||||
theView
|
||||
}
|
||||
|
||||
private def migrateViewPermissions(view: View): Unit = {
|
||||
val permissionNames = List(
|
||||
"canSeeTransactionOtherBankAccount",
|
||||
"canSeeTransactionMetadata",
|
||||
"canSeeTransactionDescription",
|
||||
"canSeeTransactionAmount",
|
||||
"canSeeTransactionType",
|
||||
"canSeeTransactionCurrency",
|
||||
"canSeeTransactionStartDate",
|
||||
"canSeeTransactionFinishDate",
|
||||
"canSeeTransactionBalance",
|
||||
"canSeeComments",
|
||||
"canSeeOwnerComment",
|
||||
"canSeeTags",
|
||||
"canSeeImages",
|
||||
"canSeeBankAccountOwners",
|
||||
"canSeeBankAccountType",
|
||||
"canSeeBankAccountBalance",
|
||||
"canQueryAvailableFunds",
|
||||
"canSeeBankAccountLabel",
|
||||
"canSeeBankAccountNationalIdentifier",
|
||||
"canSeeBankAccountSwift_bic",
|
||||
"canSeeBankAccountIban",
|
||||
"canSeeBankAccountNumber",
|
||||
"canSeeBankAccountBankName",
|
||||
"canSeeBankAccountBankPermalink",
|
||||
"canSeeBankRoutingScheme",
|
||||
"canSeeBankRoutingAddress",
|
||||
"canSeeBankAccountRoutingScheme",
|
||||
"canSeeBankAccountRoutingAddress",
|
||||
"canSeeOtherAccountNationalIdentifier",
|
||||
"canSeeOtherAccountSWIFT_BIC",
|
||||
"canSeeOtherAccountIBAN",
|
||||
"canSeeOtherAccountBankName",
|
||||
"canSeeOtherAccountNumber",
|
||||
"canSeeOtherAccountMetadata",
|
||||
"canSeeOtherAccountKind",
|
||||
"canSeeOtherBankRoutingScheme",
|
||||
"canSeeOtherBankRoutingAddress",
|
||||
"canSeeOtherAccountRoutingScheme",
|
||||
"canSeeOtherAccountRoutingAddress",
|
||||
"canSeeMoreInfo",
|
||||
"canSeeUrl",
|
||||
"canSeeImageUrl",
|
||||
"canSeeOpenCorporatesUrl",
|
||||
"canSeeCorporateLocation",
|
||||
"canSeePhysicalLocation",
|
||||
"canSeePublicAlias",
|
||||
"canSeePrivateAlias",
|
||||
"canAddMoreInfo",
|
||||
"canAddURL",
|
||||
"canAddImageURL",
|
||||
"canAddOpenCorporatesUrl",
|
||||
"canAddCorporateLocation",
|
||||
"canAddPhysicalLocation",
|
||||
"canAddPublicAlias",
|
||||
"canAddPrivateAlias",
|
||||
"canAddCounterparty",
|
||||
"canGetCounterparty",
|
||||
"canDeleteCounterparty",
|
||||
"canDeleteCorporateLocation",
|
||||
"canDeletePhysicalLocation",
|
||||
"canEditOwnerComment",
|
||||
"canAddComment",
|
||||
"canDeleteComment",
|
||||
"canAddTag",
|
||||
"canDeleteTag",
|
||||
"canAddImage",
|
||||
"canDeleteImage",
|
||||
"canAddWhereTag",
|
||||
"canSeeWhereTag",
|
||||
"canDeleteWhereTag",
|
||||
"canAddTransactionRequestToOwnAccount",
|
||||
"canAddTransactionRequestToAnyAccount",
|
||||
"canSeeBankAccountCreditLimit",
|
||||
"canCreateDirectDebit",
|
||||
"canCreateStandingOrder",
|
||||
"canRevokeAccessToCustomViews",
|
||||
"canGrantAccessToCustomViews",
|
||||
"canSeeTransactionRequests",
|
||||
"canSeeTransactionRequestTypes",
|
||||
"canSeeAvailableViewsForBankAccount",
|
||||
"canUpdateBankAccountLabel",
|
||||
"canCreateCustomView",
|
||||
"canDeleteCustomView",
|
||||
"canUpdateCustomView",
|
||||
"canGetCustomView",
|
||||
"canSeeViewsWithPermissionsForAllUsers",
|
||||
"canSeeViewsWithPermissionsForOneUser"
|
||||
)
|
||||
/**
|
||||
* This migrates the current View permissions to the new ViewPermission model.
|
||||
* this will not add any new permission, it will only migrate the existing permissions.
|
||||
* @param viewDefinition
|
||||
*/
|
||||
def migrateViewPermissions(viewDefinition: View): Unit = {
|
||||
|
||||
//first, we list all the current view permissions.
|
||||
val permissionNames: List[String] = ALL_VIEW_PERMISSION_NAMES
|
||||
|
||||
permissionNames.foreach { permissionName =>
|
||||
// Get permission value
|
||||
val permissionValue = view.getClass.getMethod(permissionName).invoke(view).asInstanceOf[Boolean]
|
||||
// CAN_REVOKE_ACCESS_TO_VIEWS and CAN_GRANT_ACCESS_TO_VIEWS are special cases, they have a list of view ids as metadata.
|
||||
// For the rest of the permissions, they are just boolean values.
|
||||
if (permissionName == CAN_REVOKE_ACCESS_TO_VIEWS || permissionName == CAN_GRANT_ACCESS_TO_VIEWS) {
|
||||
|
||||
ViewPermission.findSystemViewPermissions(view.viewId).find(_.permission.get == permissionName) match {
|
||||
case Some(permission) if !permissionValue =>
|
||||
ViewPermission.delete_!(permission)
|
||||
case Some(permission) if permissionValue =>
|
||||
// View definition is in accordance with View permission
|
||||
case _ =>
|
||||
ViewPermission.create
|
||||
.bank_id(null)
|
||||
.account_id(null)
|
||||
.view_id(view.viewId.value)
|
||||
.permission(permissionName)
|
||||
.save
|
||||
val permissionValueFromViewDefinition = viewDefinition.getClass.getMethod(StringHelpers.camelifyMethod(permissionName)).invoke(viewDefinition).asInstanceOf[Option[List[String]]]
|
||||
|
||||
ViewPermission.findViewPermission(viewDefinition, permissionName) match {
|
||||
// If the permission already exists in ViewPermission, but permissionValueFromViewDefinition is empty, we delete it.
|
||||
case Full(permission) if permissionValueFromViewDefinition.isEmpty =>
|
||||
permission.delete_!
|
||||
// If the permission already exists and permissionValueFromViewDefinition is defined, we update the metadata.
|
||||
case Full(permission) if permissionValueFromViewDefinition.isDefined =>
|
||||
permission.extraData(permissionValueFromViewDefinition.get.mkString(",")).save
|
||||
//if the permission is not existing in ViewPermission,but it is defined in the viewDefinition, we create it. --systemView
|
||||
case Empty if (viewDefinition.isSystem && permissionValueFromViewDefinition.isDefined) =>
|
||||
ViewPermission.create
|
||||
.bank_id(null)
|
||||
.account_id(null)
|
||||
.view_id(viewDefinition.viewId.value)
|
||||
.permission(permissionName)
|
||||
.extraData(permissionValueFromViewDefinition.get.mkString(","))
|
||||
.save
|
||||
//if the permission is not existing in ViewPermission,but it is defined in the viewDefinition, we create it. --customView
|
||||
case Empty if (!viewDefinition.isSystem && permissionValueFromViewDefinition.isDefined) =>
|
||||
ViewPermission.create
|
||||
.bank_id(viewDefinition.bankId.value)
|
||||
.account_id(viewDefinition.accountId.value)
|
||||
.view_id(viewDefinition.viewId.value)
|
||||
.permission(permissionName)
|
||||
.extraData(permissionValueFromViewDefinition.get.mkString(","))
|
||||
.save
|
||||
case _ =>
|
||||
// This case should not happen, but if it does, we add an error log
|
||||
logger.error(s"Unexpected case for permission $permissionName for view ${viewDefinition.viewId.value}. No action taken.")
|
||||
}
|
||||
} else {
|
||||
// For the rest of the permissions, they are just boolean values.
|
||||
val permissionValue = viewDefinition.getClass.getMethod(StringHelpers.camelifyMethod(permissionName)).invoke(viewDefinition).asInstanceOf[Boolean]
|
||||
|
||||
ViewPermission.findViewPermission(viewDefinition, permissionName) match {
|
||||
// If the permission already exists in ViewPermission, but permissionValueFromViewdefinition is false, we delete it.
|
||||
case Full(permission) if !permissionValue =>
|
||||
permission.delete_!
|
||||
// If the permission already exists in ViewPermission, but permissionValueFromViewdefinition is empty, we udpate it.
|
||||
case Full(permission) if permissionValue =>
|
||||
permission.permission(permissionName).save
|
||||
//if the permission is not existing in ViewPermission, but it is defined in the viewDefinition, we create it. --systemView
|
||||
case _ if (viewDefinition.isSystem && permissionValue) =>
|
||||
ViewPermission.create
|
||||
.bank_id(null)
|
||||
.account_id(null)
|
||||
.view_id(viewDefinition.viewId.value)
|
||||
.permission(permissionName)
|
||||
.save
|
||||
//if the permission is not existing in ViewPermission, but it is defined in the viewDefinition, we create it. --customerView
|
||||
case _ if (!viewDefinition.isSystem && permissionValue) =>
|
||||
ViewPermission.create
|
||||
.bank_id(viewDefinition.bankId.value)
|
||||
.account_id(viewDefinition.accountId.value)
|
||||
.view_id(viewDefinition.viewId.value)
|
||||
.permission(permissionName)
|
||||
.save
|
||||
case _ =>
|
||||
// This case should not happen, but if it does, we do nothing
|
||||
logger.warn(s"Unexpected case for permission $permissionName for view ${viewDefinition.viewId.value}. No action taken.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -734,12 +706,8 @@ object MapperViews extends Views with MdcLoggable {
|
||||
def getOrCreateSystemView(viewId: String) : Box[View] = {
|
||||
getExistingSystemView(viewId) match {
|
||||
case Empty =>
|
||||
val view = createDefaultSystemView(viewId)
|
||||
view.map(v => migrateViewPermissions(v))
|
||||
view
|
||||
case Full(v) =>
|
||||
migrateViewPermissions(v)
|
||||
Full(v)
|
||||
createDefaultSystemView(viewId)
|
||||
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)
|
||||
}
|
||||
@ -759,8 +727,10 @@ 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=> createDefaultCustomPublicView(bankId, accountId, description)
|
||||
case Full(v)=> Full(v)
|
||||
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)
|
||||
}
|
||||
@ -789,23 +759,25 @@ object MapperViews extends Views with MdcLoggable {
|
||||
res
|
||||
}
|
||||
|
||||
def removeAllPermissions(bankId: BankId, accountId: AccountId) : Boolean = {
|
||||
def removeAllAccountAccess(bankId: BankId, accountId: AccountId) : Boolean = {
|
||||
AccountAccess.bulkDelete_!!(
|
||||
By(AccountAccess.bank_id, bankId.value),
|
||||
By(AccountAccess.account_id, accountId.value)
|
||||
)
|
||||
}
|
||||
|
||||
def removeAllViews(bankId: BankId, accountId: AccountId) : Boolean = {
|
||||
def removeAllViewsAndVierPermissions(bankId: BankId, accountId: AccountId) : Boolean = {
|
||||
ViewDefinition.bulkDelete_!!(
|
||||
By(ViewDefinition.bank_id, bankId.value),
|
||||
By(ViewDefinition.account_id, accountId.value)
|
||||
)
|
||||
ViewPermission.bulkDelete_!!()
|
||||
}
|
||||
|
||||
def bulkDeleteAllPermissionsAndViews() : Boolean = {
|
||||
def bulkDeleteAllViewsAndAccountAccessAndViewPermission() : Boolean = {
|
||||
ViewDefinition.bulkDelete_!!()
|
||||
AccountAccess.bulkDelete_!!()
|
||||
ViewPermission.bulkDelete_!!()
|
||||
true
|
||||
}
|
||||
|
||||
@ -822,156 +794,71 @@ object MapperViews extends Views with MdcLoggable {
|
||||
.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)
|
||||
.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)
|
||||
.canSeeTransactionStatus_(true)
|
||||
|
||||
// TODO Allow use only for certain cases
|
||||
.canAddTransactionRequestToOwnAccount_(true) //added following two for payments
|
||||
.canAddTransactionRequestToAnyAccount_(true)
|
||||
.canAddTransactionRequestToBeneficiary_(true)
|
||||
|
||||
.canSeeAvailableViewsForBankAccount_(false)
|
||||
.canSeeTransactionRequests_(false)
|
||||
.canSeeTransactionRequestTypes_(false)
|
||||
.canUpdateBankAccountLabel_(false)
|
||||
.canSeeViewsWithPermissionsForOneUser_(false)
|
||||
.canSeeViewsWithPermissionsForAllUsers_(false)
|
||||
.canRevokeAccessToCustomViews_(false)
|
||||
.canGrantAccessToCustomViews_(false)
|
||||
.canCreateCustomView_(false)
|
||||
.canDeleteCustomView_(false)
|
||||
.canUpdateCustomView_(false)
|
||||
.canGetCustomView_(false)
|
||||
|
||||
|
||||
viewId match {
|
||||
case SYSTEM_OWNER_VIEW_ID | SYSTEM_STANDARD_VIEW_ID =>
|
||||
entity // Make additional setup to the existing view
|
||||
.canSeeAvailableViewsForBankAccount_(true)
|
||||
.canSeeTransactionRequests_(true)
|
||||
.canSeeTransactionRequestTypes_(true)
|
||||
.canUpdateBankAccountLabel_(true)
|
||||
.canSeeViewsWithPermissionsForOneUser_(true)
|
||||
.canSeeViewsWithPermissionsForAllUsers_(true)
|
||||
.canGrantAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
.canRevokeAccessToViews_(DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS.mkString(","))
|
||||
case SYSTEM_STAGE_ONE_VIEW_ID =>
|
||||
entity // Make additional setup to the existing view
|
||||
.canSeeTransactionDescription_(false)
|
||||
.canAddTransactionRequestToAnyAccount_(false)
|
||||
.canAddTransactionRequestToBeneficiary_(false)
|
||||
case SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID =>
|
||||
entity // Make additional setup to the existing view
|
||||
.canRevokeAccessToCustomViews_(true)
|
||||
.canGrantAccessToCustomViews_(true)
|
||||
.canCreateCustomView_(true)
|
||||
.canDeleteCustomView_(true)
|
||||
.canUpdateCustomView_(true)
|
||||
.canGetCustomView_(true)
|
||||
case SYSTEM_FIREHOSE_VIEW_ID =>
|
||||
case SYSTEM_OWNER_VIEW_ID | SYSTEM_STANDARD_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_OWNER_VIEW_PERMISSION_ADMIN ++SYSTEM_VIEW_PERMISSION_COMMON,
|
||||
DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS,
|
||||
DEFAULT_CAN_GRANT_AND_REVOKE_ACCESS_TO_VIEWS
|
||||
)
|
||||
entity
|
||||
}
|
||||
case SYSTEM_STAGE_ONE_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_VIEW_PERMISSION_COMMON++SYSTEM_VIEW_PERMISSION_COMMON
|
||||
)
|
||||
entity
|
||||
}
|
||||
case SYSTEM_MANAGE_CUSTOM_VIEWS_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_VIEW_PERMISSION_COMMON++SYSTEM_MANAGER_VIEW_PERMISSION
|
||||
)
|
||||
entity
|
||||
}
|
||||
case SYSTEM_FIREHOSE_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_VIEW_PERMISSION_COMMON
|
||||
)
|
||||
entity // Make additional setup to the existing view
|
||||
.isFirehose_(true)
|
||||
}
|
||||
case SYSTEM_READ_ACCOUNTS_BERLIN_GROUP_VIEW_ID |
|
||||
SYSTEM_READ_BALANCES_BERLIN_GROUP_VIEW_ID =>
|
||||
create // A new one
|
||||
.isSystem_(true)
|
||||
.isFirehose_(false)
|
||||
.name_(StringHelpers.capify(viewId))
|
||||
.view_id(viewId)
|
||||
.description_(viewId)
|
||||
case SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID =>
|
||||
create // A new one
|
||||
.isSystem_(true)
|
||||
.isFirehose_(false)
|
||||
.name_(StringHelpers.capify(viewId))
|
||||
.view_id(viewId)
|
||||
.description_(viewId)
|
||||
.canSeeTransactionThisBankAccount_(true)
|
||||
.canSeeTransactionOtherBankAccount_(true)
|
||||
.canSeeTransactionAmount_(true)
|
||||
.canSeeTransactionCurrency_(true)
|
||||
.canSeeTransactionBalance_(true)
|
||||
.canSeeTransactionStartDate_(true)
|
||||
.canSeeTransactionFinishDate_(true)
|
||||
.canSeeTransactionDescription_(true)
|
||||
case SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_VIEW_ID =>
|
||||
create // A new one
|
||||
.isSystem_(true)
|
||||
.isFirehose_(false)
|
||||
.name_(StringHelpers.capify(viewId))
|
||||
.view_id(viewId)
|
||||
.description_(viewId)
|
||||
.canAddTransactionRequestToAnyAccount_(true)
|
||||
.canAddTransactionRequestToBeneficiary_(true)
|
||||
entity
|
||||
case SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_READ_TRANSACTIONS_BERLIN_GROUP_VIEW_PERMISSION
|
||||
)
|
||||
entity
|
||||
}
|
||||
case SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_VIEW_ID =>{
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_INITIATE_PAYMENTS_BERLIN_GROUP_PERMISSION
|
||||
)
|
||||
entity
|
||||
}
|
||||
case SYSTEM_ACCOUNTANT_VIEW_ID |
|
||||
SYSTEM_AUDITOR_VIEW_ID |
|
||||
SYSTEM_READ_ACCOUNTS_BASIC_VIEW_ID |
|
||||
SYSTEM_READ_ACCOUNTS_DETAIL_VIEW_ID |
|
||||
SYSTEM_READ_BALANCES_VIEW_ID |
|
||||
SYSTEM_READ_TRANSACTIONS_BASIC_VIEW_ID |
|
||||
SYSTEM_READ_TRANSACTIONS_DEBITS_VIEW_ID |
|
||||
SYSTEM_READ_TRANSACTIONS_DETAIL_VIEW_ID => {
|
||||
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_VIEW_PERMISSION_COMMON
|
||||
)
|
||||
entity
|
||||
}
|
||||
case _ =>
|
||||
entity
|
||||
}
|
||||
@ -996,87 +883,13 @@ object MapperViews extends Views with MdcLoggable {
|
||||
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)
|
||||
entity.
|
||||
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_(false).
|
||||
canDeleteCorporateLocation_(false).
|
||||
canDeletePhysicalLocation_(false).
|
||||
canEditOwnerComment_(true).
|
||||
canAddComment_(true).
|
||||
canDeleteComment_(false).
|
||||
canAddTag_(true).
|
||||
canDeleteTag_(false).
|
||||
canAddImage_(true).
|
||||
canDeleteImage_(false).
|
||||
canAddWhereTag_(true).
|
||||
canSeeWhereTag_(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).
|
||||
canAddTransactionRequestToBeneficiary_(false).
|
||||
canSeeTransactionRequests_(false).
|
||||
canSeeTransactionRequestTypes_(false).
|
||||
canUpdateBankAccountLabel_(false).
|
||||
canCreateCustomView_(false).
|
||||
canDeleteCustomView_(false).
|
||||
canUpdateCustomView_(false).
|
||||
canGetCustomView_(false).
|
||||
canSeeTransactionStatus_(true)
|
||||
hideOtherAccountMetadataIfAlias_(true)
|
||||
|
||||
ViewPermission.resetViewPermissions(
|
||||
entity,
|
||||
SYSTEM_PUBLIC_VIEW_PERMISSION
|
||||
)
|
||||
entity
|
||||
}
|
||||
|
||||
def createAndSaveDefaultPublicCustomView(bankId : BankId, accountId: AccountId, description: String) : Box[View] = {
|
||||
|
||||
@ -1,15 +1,13 @@
|
||||
package code.views
|
||||
|
||||
import code.api.util.{APIUtil, CallContext}
|
||||
import code.model.dataAccess.{MappedBankAccount}
|
||||
import code.api.util.CallContext
|
||||
import code.model.dataAccess.MappedBankAccount
|
||||
import code.views.system.AccountAccess
|
||||
import com.openbankproject.commons.model.{CreateViewJson, _}
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.mapper.By
|
||||
import net.liftweb.util.{SimpleInjector}
|
||||
|
||||
import scala.concurrent.Future
|
||||
import com.openbankproject.commons.ExecutionContext.Implicits.global
|
||||
import net.liftweb.util.SimpleInjector
|
||||
|
||||
import scala.concurrent.Future
|
||||
|
||||
@ -26,11 +24,6 @@ trait Views {
|
||||
def permissions(account : BankIdAccountId) : List[Permission]
|
||||
def permission(account : BankIdAccountId, user: User) : Box[Permission]
|
||||
def getPermissionForUser(user: User) : Box[Permission]
|
||||
/**
|
||||
* This is for @ViewPrivileges.
|
||||
* It will first find the view object by `bankIdAccountIdViewId`
|
||||
* And then, call @getOrCreateViewPrivilege(view: View, user: User) for the view and user.
|
||||
*/
|
||||
def grantAccessToCustomView(bankIdAccountIdViewId : BankIdAccountIdViewId, user : User) : Box[View]
|
||||
def grantAccessToSystemView(bankId: BankId, accountId: AccountId, view : View, user : User) : Box[View]
|
||||
def grantAccessToMultipleViews(views : List[BankIdAccountIdViewId], user : User, callContext: Option[CallContext]) : Box[List[View]]
|
||||
@ -109,10 +102,10 @@ trait Views {
|
||||
|
||||
def getOwners(view: View): Set[User]
|
||||
|
||||
def removeAllPermissions(bankId: BankId, accountId: AccountId) : Boolean
|
||||
def removeAllViews(bankId: BankId, accountId: AccountId) : Boolean
|
||||
def removeAllAccountAccess(bankId: BankId, accountId: AccountId) : Boolean
|
||||
def removeAllViewsAndVierPermissions(bankId: BankId, accountId: AccountId) : Boolean
|
||||
|
||||
def bulkDeleteAllPermissionsAndViews() : Boolean
|
||||
def bulkDeleteAllViewsAndAccountAccessAndViewPermission() : Boolean
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package code.views.system
|
||||
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.{isValidCustomViewId, isValidSystemViewId}
|
||||
import code.api.util.ErrorMessages.{CreateSystemViewError, InvalidCustomViewFormat, InvalidSystemViewFormat}
|
||||
import code.util.{AccountIdString, UUIDString}
|
||||
@ -8,7 +9,6 @@ import net.liftweb.common.Box
|
||||
import net.liftweb.common.Box.tryo
|
||||
import net.liftweb.mapper._
|
||||
|
||||
|
||||
class ViewDefinition extends View with LongKeyedMapper[ViewDefinition] with ManyToMany with CreatedUpdated{
|
||||
def getSingleton = ViewDefinition
|
||||
|
||||
@ -343,11 +343,11 @@ class ViewDefinition extends View with LongKeyedMapper[ViewDefinition] with Many
|
||||
}
|
||||
|
||||
//Important! If you add a field, be sure to handle it here in this function
|
||||
def setFromViewData(viewData : ViewSpecification) = {
|
||||
if(viewData.which_alias_to_use == "public"){
|
||||
def setFromViewData(viewSpecification : ViewSpecification) = {
|
||||
if(viewSpecification.which_alias_to_use == "public"){
|
||||
usePublicAliasIfOneExists_(true)
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
} else if(viewData.which_alias_to_use == "private"){
|
||||
} else if(viewSpecification.which_alias_to_use == "private"){
|
||||
usePublicAliasIfOneExists_(false)
|
||||
usePrivateAliasIfOneExists_(true)
|
||||
} else {
|
||||
@ -355,108 +355,50 @@ class ViewDefinition extends View with LongKeyedMapper[ViewDefinition] with Many
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
}
|
||||
|
||||
hideOtherAccountMetadataIfAlias_(viewData.hide_metadata_if_alias_used)
|
||||
description_(viewData.description)
|
||||
isPublic_(viewData.is_public)
|
||||
isFirehose_(viewData.is_firehose.getOrElse(false))
|
||||
metadataView_(viewData.metadata_view)
|
||||
hideOtherAccountMetadataIfAlias_(viewSpecification.hide_metadata_if_alias_used)
|
||||
description_(viewSpecification.description)
|
||||
isPublic_(viewSpecification.is_public)
|
||||
isFirehose_(viewSpecification.is_firehose.getOrElse(false))
|
||||
metadataView_(viewSpecification.metadata_view)
|
||||
|
||||
val actions = viewData.allowed_actions
|
||||
ViewPermission.resetViewPermissions(
|
||||
this,
|
||||
viewSpecification.allowed_actions,
|
||||
viewSpecification.can_grant_access_to_views.getOrElse(Nil),
|
||||
viewSpecification.can_revoke_access_to_views.getOrElse(Nil)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
if (isSystem) { //The following are admin permissions, only system views are allowed to use them.
|
||||
canGrantAccessToCustomViews_(actions.exists(_ == "can_grant_access_to_custom_views"))
|
||||
canRevokeAccessToCustomViews_(actions.exists(_ == "can_revoke_access_to_custom_views"))
|
||||
canGrantAccessToViews_(viewData.can_grant_access_to_views.getOrElse(Nil).mkString(","))
|
||||
canRevokeAccessToViews_(viewData.can_revoke_access_to_views.getOrElse(Nil).mkString(","))
|
||||
canCreateCustomView_(actions.exists(_ == "can_create_custom_view"))
|
||||
canDeleteCustomView_(actions.exists(_ == "can_delete_custom_view"))
|
||||
canUpdateCustomView_(actions.exists(_ == "can_update_custom_view"))
|
||||
def createViewAndPermissions(viewSpecification : ViewSpecification) = {
|
||||
if(viewSpecification.which_alias_to_use == "public"){
|
||||
usePublicAliasIfOneExists_(true)
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
} else if(viewSpecification.which_alias_to_use == "private"){
|
||||
usePublicAliasIfOneExists_(false)
|
||||
usePrivateAliasIfOneExists_(true)
|
||||
} else {
|
||||
usePublicAliasIfOneExists_(false)
|
||||
usePrivateAliasIfOneExists_(false)
|
||||
}
|
||||
|
||||
canSeeTransactionThisBankAccount_(actions.exists(_ =="can_see_transaction_this_bank_account"))
|
||||
canSeeTransactionOtherBankAccount_(actions.exists(_ =="can_see_transaction_other_bank_account"))
|
||||
canSeeTransactionMetadata_(actions.exists(_ == "can_see_transaction_metadata"))
|
||||
canSeeTransactionDescription_(actions.exists(a => a == "can_see_transaction_label" || a == "can_see_transaction_description"))
|
||||
canSeeTransactionAmount_(actions.exists(_ == "can_see_transaction_amount"))
|
||||
canSeeTransactionType_(actions.exists(_ == "can_see_transaction_type"))
|
||||
canSeeTransactionCurrency_(actions.exists(_ == "can_see_transaction_currency"))
|
||||
canSeeTransactionStartDate_(actions.exists(_ == "can_see_transaction_start_date"))
|
||||
canSeeTransactionFinishDate_(actions.exists(_ == "can_see_transaction_finish_date"))
|
||||
canSeeTransactionBalance_(actions.exists(_ == "can_see_transaction_balance"))
|
||||
canSeeComments_(actions.exists(_ == "can_see_comments"))
|
||||
canSeeOwnerComment_(actions.exists(_ == "can_see_narrative"))
|
||||
canSeeTags_(actions.exists(_ == "can_see_tags"))
|
||||
canSeeImages_(actions.exists(_ == "can_see_images"))
|
||||
canSeeBankAccountOwners_(actions.exists(_ == "can_see_bank_account_owners"))
|
||||
canSeeBankAccountType_(actions.exists(_ == "can_see_bank_account_type"))
|
||||
canSeeBankAccountBalance_(actions.exists(_ == "can_see_bank_account_balance"))
|
||||
canQueryAvailableFunds_(actions.exists(_ == "can_query_available_funds"))
|
||||
canSeeBankAccountCurrency_(actions.exists(_ == "can_see_bank_account_currency"))
|
||||
canSeeBankAccountLabel_(actions.exists(_ == "can_see_bank_account_label"))
|
||||
canSeeBankAccountNationalIdentifier_(actions.exists(_ == "can_see_bank_account_national_identifier"))
|
||||
canSeeBankAccountSwift_bic_(actions.exists(_ == "can_see_bank_account_swift_bic"))
|
||||
canSeeBankAccountIban_(actions.exists(_ == "can_see_bank_account_iban"))
|
||||
canSeeBankAccountNumber_(actions.exists(_ == "can_see_bank_account_number"))
|
||||
canSeeBankAccountBankName_(actions.exists(_ == "can_see_bank_account_bank_name"))
|
||||
canSeeBankAccountBankPermalink_(actions.exists(_ == "can_see_bank_account_bank_permalink"))
|
||||
canSeeBankRoutingScheme_(actions.exists(_ == "can_see_bank_routing_scheme"))
|
||||
canSeeBankRoutingAddress_(actions.exists(_ == "can_see_bank_routing_address"))
|
||||
canSeeBankAccountRoutingScheme_(actions.exists(_ == "can_see_bank_account_routing_scheme"))
|
||||
canSeeBankAccountRoutingAddress_(actions.exists(_ == "can_see_bank_account_routing_address"))
|
||||
canSeeOtherAccountNationalIdentifier_(actions.exists(_ == "can_see_other_account_national_identifier"))
|
||||
canSeeOtherAccountSWIFT_BIC_(actions.exists(_ == "can_see_other_account_swift_bic"))
|
||||
canSeeOtherAccountIBAN_(actions.exists(_ == "can_see_other_account_iban"))
|
||||
canSeeOtherAccountBankName_(actions.exists(_ == "can_see_other_account_bank_name"))
|
||||
canSeeOtherAccountNumber_(actions.exists(_ == "can_see_other_account_number"))
|
||||
canSeeOtherAccountMetadata_(actions.exists(_ == "can_see_other_account_metadata"))
|
||||
canSeeOtherAccountKind_(actions.exists(_ == "can_see_other_account_kind"))
|
||||
canSeeOtherBankRoutingScheme_(actions.exists(_ == "can_see_other_bank_routing_scheme"))
|
||||
canSeeOtherBankRoutingAddress_(actions.exists(_ == "can_see_other_bank_routing_address"))
|
||||
canSeeOtherAccountRoutingScheme_(actions.exists(_ == "can_see_other_account_routing_scheme"))
|
||||
canSeeOtherAccountRoutingAddress_(actions.exists(_ == "can_see_other_account_routing_address"))
|
||||
canSeeMoreInfo_(actions.exists(_ == "can_see_more_info"))
|
||||
canSeeUrl_(actions.exists(_ == "can_see_url"))
|
||||
canSeeImageUrl_(actions.exists(_ == "can_see_image_url"))
|
||||
canSeeOpenCorporatesUrl_(actions.exists(_ == "can_see_open_corporates_url"))
|
||||
canSeeCorporateLocation_(actions.exists(_ == "can_see_corporate_location"))
|
||||
canSeePhysicalLocation_(actions.exists(_ == "can_see_physical_location"))
|
||||
canSeePublicAlias_(actions.exists(_ == "can_see_public_alias"))
|
||||
canSeePrivateAlias_(actions.exists(_ == "can_see_private_alias"))
|
||||
canAddMoreInfo_(actions.exists(_ == "can_add_more_info"))
|
||||
canAddURL_(actions.exists(_ == "can_add_url"))
|
||||
canAddImageURL_(actions.exists(_ == "can_add_image_url"))
|
||||
canAddOpenCorporatesUrl_(actions.exists(_ == "can_add_open_corporates_url"))
|
||||
canAddCorporateLocation_(actions.exists(_ == "can_add_corporate_location"))
|
||||
canAddPhysicalLocation_(actions.exists(_ == "can_add_physical_location"))
|
||||
canAddPublicAlias_(actions.exists(_ == "can_add_public_alias"))
|
||||
canAddPrivateAlias_(actions.exists(_ == "can_add_private_alias"))
|
||||
canAddCounterparty_(actions.exists(_ == "can_add_counterparty"))
|
||||
canDeleteCounterparty_(actions.exists(_ == "can_delete_counterparty"))
|
||||
canGetCounterparty_(actions.exists(_ == "can_get_counterparty"))
|
||||
canDeleteCorporateLocation_(actions.exists(_ == "can_delete_corporate_location"))
|
||||
canDeletePhysicalLocation_(actions.exists(_ == "can_delete_physical_location"))
|
||||
canEditOwnerComment_(actions.exists(_ == "can_edit_narrative"))
|
||||
canAddComment_(actions.exists(_ == "can_add_comment"))
|
||||
canDeleteComment_(actions.exists(_ == "can_delete_comment"))
|
||||
canAddTag_(actions.exists(_ == "can_add_tag"))
|
||||
canDeleteTag_(actions.exists(_ == "can_delete_tag"))
|
||||
canAddImage_(actions.exists(_ == "can_add_image"))
|
||||
canDeleteImage_(actions.exists(_ == "can_delete_image"))
|
||||
canAddWhereTag_(actions.exists(_ == "can_add_where_tag"))
|
||||
canSeeWhereTag_(actions.exists(_ == "can_see_where_tag"))
|
||||
canDeleteWhereTag_(actions.exists(_ == "can_delete_where_tag"))
|
||||
canAddTransactionRequestToBeneficiary_(actions.exists(_ == "can_add_transaction_request_to_beneficiary"))
|
||||
canAddTransactionRequestToAnyAccount_(actions.exists(_ == "can_add_transaction_request_to_any_account"))
|
||||
canSeeBankAccountCreditLimit_(actions.exists(_ == "can_see_bank_account_credit_limit"))
|
||||
canCreateDirectDebit_(actions.exists(_ == "can_create_direct_debit"))
|
||||
canCreateStandingOrder_(actions.exists(_ == "can_create_standing_order"))
|
||||
canSeeTransactionRequests_(actions.exists(_ == "can_see_transaction_requests"))
|
||||
canSeeTransactionRequestTypes_(actions.exists(_ == "can_see_transaction_request_types"))
|
||||
canUpdateBankAccountLabel_(actions.exists(_ == "can_update_bank_account_label"))
|
||||
canSeeAvailableViewsForBankAccount_(actions.exists(_ == "can_see_available_views_for_bank_account"))
|
||||
canSeeViewsWithPermissionsForAllUsers_(actions.exists(_ == "can_see_views_with_permissions_for_all_users"))
|
||||
canSeeViewsWithPermissionsForOneUser_(actions.exists(_ == "can_see_views_with_permissions_for_one_user"))
|
||||
canSeeTransactionStatus_(actions.exists(_ == "can_see_transaction_status"))
|
||||
|
||||
hideOtherAccountMetadataIfAlias_(viewSpecification.hide_metadata_if_alias_used)
|
||||
description_(viewSpecification.description)
|
||||
isPublic_(viewSpecification.is_public)
|
||||
isFirehose_(viewSpecification.is_firehose.getOrElse(false))
|
||||
metadataView_(viewSpecification.metadata_view)
|
||||
|
||||
ViewPermission.resetViewPermissions(
|
||||
this,
|
||||
viewSpecification.allowed_actions,
|
||||
viewSpecification.can_grant_access_to_views.getOrElse(Nil),
|
||||
viewSpecification.can_revoke_access_to_views.getOrElse(Nil)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
def deleteViewPermissions = {
|
||||
ViewPermission.findViewPermissions(this).map(_.delete_!)
|
||||
}
|
||||
|
||||
|
||||
@ -482,131 +424,27 @@ class ViewDefinition extends View with LongKeyedMapper[ViewDefinition] with Many
|
||||
def usePublicAliasIfOneExists: Boolean = usePublicAliasIfOneExists_.get
|
||||
def hideOtherAccountMetadataIfAlias: Boolean = hideOtherAccountMetadataIfAlias_.get
|
||||
|
||||
//This current view can grant access to other views.
|
||||
override def allowed_actions : List[String] = ViewPermission.findViewPermissions(this).map(_.permission.get).distinct
|
||||
|
||||
override def canGrantAccessToViews : Option[List[String]] = {
|
||||
canGrantAccessToViews_.get == null || canGrantAccessToViews_.get.isEmpty() match {
|
||||
case true => None
|
||||
case _ => Some(canGrantAccessToViews_.get.split(",").toList.map(_.trim))
|
||||
}
|
||||
ViewPermission.findViewPermission(this, CAN_GRANT_ACCESS_TO_VIEWS).flatMap(vp =>
|
||||
{
|
||||
vp.extraData.get match {
|
||||
case value if(value != null && !value.isEmpty) => Some(value.split(",").toList.map(_.trim))
|
||||
case _ => None
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
def canGrantAccessToCustomViews : Boolean = canGrantAccessToCustomViews_.get
|
||||
|
||||
//the current view can revoke access to other views.
|
||||
override def canRevokeAccessToViews : Option[List[String]] = {
|
||||
canRevokeAccessToViews_.get == null || canRevokeAccessToViews_.get.isEmpty() match {
|
||||
case true => None
|
||||
case _ => Some(canRevokeAccessToViews_.get.split(",").toList.map(_.trim))
|
||||
}
|
||||
ViewPermission.findViewPermission(this, CAN_REVOKE_ACCESS_TO_VIEWS).flatMap(vp =>
|
||||
{
|
||||
vp.extraData.get match {
|
||||
case value if(value != null && !value.isEmpty) => Some(value.split(",").toList.map(_.trim))
|
||||
case _ => None
|
||||
}
|
||||
})
|
||||
}
|
||||
override def canRevokeAccessToCustomViews : Boolean = canRevokeAccessToCustomViews_.get
|
||||
|
||||
//reading access
|
||||
|
||||
//transaction fields
|
||||
def canSeeTransactionThisBankAccount : Boolean = canSeeTransactionThisBankAccount_.get
|
||||
def canSeeTransactionRequests : Boolean = canSeeTransactionRequests_.get
|
||||
def canSeeTransactionRequestTypes: Boolean = canSeeTransactionRequestTypes_.get
|
||||
def canSeeTransactionOtherBankAccount : Boolean = canSeeTransactionOtherBankAccount_.get
|
||||
def canSeeTransactionMetadata : Boolean = canSeeTransactionMetadata_.get
|
||||
def canSeeTransactionDescription: Boolean = canSeeTransactionDescription_.get
|
||||
def canSeeTransactionAmount: Boolean = canSeeTransactionAmount_.get
|
||||
def canSeeTransactionType: Boolean = canSeeTransactionType_.get
|
||||
def canSeeTransactionCurrency: Boolean = canSeeTransactionCurrency_.get
|
||||
def canSeeTransactionStartDate: Boolean = canSeeTransactionStartDate_.get
|
||||
def canSeeTransactionFinishDate: Boolean = canSeeTransactionFinishDate_.get
|
||||
def canSeeTransactionBalance: Boolean = canSeeTransactionBalance_.get
|
||||
def canSeeTransactionStatus: Boolean = canSeeTransactionStatus_.get
|
||||
|
||||
//transaction metadata
|
||||
def canSeeComments: Boolean = canSeeComments_.get
|
||||
def canSeeOwnerComment: Boolean = canSeeOwnerComment_.get
|
||||
def canSeeTags : Boolean = canSeeTags_.get
|
||||
def canSeeImages : Boolean = canSeeImages_.get
|
||||
|
||||
//Bank account fields
|
||||
def canSeeAvailableViewsForBankAccount : Boolean = canSeeAvailableViewsForBankAccount_.get
|
||||
def canSeeBankAccountOwners : Boolean = canSeeBankAccountOwners_.get
|
||||
def canSeeBankAccountType : Boolean = canSeeBankAccountType_.get
|
||||
def canSeeBankAccountBalance : Boolean = canSeeBankAccountBalance_.get
|
||||
def canSeeBankAccountCurrency : Boolean = canSeeBankAccountCurrency_.get
|
||||
def canQueryAvailableFunds : Boolean = canQueryAvailableFunds_.get
|
||||
def canSeeBankAccountLabel : Boolean = canSeeBankAccountLabel_.get
|
||||
def canUpdateBankAccountLabel : Boolean = canUpdateBankAccountLabel_.get
|
||||
def canSeeBankAccountNationalIdentifier : Boolean = canSeeBankAccountNationalIdentifier_.get
|
||||
def canSeeBankAccountSwift_bic : Boolean = canSeeBankAccountSwift_bic_.get
|
||||
def canSeeBankAccountIban : Boolean = canSeeBankAccountIban_.get
|
||||
def canSeeBankAccountNumber : Boolean = canSeeBankAccountNumber_.get
|
||||
def canSeeBankAccountBankName : Boolean = canSeeBankAccountBankName_.get
|
||||
def canSeeBankAccountBankPermalink : Boolean = canSeeBankAccountBankPermalink_.get
|
||||
def canSeeBankRoutingScheme : Boolean = canSeeBankRoutingScheme_.get
|
||||
def canSeeBankRoutingAddress : Boolean = canSeeBankRoutingAddress_.get
|
||||
def canSeeBankAccountRoutingScheme : Boolean = canSeeBankAccountRoutingScheme_.get
|
||||
def canSeeBankAccountRoutingAddress : Boolean = canSeeBankAccountRoutingAddress_.get
|
||||
def canSeeViewsWithPermissionsForOneUser: Boolean = canSeeViewsWithPermissionsForOneUser_.get
|
||||
def canSeeViewsWithPermissionsForAllUsers : Boolean = canSeeViewsWithPermissionsForAllUsers_.get
|
||||
|
||||
//other bank account fields
|
||||
def canSeeOtherAccountNationalIdentifier : Boolean = canSeeOtherAccountNationalIdentifier_.get
|
||||
def canSeeOtherAccountSWIFT_BIC : Boolean = canSeeOtherAccountSWIFT_BIC_.get
|
||||
def canSeeOtherAccountIBAN : Boolean = canSeeOtherAccountIBAN_.get
|
||||
def canSeeOtherAccountBankName : Boolean = canSeeOtherAccountBankName_.get
|
||||
def canSeeOtherAccountNumber : Boolean = canSeeOtherAccountNumber_.get
|
||||
def canSeeOtherAccountMetadata : Boolean = canSeeOtherAccountMetadata_.get
|
||||
def canSeeOtherAccountKind : Boolean = canSeeOtherAccountKind_.get
|
||||
def canSeeOtherBankRoutingScheme : Boolean = canSeeOtherBankRoutingScheme_.get
|
||||
def canSeeOtherBankRoutingAddress : Boolean = canSeeOtherBankRoutingAddress_.get
|
||||
def canSeeOtherAccountRoutingScheme : Boolean = canSeeOtherAccountRoutingScheme_.get
|
||||
def canSeeOtherAccountRoutingAddress : Boolean = canSeeOtherAccountRoutingAddress_.get
|
||||
|
||||
//other bank account meta data
|
||||
def canSeeMoreInfo: Boolean = canSeeMoreInfo_.get
|
||||
def canSeeUrl: Boolean = canSeeUrl_.get
|
||||
def canSeeImageUrl: Boolean = canSeeImageUrl_.get
|
||||
def canSeeOpenCorporatesUrl: Boolean = canSeeOpenCorporatesUrl_.get
|
||||
def canSeeCorporateLocation : Boolean = canSeeCorporateLocation_.get
|
||||
def canSeePhysicalLocation : Boolean = canSeePhysicalLocation_.get
|
||||
def canSeePublicAlias : Boolean = canSeePublicAlias_.get
|
||||
def canSeePrivateAlias : Boolean = canSeePrivateAlias_.get
|
||||
def canAddMoreInfo : Boolean = canAddMoreInfo_.get
|
||||
def canAddURL : Boolean = canAddURL_.get
|
||||
def canAddImageURL : Boolean = canAddImageURL_.get
|
||||
def canAddOpenCorporatesUrl : Boolean = canAddOpenCorporatesUrl_.get
|
||||
def canAddCorporateLocation : Boolean = canAddCorporateLocation_.get
|
||||
def canAddPhysicalLocation : Boolean = canAddPhysicalLocation_.get
|
||||
def canAddPublicAlias : Boolean = canAddPublicAlias_.get
|
||||
def canAddPrivateAlias : Boolean = canAddPrivateAlias_.get
|
||||
def canAddCounterparty : Boolean = canAddCounterparty_.get
|
||||
def canGetCounterparty : Boolean = canGetCounterparty_.get
|
||||
def canDeleteCounterparty : Boolean = canDeleteCounterparty_.get
|
||||
def canDeleteCorporateLocation : Boolean = canDeleteCorporateLocation_.get
|
||||
def canDeletePhysicalLocation : Boolean = canDeletePhysicalLocation_.get
|
||||
|
||||
//writing access
|
||||
def canEditOwnerComment: Boolean = canEditOwnerComment_.get
|
||||
def canAddComment : Boolean = canAddComment_.get
|
||||
def canDeleteComment: Boolean = canDeleteComment_.get
|
||||
def canAddTag : Boolean = canAddTag_.get
|
||||
def canDeleteTag : Boolean = canDeleteTag_.get
|
||||
def canAddImage : Boolean = canAddImage_.get
|
||||
def canDeleteImage : Boolean = canDeleteImage_.get
|
||||
def canAddWhereTag : Boolean = canAddWhereTag_.get
|
||||
def canSeeWhereTag : Boolean = canSeeWhereTag_.get
|
||||
def canDeleteWhereTag : Boolean = canDeleteWhereTag_.get
|
||||
|
||||
def canAddTransactionRequestToOwnAccount: Boolean = false //we do not need this field, set this to false.
|
||||
def canAddTransactionRequestToAnyAccount: Boolean = canAddTransactionRequestToAnyAccount_.get
|
||||
def canAddTransactionRequestToBeneficiary: Boolean = canAddTransactionRequestToBeneficiary_.get
|
||||
def canSeeBankAccountCreditLimit: Boolean = canSeeBankAccountCreditLimit_.get
|
||||
|
||||
def canCreateDirectDebit: Boolean = canCreateDirectDebit_.get
|
||||
def canCreateStandingOrder: Boolean = canCreateStandingOrder_.get
|
||||
def canCreateCustomView: Boolean = canCreateCustomView_.get
|
||||
def canDeleteCustomView: Boolean = canDeleteCustomView_.get
|
||||
def canUpdateCustomView: Boolean = canUpdateCustomView_.get
|
||||
def canGetCustomView: Boolean = canGetCustomView_.get
|
||||
//TODO: if you add new permissions here, remember to set them wherever views are created
|
||||
// (e.g. BankAccountCreationDispatcher)
|
||||
}
|
||||
|
||||
object ViewDefinition extends ViewDefinition with LongKeyedMetaMapper[ViewDefinition] {
|
||||
|
||||
@ -1,21 +1,27 @@
|
||||
package code.views.system
|
||||
|
||||
import code.api.Constant.{CAN_GRANT_ACCESS_TO_VIEWS, CAN_REVOKE_ACCESS_TO_VIEWS}
|
||||
import code.util.UUIDString
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.Box
|
||||
import net.liftweb.common.Box.tryo
|
||||
import net.liftweb.mapper._
|
||||
|
||||
|
||||
class ViewPermission extends LongKeyedMapper[ViewPermission] with IdPK with CreatedUpdated {
|
||||
def getSingleton = ViewPermission
|
||||
object bank_id extends MappedString(this, 255)
|
||||
object account_id extends MappedString(this, 255)
|
||||
object view_id extends UUIDString(this)
|
||||
object permission extends MappedString(this, 255)
|
||||
|
||||
//this is for special permissions like CAN_REVOKE_ACCESS_TO_VIEWS and CAN_GRANT_ACCESS_TO_VIEWS, it will be a list of view ids ,
|
||||
// eg: owner,auditor,accountant,firehose,standard,StageOne,ManageCustomViews,ReadAccountsBasic
|
||||
object extraData extends MappedString(this, 1024)
|
||||
}
|
||||
object ViewPermission extends ViewPermission with LongKeyedMetaMapper[ViewPermission] {
|
||||
override def dbIndexes: List[BaseIndex[ViewPermission]] = UniqueIndex(bank_id, account_id, view_id, permission) :: super.dbIndexes
|
||||
// "ReadAccountsBerlinGroup"
|
||||
|
||||
|
||||
//Work in progress
|
||||
def findCustomViewPermissions(bankId: BankId, accountId: AccountId, viewId: ViewId): List[ViewPermission] =
|
||||
ViewPermission.findAll(
|
||||
By(ViewPermission.bank_id, bankId.value),
|
||||
@ -23,11 +29,113 @@ object ViewPermission extends ViewPermission with LongKeyedMetaMapper[ViewPermis
|
||||
By(ViewPermission.view_id, viewId.value)
|
||||
)
|
||||
|
||||
//Work in progress
|
||||
def findSystemViewPermissions(viewId: ViewId): List[ViewPermission] =
|
||||
ViewPermission.findAll(
|
||||
NullRef(ViewPermission.bank_id),
|
||||
NullRef(ViewPermission.account_id),
|
||||
By(ViewPermission.view_id, viewId.value)
|
||||
)
|
||||
|
||||
def findCustomViewPermission(bankId: BankId, accountId: AccountId, viewId: ViewId, permission: String): Box[ViewPermission] =
|
||||
ViewPermission.find(
|
||||
By(ViewPermission.bank_id, bankId.value),
|
||||
By(ViewPermission.account_id, accountId.value),
|
||||
By(ViewPermission.view_id, viewId.value),
|
||||
By(ViewPermission.permission,permission)
|
||||
)
|
||||
|
||||
def findSystemViewPermission(viewId: ViewId, permission: String): Box[ViewPermission] =
|
||||
ViewPermission.find(
|
||||
NullRef(ViewPermission.bank_id),
|
||||
NullRef(ViewPermission.account_id),
|
||||
By(ViewPermission.view_id, viewId.value),
|
||||
By(ViewPermission.permission,permission),
|
||||
)
|
||||
|
||||
def createSystemViewPermission(viewId: ViewId, permissionName: String, extraData: Option[List[String]]): Box[ViewPermission] = {
|
||||
tryo {
|
||||
ViewPermission.create
|
||||
.bank_id(null)
|
||||
.account_id(null)
|
||||
.view_id(viewId.value)
|
||||
.permission(permissionName)
|
||||
.extraData(extraData.map(_.mkString(",")).getOrElse(null))
|
||||
.saveMe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the permissions for a given view, if it is sytem view,
|
||||
* it will search in system view permission, otherwise it will search in custom view permissions.
|
||||
* @param view
|
||||
* @return
|
||||
*/
|
||||
def findViewPermissions(view: View): List[ViewPermission] =
|
||||
if(view.isSystem) {
|
||||
findSystemViewPermissions(view.viewId)
|
||||
} else {
|
||||
findCustomViewPermissions(view.bankId, view.accountId, view.viewId)
|
||||
}
|
||||
|
||||
def findViewPermission(view: View, permission: String): Box[ViewPermission] =
|
||||
if(view.isSystem) {
|
||||
findSystemViewPermission(view.viewId, permission)
|
||||
} else {
|
||||
findCustomViewPermission(view.bankId, view.accountId, view.viewId, permission)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method first removes all existing permissions for the given view,
|
||||
* then creates new ones based on the provided parameters.
|
||||
*
|
||||
* This follows the original logic from ViewDefinition, where permission updates
|
||||
* were only supported in bulk (all at once). In the future, we may extend this
|
||||
* to support updating individual permissions selectively.
|
||||
*/
|
||||
def resetViewPermissions(
|
||||
view: View,
|
||||
permissionNames: List[String],
|
||||
canGrantAccessToViews: List[String] = Nil,
|
||||
canRevokeAccessToViews: List[String] = Nil
|
||||
): Unit = {
|
||||
|
||||
// Delete all existing permissions for this view
|
||||
ViewPermission.findViewPermissions(view).foreach(_.delete_!)
|
||||
|
||||
val (bankId, accountId) =
|
||||
if (view.isSystem)
|
||||
(null, null)
|
||||
else
|
||||
(view.bankId.value, view.accountId.value)
|
||||
|
||||
// Insert each new permission
|
||||
permissionNames.foreach { permissionName =>
|
||||
val extraData = permissionName match {
|
||||
case CAN_GRANT_ACCESS_TO_VIEWS => canGrantAccessToViews.mkString(",")
|
||||
case CAN_REVOKE_ACCESS_TO_VIEWS => canRevokeAccessToViews.mkString(",")
|
||||
case _ => null
|
||||
}
|
||||
|
||||
// Dynamically build correct query conditions with NullRef if needed
|
||||
val conditions: Seq[QueryParam[ViewPermission]] = Seq(
|
||||
if (bankId == null) NullRef(ViewPermission.bank_id) else By(ViewPermission.bank_id, bankId),
|
||||
if (accountId == null) NullRef(ViewPermission.account_id) else By(ViewPermission.account_id, accountId),
|
||||
By(ViewPermission.view_id, view.viewId.value),
|
||||
By(ViewPermission.permission, permissionName)
|
||||
)
|
||||
|
||||
// Remove existing conflicting record if any
|
||||
ViewPermission.find(conditions: _*).foreach(_.delete_!)
|
||||
|
||||
// Insert new permission
|
||||
ViewPermission.create
|
||||
.bank_id(bankId)
|
||||
.account_id(accountId)
|
||||
.view_id(view.viewId.value)
|
||||
.permission(permissionName)
|
||||
.extraData(extraData)
|
||||
.save
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
update
|
||||
viewimpl
|
||||
viewdefinition
|
||||
set
|
||||
isFirehose_ = TRUE
|
||||
where
|
||||
|
||||
@ -41,8 +41,6 @@ where
|
||||
drop view v_auth_user_resource_user cascade;
|
||||
create or replace view v_auth_user_resource_user as select au.username from v_auth_user au, v_resource_user ru where au.numeric_auth_user_id = ru.numeric_resource_user_id;
|
||||
|
||||
create or replace view v_view as select bankpermalink bank_id, accountpermalink account_id, permalink_ view_id, description_ description from viewimpl;
|
||||
|
||||
create or replace view v_entitlement as select mentitlementid entitlement_id, muserid resource_user_id, mbankid bank_id, mrolename role_name, id numeric_entitlement_id, createdat created_at, updatedat updated_id from mappedentitlement;
|
||||
|
||||
create or replace view v_account_holder as select accountbankpermalink bank_id, accountpermalink account_id, user_c resource_user_id, id internal_id from mappedaccountholder;
|
||||
@ -58,8 +56,6 @@ create or replace view v_transaction_narrative as select id numeric_transaciton_
|
||||
|
||||
create or replace view v_transaction_comment as select id numeric_transaciton_comment_id, bank bank_id, account account_id, transaction_c transaction_id, text_ comment_text, createdat created_at, apiid resource_user_id from mappedcomment;
|
||||
|
||||
create or replace view v_view_privilege as select id numeric_view_privilege_id, user_c numeric_resource_user_id, view_c numeric_view_id from viewprivileges;
|
||||
|
||||
create or replace view v_transaction_request_type_charge as select id, mbankid bank_id, mtransactionrequesttypeid transaction_request_type_id, mchargecurrency currency , mchargeamount amount, mchargesummary summary from mappedtransactionrequesttypecharge;
|
||||
|
||||
-- In case when we can create a customer at OBP-API side but we get it from CBS(core banking system)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -26,12 +26,13 @@ TESOBE (http://www.tesobe.com/)
|
||||
*/
|
||||
package code.api.v1_2_1
|
||||
|
||||
import code.api.Constant._
|
||||
import _root_.net.liftweb.json.Serialization.write
|
||||
import code.api.Constant._
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.util.APIUtil.isValidSystemViewId
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.bankconnectors.Connector
|
||||
import code.setup.{APIResponse, DefaultUsers, PrivateUser2AccountsAndSetUpWithTestData, ServerSetupWithTestData}
|
||||
import code.views.Views
|
||||
@ -39,7 +40,6 @@ import com.openbankproject.commons.model._
|
||||
import net.liftweb.json._
|
||||
import net.liftweb.util.Helpers._
|
||||
import org.scalatest.Tag
|
||||
import code.api.util.ErrorMessages._
|
||||
|
||||
import scala.util.Random._
|
||||
|
||||
@ -48,25 +48,65 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
def v1_2_1Request = baseRequest / "obp" / "v1.2.1"
|
||||
|
||||
val viewFields = List(
|
||||
"can_see_transaction_this_bank_account","can_see_transaction_other_bank_account",
|
||||
"can_see_transaction_metadata","can_see_transaction_label","can_see_transaction_amount",
|
||||
"can_see_transaction_type","can_see_transaction_currency","can_see_transaction_start_date",
|
||||
"can_see_transaction_finish_date","can_see_transaction_balance","can_see_comments",
|
||||
"can_see_narrative","can_see_tags","can_see_images","can_see_bank_account_owners",
|
||||
"can_see_bank_account_type","can_see_bank_account_balance","can_see_bank_account_currency",
|
||||
"can_see_bank_account_label","can_see_bank_account_national_identifier",
|
||||
"can_see_bank_account_swift_bic","can_see_bank_account_iban","can_see_bank_account_number",
|
||||
"can_see_bank_account_bank_name","can_see_other_account_national_identifier",
|
||||
"can_see_other_account_swift_bic","can_see_other_account_iban",
|
||||
"can_see_other_account_bank_name","can_see_other_account_number",
|
||||
"can_see_other_account_metadata","can_see_other_account_kind","can_see_more_info",
|
||||
"can_see_url","can_see_image_url","can_see_open_corporates_url","can_see_corporate_location",
|
||||
"can_see_physical_location","can_see_public_alias","can_see_private_alias","can_add_more_info",
|
||||
"can_add_url","can_add_image_url","can_add_open_corporates_url","can_add_corporate_location",
|
||||
"can_add_physical_location","can_add_public_alias","can_add_private_alias",
|
||||
"can_delete_corporate_location","can_delete_physical_location","can_edit_narrative",
|
||||
"can_add_comment","can_delete_comment","can_add_tag","can_delete_tag","can_add_image",
|
||||
"can_delete_image","can_add_where_tag","can_see_where_tag","can_delete_where_tag"
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_DESCRIPTION,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_OWNER_COMMENT,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG
|
||||
)
|
||||
|
||||
/************************* test tags ************************/
|
||||
@ -2017,8 +2057,10 @@ class API1_2_1Test extends ServerSetupWithTestData with DefaultUsers with Privat
|
||||
val viewId = SYSTEM_OWNER_VIEW_ID
|
||||
val userId1 = resourceUser2.idGivenByProvider
|
||||
val userId2 = resourceUser2.idGivenByProvider
|
||||
grantUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1)
|
||||
grantUserAccessToView(bankId, bankAccount.id, userId2, viewId, user1)
|
||||
val replyGrant1 = grantUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1)
|
||||
replyGrant1.code should equal (201)
|
||||
val replyGrant2 = grantUserAccessToView(bankId, bankAccount.id, userId2, viewId, user1)
|
||||
replyGrant2.code should equal (201)
|
||||
val viewsBefore = getUserAccountPermission(bankId, bankAccount.id, userId1, user1).body.extract[ViewsJSONV121].views.length
|
||||
When("the request is sent")
|
||||
val reply = revokeUserAccessToView(bankId, bankAccount.id, userId1, viewId, user1)
|
||||
|
||||
@ -51,7 +51,7 @@ class ObpApiLoopbackTest extends V310ServerSetup {
|
||||
val response310 = makeGetRequest(request310)
|
||||
Then("We should get a 400")
|
||||
response310.code should equal(400)
|
||||
val connectorVersion = code.api.Constant.Connector.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
val connectorVersion = code.api.Constant.CONNECTOR.openOrThrowException(s"$MandatoryPropertyIsNotSet The missing props is 'connector'")
|
||||
val errorMessage = s"${NotImplemented}"
|
||||
And("error should be " + errorMessage)
|
||||
response310.body.extract[ErrorMessage].message should equal (errorMessage)
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
package code.api.v5_1_0
|
||||
|
||||
import _root_.net.liftweb.json.Serialization.write
|
||||
import code.api.ResourceDocs1_4_0.SwaggerDefinitionsJSON._
|
||||
import code.api.util.APIUtil
|
||||
import code.api.util.APIUtil.OAuth._
|
||||
import code.api.util.ErrorMessages.{UserHasMissingRoles, UserNotLoggedIn}
|
||||
import code.entitlement.Entitlement
|
||||
import code.setup.APIResponse
|
||||
import com.openbankproject.commons.model.ErrorMessage
|
||||
import com.openbankproject.commons.util.ApiVersion
|
||||
import org.scalatest.Tag
|
||||
|
||||
class SystemViewsPermissionsTests extends V510ServerSetup {
|
||||
object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString)
|
||||
object ApiEndpoint1 extends Tag("addSystemViewPermission")
|
||||
object ApiEndpoint2 extends Tag("deleteSystemViewPermission")
|
||||
|
||||
def postSystemViewPermission(viewId: String, body: CreateViewPermissionJson, consumerAndToken: Option[(Consumer, Token)]): APIResponse = {
|
||||
val request = (v5_1_0_Request / "system-views" / viewId / "permissions").POST <@(consumerAndToken)
|
||||
makePostRequest(request, write(body))
|
||||
}
|
||||
|
||||
def deleteSystemViewPermission(viewId: String, permissionName: String, consumerAndToken: Option[(Consumer, Token)]): APIResponse = {
|
||||
val request = (v5_1_0_Request / "system-views" / viewId / "permissions" / permissionName).DELETE <@(consumerAndToken)
|
||||
makeDeleteRequest(request)
|
||||
}
|
||||
|
||||
def createSystemView(viewId: String): Boolean = {
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanCreateSystemView")
|
||||
val postBody = createSystemViewJsonV500.copy(name = viewId).copy(metadata_view = viewId).toCreateViewJson
|
||||
val response = {
|
||||
val request = (v5_1_0_Request / "system-views").POST <@(user1)
|
||||
makePostRequest(request, write(postBody))
|
||||
}
|
||||
response.code == 201
|
||||
}
|
||||
|
||||
feature(s"test $ApiEndpoint1 version $VersionOfApi - Add Permission to a System View") {
|
||||
scenario("Unauthorized access", ApiEndpoint1, VersionOfApi) {
|
||||
val response = postSystemViewPermission("some-id", CreateViewPermissionJson("can_grant_access_to_views", None), None)
|
||||
response.code should equal(401)
|
||||
response.body.extract[ErrorMessage].message should equal(UserNotLoggedIn)
|
||||
}
|
||||
|
||||
scenario("Authorized without role", ApiEndpoint1, VersionOfApi) {
|
||||
val response = postSystemViewPermission("some-id", CreateViewPermissionJson("can_grant_access_to_views", None), user1)
|
||||
response.code should equal(403)
|
||||
response.body.extract[ErrorMessage].message contains(UserHasMissingRoles + "CanCreateSystemViewPermission") shouldBe (true)
|
||||
}
|
||||
|
||||
scenario("Authorized with proper Role", ApiEndpoint1, VersionOfApi) {
|
||||
val viewId = APIUtil.generateUUID()
|
||||
createSystemView(viewId)
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanCreateSystemViewPermission")
|
||||
val permissionJson = CreateViewPermissionJson("can_grant_access_to_views", None)
|
||||
val response = postSystemViewPermission(viewId, permissionJson, user1)
|
||||
response.code should equal(201)
|
||||
response.body.extract[ViewPermissionJson]
|
||||
}
|
||||
}
|
||||
|
||||
feature(s"test $ApiEndpoint2 version $VersionOfApi - Delete Permission from a System View") {
|
||||
scenario("Unauthorized access", ApiEndpoint2, VersionOfApi) {
|
||||
val response = deleteSystemViewPermission("some-id", "can_grant_access_to_views", None)
|
||||
response.code should equal(401)
|
||||
response.body.extract[ErrorMessage].message contains(UserNotLoggedIn) shouldBe (true)
|
||||
}
|
||||
|
||||
scenario("Authorized without role", ApiEndpoint2, VersionOfApi) {
|
||||
val response = deleteSystemViewPermission("some-id", "can_grant_access_to_views", user1)
|
||||
response.code should equal(403)
|
||||
response.body.extract[ErrorMessage].message contains(UserHasMissingRoles + "CanDeleteSystemViewPermission") shouldBe (true)
|
||||
}
|
||||
|
||||
scenario("Authorized with proper Role", ApiEndpoint2, VersionOfApi) {
|
||||
val viewId = APIUtil.generateUUID()
|
||||
createSystemView(viewId)
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanCreateSystemViewPermission")
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanDeleteSystemViewPermission")
|
||||
|
||||
val permissionJson = CreateViewPermissionJson("can_grant_access_to_views", None)
|
||||
val createResp = postSystemViewPermission(viewId, permissionJson, user1)
|
||||
createResp.code should equal(201)
|
||||
|
||||
val deleteResp = deleteSystemViewPermission(viewId, "can_grant_access_to_views", user1)
|
||||
deleteResp.code should equal(204)
|
||||
}
|
||||
scenario("Authorized with proper Role with extra_data", ApiEndpoint2, VersionOfApi) {
|
||||
val viewId = APIUtil.generateUUID()
|
||||
createSystemView(viewId)
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanCreateSystemViewPermission")
|
||||
Entitlement.entitlement.vend.addEntitlement("", resourceUser1.userId, "CanDeleteSystemViewPermission")
|
||||
|
||||
val permissionJson = CreateViewPermissionJson("can_grant_access_to_views", Some(List("owner")))
|
||||
val createResp = postSystemViewPermission(viewId, permissionJson, user1)
|
||||
createResp.code should equal(201)
|
||||
createResp.body.extract[CreateViewPermissionJson].permission_name should equal("can_grant_access_to_views")
|
||||
createResp.body.extract[CreateViewPermissionJson].extra_data should equal (Some(List("owner")))
|
||||
|
||||
val deleteResp = deleteSystemViewPermission(viewId, "can_grant_access_to_views", user1)
|
||||
deleteResp.code should equal(204)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,25 +2,96 @@ package code.setup
|
||||
|
||||
import bootstrap.liftweb.ToSchemify
|
||||
import code.accountholders.AccountHolders
|
||||
import code.api.Constant.{CUSTOM_PUBLIC_VIEW_ID, SYSTEM_OWNER_VIEW_ID}
|
||||
import code.api.Constant._
|
||||
import code.api.util.APIUtil.isValidCustomViewName
|
||||
import code.api.util.ErrorMessages._
|
||||
import code.model._
|
||||
import code.model.dataAccess._
|
||||
import code.views.MapperViews.getExistingCustomView
|
||||
import code.views.system.ViewDefinition
|
||||
import code.views.system.{ViewDefinition, ViewPermission}
|
||||
import code.views.{MapperViews, Views}
|
||||
import com.openbankproject.commons.model._
|
||||
import net.liftweb.common.{Failure, Full, ParamFailure}
|
||||
import net.liftweb.mapper.MetaMapper
|
||||
import net.liftweb.util.Helpers._
|
||||
|
||||
/**
|
||||
* Handles setting up views and permissions and account holders using ViewImpls, ViewPrivileges,
|
||||
* and MappedAccountHolder
|
||||
*/
|
||||
|
||||
trait TestConnectorSetupWithStandardPermissions extends TestConnectorSetup {
|
||||
|
||||
final val SYSTEM_CUSTOM_VIEW_PERMISSION_TEST = List(
|
||||
CAN_SEE_TRANSACTION_THIS_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_OTHER_BANK_ACCOUNT,
|
||||
CAN_SEE_TRANSACTION_METADATA,
|
||||
CAN_SEE_TRANSACTION_DESCRIPTION,
|
||||
CAN_SEE_TRANSACTION_AMOUNT,
|
||||
CAN_SEE_TRANSACTION_TYPE,
|
||||
CAN_SEE_TRANSACTION_CURRENCY,
|
||||
CAN_SEE_TRANSACTION_START_DATE,
|
||||
CAN_SEE_TRANSACTION_FINISH_DATE,
|
||||
CAN_SEE_TRANSACTION_BALANCE,
|
||||
CAN_SEE_COMMENTS,
|
||||
CAN_SEE_OWNER_COMMENT,
|
||||
CAN_SEE_TAGS,
|
||||
CAN_SEE_IMAGES,
|
||||
CAN_SEE_BANK_ACCOUNT_OWNERS,
|
||||
CAN_SEE_BANK_ACCOUNT_TYPE,
|
||||
CAN_SEE_BANK_ACCOUNT_BALANCE,
|
||||
CAN_SEE_BANK_ACCOUNT_CURRENCY,
|
||||
CAN_SEE_BANK_ACCOUNT_LABEL,
|
||||
CAN_SEE_BANK_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_BANK_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_BANK_ACCOUNT_IBAN,
|
||||
CAN_SEE_BANK_ACCOUNT_NUMBER,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_BANK_ACCOUNT_BANK_PERMALINK,
|
||||
CAN_SEE_OTHER_ACCOUNT_NATIONAL_IDENTIFIER,
|
||||
CAN_SEE_OTHER_ACCOUNT_SWIFT_BIC,
|
||||
CAN_SEE_OTHER_ACCOUNT_IBAN,
|
||||
CAN_SEE_OTHER_ACCOUNT_BANK_NAME,
|
||||
CAN_SEE_OTHER_ACCOUNT_NUMBER,
|
||||
CAN_SEE_OTHER_ACCOUNT_METADATA,
|
||||
CAN_SEE_OTHER_ACCOUNT_KIND,
|
||||
CAN_SEE_MORE_INFO,
|
||||
CAN_SEE_URL,
|
||||
CAN_SEE_IMAGE_URL,
|
||||
CAN_SEE_OPEN_CORPORATES_URL,
|
||||
CAN_SEE_CORPORATE_LOCATION,
|
||||
CAN_SEE_PHYSICAL_LOCATION,
|
||||
CAN_SEE_PUBLIC_ALIAS,
|
||||
CAN_SEE_PRIVATE_ALIAS,
|
||||
CAN_ADD_MORE_INFO,
|
||||
CAN_ADD_URL,
|
||||
CAN_ADD_IMAGE_URL,
|
||||
CAN_ADD_OPEN_CORPORATES_URL,
|
||||
CAN_ADD_CORPORATE_LOCATION,
|
||||
CAN_ADD_PHYSICAL_LOCATION,
|
||||
CAN_ADD_PUBLIC_ALIAS,
|
||||
CAN_ADD_PRIVATE_ALIAS,
|
||||
CAN_DELETE_CORPORATE_LOCATION,
|
||||
CAN_DELETE_PHYSICAL_LOCATION,
|
||||
CAN_EDIT_OWNER_COMMENT,
|
||||
CAN_ADD_COMMENT,
|
||||
CAN_DELETE_COMMENT,
|
||||
CAN_ADD_TAG,
|
||||
CAN_DELETE_TAG,
|
||||
CAN_ADD_IMAGE,
|
||||
CAN_DELETE_IMAGE,
|
||||
CAN_ADD_WHERE_TAG,
|
||||
CAN_SEE_WHERE_TAG,
|
||||
CAN_DELETE_WHERE_TAG,
|
||||
CAN_SEE_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_BANK_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_BANK_ROUTING_ADDRESS,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_SCHEME,
|
||||
CAN_SEE_OTHER_ACCOUNT_ROUTING_ADDRESS,
|
||||
CAN_SEE_BANK_ACCOUNT_CREDIT_LIMIT,
|
||||
CAN_SEE_TRANSACTION_STATUS
|
||||
)
|
||||
|
||||
|
||||
override protected def setAccountHolder(user: User, bankId : BankId, accountId : AccountId) = {
|
||||
AccountHolders.accountHolders.vend.getOrCreateAccountHolder(user, BankIdAccountId(bankId, accountId))
|
||||
}
|
||||
@ -46,7 +117,7 @@ trait TestConnectorSetupWithStandardPermissions extends TestConnectorSetup {
|
||||
|
||||
getExistingCustomView(bankId, accountId, viewId) match {
|
||||
case net.liftweb.common.Empty => {
|
||||
tryo {
|
||||
val view = tryo {
|
||||
ViewDefinition.create.
|
||||
isSystem_(false).
|
||||
isFirehose_(false).
|
||||
@ -60,81 +131,14 @@ trait TestConnectorSetupWithStandardPermissions extends TestConnectorSetup {
|
||||
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).
|
||||
canAddTransactionRequestToBeneficiary_(false).
|
||||
canSeeBankAccountCreditLimit_(true).
|
||||
canSeeTransactionStatus_(true).
|
||||
saveMe
|
||||
}
|
||||
view.map(ViewPermission.resetViewPermissions(
|
||||
_,
|
||||
SYSTEM_CUSTOM_VIEW_PERMISSION_TEST
|
||||
))
|
||||
|
||||
view
|
||||
}
|
||||
case Full(v) => Full(v)
|
||||
case Failure(msg, t, c) => Failure(msg, t, c)
|
||||
|
||||
@ -28,14 +28,11 @@ TESOBE (http://www.tesobe.com/)
|
||||
package code.util
|
||||
|
||||
import code.api.Constant.SYSTEM_OWNER_VIEW_ID
|
||||
import code.api.UKOpenBanking.v2_0_0.{APIMethods_UKOpenBanking_200, OBP_UKOpenBanking_200}
|
||||
import code.api.UKOpenBanking.v3_1_0.{APIMethods_AccountAccessApi, OBP_UKOpenBanking_310}
|
||||
import code.api.UKOpenBanking.v3_1_0.APIMethods_AccountAccessApi
|
||||
import code.api.berlin.group.ConstantsBG
|
||||
import code.api.berlin.group.v1_3.OBP_BERLIN_GROUP_1_3
|
||||
import code.api.builder.AccountInformationServiceAISApi.APIMethods_AccountInformationServiceAISApi
|
||||
import code.api.util.APIUtil.OBPEndpoint
|
||||
import code.api.util._
|
||||
import code.api.v3_1_0.OBPAPI3_1_0
|
||||
import code.api.v4_0_0.OBPAPI4_0_0.Implementations4_0_0
|
||||
import code.api.v4_0_0.{OBPAPI4_0_0, V400ServerSetup}
|
||||
import code.setup.PropsReset
|
||||
@ -191,7 +188,7 @@ class APIUtilHeavyTest extends V400ServerSetup with PropsReset {
|
||||
"can_see_transaction_status"
|
||||
).toSet
|
||||
val systemOwnerView = getOrCreateSystemView(SYSTEM_OWNER_VIEW_ID)
|
||||
val permissions = APIUtil.getViewPermissions(systemOwnerView.asInstanceOf[ViewDefinition])
|
||||
val permissions = systemOwnerView.asInstanceOf[ViewDefinition].allowed_actions.toSet
|
||||
|
||||
subList.subsetOf(permissions)
|
||||
}
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
package code.util
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
import net.liftweb.mapper.Mapper
|
||||
import org.apache.commons.lang3.StringUtils
|
||||
import org.scalatest.Matchers._
|
||||
import org.scalatest.{FeatureSpec, Tag}
|
||||
|
||||
import java.util.regex.Pattern
|
||||
|
||||
/**
|
||||
* Avoid new DB entity type name start with Mapped, and field name start with m.
|
||||
*/
|
||||
@ -88,11 +88,9 @@ class MappedClassNameTest extends FeatureSpec {
|
||||
"code.scope.MappedUserScope",
|
||||
"code.context.MappedUserAuthContext",
|
||||
"code.context.MappedConsentAuthContext",
|
||||
"code.model.dataAccess.ViewImpl",
|
||||
"code.metadata.counterparties.MappedCounterpartyMetadata",
|
||||
"code.transaction_types.MappedTransactionType",
|
||||
"code.examplething.MappedThing",
|
||||
"code.model.dataAccess.ViewPrivileges",
|
||||
"code.scope.MappedScope",
|
||||
"code.ratelimiting.RateLimiting",
|
||||
"code.api.attributedefinition.AttributeDefinition",
|
||||
|
||||
@ -87,103 +87,6 @@ case class UpdateViewJSON(
|
||||
override val can_revoke_access_to_views : Option[List[String]] = None) extends ViewSpecification
|
||||
|
||||
|
||||
|
||||
/** Views moderate access to an Account. That is, they are used to:
|
||||
* 1) Show/hide fields on the account, its transactions and related counterparties
|
||||
* 2) Store/partition meta data - e.g. comments posted on a "team" view are not visible via a "public" view and visa versa.
|
||||
*
|
||||
* Users can be granted access to one or more Views
|
||||
* Each View has a set of entitlements aka permissions which hide / show data fields and enable / disable operations on the account
|
||||
*
|
||||
* @define viewId A short url friendly, (singular) human readable name for the view. e.g. "team", "auditor" or "public". Note: "owner" is a default and reserved name. Other reserved names should include "public", "accountant" and "auditor"
|
||||
* @define accountId The account that the view moderates
|
||||
* @define bankId The bank where the account is held
|
||||
* @define name The name of the view
|
||||
* @define description A description of the view
|
||||
* @define isPublic Set to True if the view should be open to the public (no authorisation required!) Set to False to require authorisation
|
||||
* @define users A list of users that can use this view
|
||||
* @define usePublicAliasIfOneExists If true and the counterparty in a transaction has a public alias set, use it. Else use the raw counterparty name (if both usePublicAliasIfOneExists and usePrivateAliasIfOneExists are true, public alias will be used)
|
||||
* @define usePrivateAliasIfOneExists If true and the counterparty in a transaction has a private alias set, use it. Else use the raw counterparty name (if both usePublicAliasIfOneExists and usePrivateAliasIfOneExists are true, public alias will be used)
|
||||
* @define hideOtherAccountMetadataIfAlias If true, the view will hide counterparty metadata if the counterparty has an alias. This is to preserve anonymity if required.
|
||||
*
|
||||
* @define canSeeTransactionThisBankAccount If true, the view will show information about the Transaction account (this account)
|
||||
* @define canSeeTransactionOtherBankAccount If true, the view will show information about the Transaction counterparty
|
||||
* @define canSeeTransactionMetadata If true, the view will show any Transaction metadata
|
||||
* @define canSeeTransactionDescription If true, the view will show the Transaction description
|
||||
* @define canSeeTransactionAmount If true, the view will show the Transaction amount (value, not currency)
|
||||
* @define canSeeTransactionType If true, the view will show the Transaction type
|
||||
* @define canSeeTransactionCurrency If true, the view will show the Transaction currency (not value)
|
||||
* @define canSeeTransactionStartDate If true, the view will show the Transaction start date
|
||||
* @define canSeeTransactionFinishDate If true, the view will show the Transaction finish date
|
||||
* @define canSeeTransactionBalance If true, the view will show the Transaction balance (after each transaction)
|
||||
*
|
||||
* @define canSeeComments If true, the view will show the Transaction Metadata comments
|
||||
* @define canSeeOwnerComment If true, the view will show the Transaction Metadata owner comment
|
||||
* @define canSeeTags If true, the view will show the Transaction Metadata tags
|
||||
* @define canSeeImages If true, the view will show the Transaction Metadata images
|
||||
|
||||
* @define canSeeBankAccountOwners If true, the view will show the Account owners
|
||||
* @define canSeeBankAccountType If true, the view will show the Account type. The account type is a human friendly financial product name
|
||||
* @define canSeeBankAccountBalance If true, the view will show the Account balance
|
||||
* @define canSeeBankAccountCurrency If true, the view will show the Account currency
|
||||
* @define canSeeBankAccountLabel If true, the view will show the Account label. The label can be edited via the API. It does not come from the core banking system.
|
||||
* @define canSeeBankAccountNationalIdentifier If true, the view will show the national identifier of the bank
|
||||
* @define canSeeBankAccountSwift_bic If true, the view will show the Swift / Bic code of the bank
|
||||
* @define canSeeBankAccountIban If true, the view will show the IBAN
|
||||
* @define canSeeBankAccountNumber If true, the view will show the account number
|
||||
* @define canSeeBankAccountBankName If true, the view will show the bank name
|
||||
* @define canSeeBankRoutingScheme If true, the view will show the BankRoutingScheme
|
||||
* @define canSeeBankRoutingAddress If true, the view will show the BankRoutingAddress
|
||||
* @define canSeeBankAccountRoutingScheme If true, the view will show the BankAccountRoutingScheme
|
||||
* @define canSeeBankAccountRoutingAddress If true, the view will show the BankAccountRoutingAddress
|
||||
|
||||
* @define canSeeOtherAccountNationalIdentifier If true, the view will show the Counterparty bank national identifier
|
||||
* @define canSeeOtherAccountSWIFT_BIC If true, the view will show the Counterparty SWIFT BIC
|
||||
* @define canSeeOtherAccountIBAN If true, the view will show the Counterparty IBAN
|
||||
* @define canSeeOtherAccountBankName If true, the view will show the Counterparty Bank Name
|
||||
* @define canSeeOtherAccountNumber If true, the view will show the Counterparty Account Number
|
||||
* @define canSeeOtherAccountMetadata If true, the view will show the Counterparty Metadata
|
||||
* @define canSeeOtherAccountKind If true, the view will show the Counterparty Account Type. This is unlikely to be a full financial product name.
|
||||
* @define canSeeOtherBankRoutingScheme If true, the view will show the OtherBankRoutingScheme
|
||||
* @define canSeeOtherBankRoutingAddress If true, the view will show the OtherBankRoutingScheme
|
||||
* @define canSeeOtherAccountRoutingScheme If true, the view will show the OtherBankRoutingScheme
|
||||
* @define canSeeOtherAccountRoutingAddress If true, the view will show the OtherBankRoutingScheme
|
||||
|
||||
* @define canSeeMoreInfo If true, the view will show the Counterparty More Info text
|
||||
* @define canSeeUrl If true, the view will show the Counterparty Url
|
||||
* @define canSeeImageUrl If true, the view will show the Counterparty Image Url
|
||||
* @define canSeeOpenCorporatesUrl If true, the view will show the Counterparty OpenCorporatesUrl
|
||||
* @define canSeeCorporateLocation If true, the view will show the Counterparty CorporateLocation
|
||||
* @define canSeePhysicalLocation If true, the view will show the Counterparty PhysicalLocation
|
||||
* @define canSeePublicAlias If true, the view will show the Counterparty PublicAlias
|
||||
* @define canSeePrivateAlias If true, the view will show the Counterparty PrivateAlias
|
||||
*
|
||||
* @define canAddMoreInfo If true, the view can add the Counterparty MoreInfo
|
||||
* @define canAddURL If true, the view can add the Counterparty Url
|
||||
* @define canAddImageURL If true, the view can add the Counterparty Image Url
|
||||
* @define canAddOpenCorporatesUrl If true, the view can add the Counterparty OpenCorporatesUrl
|
||||
* @define canAddCorporateLocation If true, the view can add the Counterparty CorporateLocation
|
||||
* @define canAddPhysicalLocation If true, the view can add the Counterparty PhysicalLocation
|
||||
* @define canAddPublicAlias If true, the view can add the Counterparty PublicAlias
|
||||
* @define canAddPrivateAlias If true, the view can add the Counterparty PrivateAlias
|
||||
* @define canDeleteCorporateLocation If true, the can add show the Counterparty CorporateLocation
|
||||
* @define canDeletePhysicalLocation If true, the can add show the Counterparty PhysicalLocation
|
||||
*
|
||||
* @define canEditOwnerComment If true, the view can edit the Transaction Owner Comment
|
||||
* @define canAddComment If true, the view can add a Transaction Comment
|
||||
* @define canDeleteComment If true, the view can delete a Transaction Comment
|
||||
* @define canAddTag If true, the view can add a Transaction/Account Tag
|
||||
* @define canDeleteTag If true, the view can delete a Transaction/Account Tag
|
||||
* @define canAddImage If true, the view can add a Transaction Image
|
||||
* @define canDeleteImage If true, the view can delete a Transaction Image
|
||||
* @define canAddWhereTag If true, the view can add a Transaction Where Tag
|
||||
* @define canSeeWhereTag If true, the view can show the Transaction Where Tag
|
||||
* @define canDeleteWhereTag If true, the view can delete the Transaction Where Tag
|
||||
|
||||
* @define canAddCounterparty If true, view can add counterparty / create counterparty.
|
||||
|
||||
|
||||
*/
|
||||
trait View {
|
||||
def id: Long
|
||||
|
||||
@ -229,9 +132,9 @@ trait View {
|
||||
//the Value from developer, can be any string value.
|
||||
def description: String
|
||||
|
||||
/** This users is tricky, this use ManyToMany relationship,
|
||||
/** These users are tricky, this use ManyToMany relationship,
|
||||
* 1st: when create view, we need carefully map this view to the owner user.
|
||||
* 2rd: the view can grant the access to any other (not owner) users. eg: Simon's accountant view can grant access to Carola, then Carola can see Simon's accountant data
|
||||
* 2nd: the view can grant the access to any other (not owner) users. eg: Simon's accountant view can grant access to Carola, then Carola can see Simon's accountant data
|
||||
* also look into some createView methods in code, you can understand more:
|
||||
* create1: code.bankconnectors.Connector.createViews
|
||||
* after createViews method, always need call addPermission(v.uid, user). This will create this field
|
||||
@ -249,190 +152,13 @@ trait View {
|
||||
def usePrivateAliasIfOneExists: Boolean
|
||||
|
||||
def hideOtherAccountMetadataIfAlias: Boolean
|
||||
|
||||
/**
|
||||
* These three will get the allowed actions from viewPermission table
|
||||
*/
|
||||
def allowed_actions : List[String]
|
||||
def canGrantAccessToViews : Option[List[String]] = None
|
||||
def canRevokeAccessToViews : Option[List[String]] = None
|
||||
|
||||
def canGrantAccessToCustomViews : Boolean // if this true, we can grant custom views, if it is false, no one can grant custom views.
|
||||
def canRevokeAccessToCustomViews : Boolean // if this true, we can revoke custom views,if it is false, no one can revoke custom views.
|
||||
|
||||
//reading access
|
||||
|
||||
//transaction fields
|
||||
def canSeeTransactionRequests: Boolean
|
||||
|
||||
def canSeeTransactionRequestTypes: Boolean
|
||||
|
||||
def canSeeTransactionThisBankAccount: Boolean
|
||||
|
||||
def canSeeTransactionOtherBankAccount: Boolean
|
||||
|
||||
def canSeeTransactionMetadata: Boolean
|
||||
|
||||
def canSeeTransactionDescription: Boolean
|
||||
|
||||
def canSeeTransactionAmount: Boolean
|
||||
|
||||
def canSeeTransactionType: Boolean
|
||||
|
||||
def canSeeTransactionCurrency: Boolean
|
||||
|
||||
def canSeeTransactionStartDate: Boolean
|
||||
|
||||
def canSeeTransactionFinishDate: Boolean
|
||||
|
||||
def canSeeTransactionBalance: Boolean
|
||||
|
||||
def canSeeTransactionStatus: Boolean
|
||||
|
||||
//transaction metadata
|
||||
def canSeeComments: Boolean
|
||||
|
||||
def canSeeOwnerComment: Boolean
|
||||
|
||||
def canSeeTags: Boolean
|
||||
|
||||
def canSeeImages: Boolean
|
||||
|
||||
//Bank account fields
|
||||
def canSeeAvailableViewsForBankAccount: Boolean
|
||||
|
||||
def canSeeBankAccountOwners: Boolean
|
||||
|
||||
def canSeeBankAccountType: Boolean
|
||||
def canUpdateBankAccountLabel: Boolean
|
||||
|
||||
def canSeeBankAccountBalance: Boolean
|
||||
|
||||
def canQueryAvailableFunds: Boolean
|
||||
|
||||
def canSeeBankAccountCurrency: Boolean
|
||||
|
||||
def canSeeBankAccountLabel: Boolean
|
||||
|
||||
def canSeeBankAccountNationalIdentifier: Boolean
|
||||
|
||||
def canSeeBankAccountSwift_bic: Boolean
|
||||
|
||||
def canSeeBankAccountIban: Boolean
|
||||
|
||||
def canSeeBankAccountNumber: Boolean
|
||||
|
||||
def canSeeBankAccountBankName: Boolean
|
||||
|
||||
def canSeeBankRoutingScheme: Boolean
|
||||
|
||||
def canSeeBankRoutingAddress: Boolean
|
||||
|
||||
def canSeeBankAccountRoutingScheme: Boolean
|
||||
|
||||
def canSeeBankAccountRoutingAddress: Boolean
|
||||
|
||||
def canSeeViewsWithPermissionsForOneUser: Boolean
|
||||
|
||||
def canSeeViewsWithPermissionsForAllUsers: Boolean
|
||||
|
||||
//other bank account (counterparty) fields
|
||||
def canSeeOtherAccountNationalIdentifier: Boolean
|
||||
|
||||
def canSeeOtherAccountSWIFT_BIC: Boolean
|
||||
|
||||
def canSeeOtherAccountIBAN: Boolean
|
||||
|
||||
def canSeeOtherAccountBankName: Boolean
|
||||
|
||||
def canSeeOtherAccountNumber: Boolean
|
||||
|
||||
def canSeeOtherAccountMetadata: Boolean
|
||||
|
||||
def canSeeOtherAccountKind: Boolean
|
||||
|
||||
def canSeeOtherBankRoutingScheme: Boolean
|
||||
|
||||
def canSeeOtherBankRoutingAddress: Boolean
|
||||
|
||||
def canSeeOtherAccountRoutingScheme: Boolean
|
||||
|
||||
def canSeeOtherAccountRoutingAddress: Boolean
|
||||
|
||||
//other bank account meta data - read
|
||||
def canSeeMoreInfo: Boolean
|
||||
|
||||
def canSeeUrl: Boolean
|
||||
|
||||
def canSeeImageUrl: Boolean
|
||||
|
||||
def canSeeOpenCorporatesUrl: Boolean
|
||||
|
||||
def canSeeCorporateLocation: Boolean
|
||||
|
||||
def canSeePhysicalLocation: Boolean
|
||||
|
||||
def canSeePublicAlias: Boolean
|
||||
|
||||
def canSeePrivateAlias: Boolean
|
||||
|
||||
//other bank account (Counterparty) meta data - write
|
||||
def canAddMoreInfo: Boolean
|
||||
|
||||
def canAddURL: Boolean
|
||||
|
||||
def canAddImageURL: Boolean
|
||||
|
||||
def canAddOpenCorporatesUrl: Boolean
|
||||
|
||||
def canAddCorporateLocation: Boolean
|
||||
|
||||
def canAddPhysicalLocation: Boolean
|
||||
|
||||
def canAddPublicAlias: Boolean
|
||||
|
||||
def canAddPrivateAlias: Boolean
|
||||
|
||||
def canAddCounterparty: Boolean
|
||||
|
||||
def canGetCounterparty: Boolean
|
||||
|
||||
def canDeleteCounterparty: Boolean
|
||||
|
||||
def canDeleteCorporateLocation: Boolean
|
||||
|
||||
def canDeletePhysicalLocation: Boolean
|
||||
|
||||
//writing access
|
||||
def canEditOwnerComment: Boolean
|
||||
|
||||
def canAddComment: Boolean
|
||||
|
||||
def canDeleteComment: Boolean
|
||||
|
||||
def canAddTag: Boolean
|
||||
|
||||
def canDeleteTag: Boolean
|
||||
|
||||
def canAddImage: Boolean
|
||||
|
||||
def canDeleteImage: Boolean
|
||||
|
||||
def canAddWhereTag: Boolean
|
||||
|
||||
def canSeeWhereTag: Boolean
|
||||
|
||||
def canDeleteWhereTag: Boolean
|
||||
|
||||
def canAddTransactionRequestToOwnAccount: Boolean //added following two for payments
|
||||
def canAddTransactionRequestToAnyAccount: Boolean
|
||||
def canAddTransactionRequestToBeneficiary: Boolean
|
||||
|
||||
def canSeeBankAccountCreditLimit: Boolean
|
||||
|
||||
def canCreateDirectDebit: Boolean
|
||||
|
||||
def canCreateStandingOrder: Boolean
|
||||
|
||||
//If any view set these to true, you can create/delete/update the custom view
|
||||
def canCreateCustomView: Boolean
|
||||
def canDeleteCustomView: Boolean
|
||||
def canUpdateCustomView: Boolean
|
||||
def canGetCustomView: Boolean
|
||||
def createViewAndPermissions(viewSpecification : ViewSpecification) : Unit
|
||||
def deleteViewPermissions :List[Boolean]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user