Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions obp-api/src/main/scala/bootstrap/liftweb/Boot.scala
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ class Boot extends MdcLoggable {
// Toggle off via routing_schemes.seed_defaults_at_boot=false in environments that don't want defaults.
code.routingscheme.RoutingSchemeSeed.runIfEnabled()

// Report which static Glossary Items the database is currently displacing. A developer editing
// Glossary.scala has no other way to find out that their text is being overridden.
code.api.util.Glossary.logStaticOverrides()

if (APIUtil.getPropsAsBoolValue("create_system_views_at_boot", true)) {
// Create system views
val owner = Views.views.vend.getOrCreateSystemView(SYSTEM_OWNER_VIEW_ID).isDefined
Expand Down Expand Up @@ -1080,6 +1084,7 @@ object ToSchemify extends MdcLoggable {
Organisation,
RoutingScheme,
BankSupportedRoutingScheme,
code.glossaryitem.DynamicGlossaryItem,
PayeeLookup,
UtilityPaymentCallback,
BulkPayment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ object OpenAPI31JSONFactory extends MdcLoggable {

val operation = OperationJson(
summary = Some(doc.summary),
description = Some(doc.description),
description = Some(Glossary.expandGlossaryPlaceholders(doc.description)),
operationId = Some(doc.operation_id),
tags = tags,
parameters = if (parameters.nonEmpty) Some(parameters) else None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ object SwaggerJSONFactory extends MdcLoggable {
OperationObjectJson(
tags = rd.tags,
summary = rd.summary,
description = PegdownOptions.convertPegdownToHtmlTweaked(rd.description.stripMargin).replaceAll("\n", ""),
description = PegdownOptions.convertPegdownToHtmlTweaked(Glossary.expandGlossaryPlaceholders(rd.description.stripMargin)).replaceAll("\n", ""),
operationId = s"${rd.operation_id}",
parameters ={
val description = rd.example_request_body match {
Expand Down
13 changes: 11 additions & 2 deletions obp-api/src/main/scala/code/api/util/APIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1973,8 +1973,13 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
|""".stripMargin
}

/**
* The Glossary as served by GET /api/glossary: the static Glossary Items compiled into
* Glossary.scala, unioned with the Dynamic Glossary Items held in the database. A Dynamic Item
* replaces a static one of the same title.
*/
def getGlossaryItems : List[GlossaryItem] = {
Glossary.glossaryItems.toList.sortBy(_.title)
Glossary.allGlossaryItems.sortBy(_.title)
}

case class MessageDoc(
Expand Down Expand Up @@ -5066,7 +5071,11 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
apiCollectionIdParam: Option[String],
isVersion4OrHigher: Option[Boolean]
) = s"requestedApiVersionString:$requestedApiVersionString-bankId:$bankId-tags:$tags-partialFunctions:$partialFunctions-locale:${locale.toString}" +
s"-contentParam:$contentParam-apiCollectionIdParam:$apiCollectionIdParam-isVersion4OrHigher:$isVersion4OrHigher".intern()
// The Glossary version belongs in the key: endpoint descriptions embed Glossary text, so a
// Dynamic Glossary Item that overrides a static one must not stay masked by a cached document
// for the rest of the resource-doc / swagger TTL. Reading it is an in-memory lookup that
// re-checks the database at most once a second.
s"-contentParam:$contentParam-apiCollectionIdParam:$apiCollectionIdParam-isVersion4OrHigher:$isVersion4OrHigher-glossary:${Glossary.glossaryVersionForCacheKey}".intern()

def getUserLacksRevokePermissionErrorMessage(sourceViewId: ViewId, targetViewId: ViewId) =
if (isValidSystemViewId(targetViewId.value))
Expand Down
8 changes: 8 additions & 0 deletions obp-api/src/main/scala/code/api/util/ApiRole.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,14 @@ object ApiRole extends MdcLoggable{
case class CanReadGlossary(requiresBankId: Boolean = false) extends ApiRole
lazy val canReadGlossary = CanReadGlossary()

// Dynamic Glossary Items are system level, like the static Glossary they are merged into.
case class CanCreateGlossaryItem(requiresBankId: Boolean = false) extends ApiRole
lazy val canCreateGlossaryItem = CanCreateGlossaryItem()
case class CanUpdateGlossaryItem(requiresBankId: Boolean = false) extends ApiRole
lazy val canUpdateGlossaryItem = CanUpdateGlossaryItem()
case class CanDeleteGlossaryItem(requiresBankId: Boolean = false) extends ApiRole
lazy val canDeleteGlossaryItem = CanDeleteGlossaryItem()

case class CanCreateCustomerAttributeDefinitionAtOneBank(requiresBankId: Boolean = true) extends ApiRole
lazy val canCreateCustomerAttributeDefinitionAtOneBank = CanCreateCustomerAttributeDefinitionAtOneBank()

Expand Down
9 changes: 9 additions & 0 deletions obp-api/src/main/scala/code/api/util/ErrorMessages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,15 @@ object ErrorMessages {
val CreateApiProductSubscriptionAttributeError = "OBP-30569: Could not create ApiProductSubscriptionAttribute."
val DeleteApiProductSubscriptionAttributeError = "OBP-30570: Could not delete ApiProductSubscriptionAttribute."

// Dynamic Glossary Item (OBP-30571 .. OBP-30577)
val GlossaryItemNotFound = "OBP-30571: Glossary Item not found. Please specify a valid value for TITLE."
val GlossaryItemAlreadyExists = "OBP-30572: Glossary Item already exists. Please specify a different value for title, or update the existing one."
val InvalidGlossaryItemTitle = "OBP-30573: Invalid Glossary Item title. It must be non empty and at most 255 characters."
val CreateGlossaryItemError = "OBP-30574: Could not create Glossary Item."
val UpdateGlossaryItemError = "OBP-30575: Could not update Glossary Item."
val DeleteGlossaryItemError = "OBP-30576: Could not delete Glossary Item."
val GlossaryItemShadowsStaticItem = "OBP-30577: A static Glossary Item with this title already exists. Creating this item would override it in the Glossary. Set overrides_static_item to true if that is intended, or choose a different title."

val OrganisationNotFound = "OBP-30506: Organisation not found. Please specify a valid value for ORGANISATION_ID."
val OrganisationAlreadyExists = "OBP-30507: Organisation already exists. Please specify a different value for ORGANISATION_ID."
val InvalidOrganisationIdFormat = "OBP-30508: Invalid Organisation Id. The ORGANISATION_ID should only contain 0-9/a-z/A-Z/'-'/'.'/'_', and be between 2 and 64 characters in length."
Expand Down
Loading
Loading