CanGetMethodRoutingNames

This commit is contained in:
simonredfern 2026-01-11 23:00:00 +01:00
parent 17f9677f1d
commit 4fe6775029
3 changed files with 10 additions and 3 deletions

View File

@ -1635,6 +1635,11 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
var errorResponseBodies: List[String], // Possible error responses
tags: List[ResourceDocTag],
var roles: Option[List[ApiRole]] = None,
// IMPORTANT: Roles declared here are AUTOMATICALLY CHECKED at runtime!
// When roles specified, framework automatically: 1) Validates user authentication,
// 2) Checks user has at least one of specified roles, 3) Performs checks in wrappedWithAuthCheck()
// No manual hasEntitlement() call needed in endpoint body - handled automatically!
// To disable: call .disableAutoValidateRoles() on ResourceDoc
isFeatured: Boolean = false,
specialInstructions: Option[String] = None,
var specifiedUrl: Option[String] = None, // A derived value: Contains the called version (added at run time). See the resource doc for resource doc!

View File

@ -1003,6 +1003,9 @@ object ApiRole extends MdcLoggable{
case class CanGetAllConnectorMethods(requiresBankId: Boolean = false) extends ApiRole
lazy val canGetAllConnectorMethods = CanGetAllConnectorMethods()
case class CanGetConnectorMethodNames(requiresBankId: Boolean = false) extends ApiRole
lazy val canGetConnectorMethodNames = CanGetConnectorMethodNames()
case class CanCreateDynamicResourceDoc(requiresBankId: Boolean = false) extends ApiRole
lazy val canCreateDynamicResourceDoc = CanCreateDynamicResourceDoc()

View File

@ -1648,7 +1648,7 @@ trait APIMethods600 {
|
|${userAuthenticationMessage(true)}
|
|CanGetMethodRoutings entitlement is required.
|CanGetConnectorMethodNames entitlement is required.
|
""".stripMargin,
EmptyBody,
@ -1659,7 +1659,7 @@ trait APIMethods600 {
UnknownError
),
List(apiTagSystem, apiTagMethodRouting, apiTagApi),
Some(List(canGetMethodRoutings))
Some(List(canGetConnectorMethodNames))
)
lazy val getConnectorMethodNames: OBPEndpoint = {
@ -1667,7 +1667,6 @@ trait APIMethods600 {
cc => implicit val ec = EndpointContext(Some(cc))
for {
(Full(u), callContext) <- authenticatedAccess(cc)
_ <- NewStyle.function.hasEntitlement("", u.userId, canGetMethodRoutings, callContext)
// Fetch connector method names with caching
methodNames <- Future {
/**