mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:07:02 +00:00
refactor/Username is not unique in OBP -- disabled the endpoints
This commit is contained in:
parent
4a21b9f64e
commit
9f5a57f001
@ -205,9 +205,9 @@ trait APIMethods510 {
|
||||
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
getUserByUsername,
|
||||
getUserByProviderAndUsername,
|
||||
implementedInApiVersion,
|
||||
nameOf(getUserByUsername),
|
||||
nameOf(getUserByProviderAndUsername),
|
||||
"GET",
|
||||
"/users/provider/PROVIDER/username/USERNAME",
|
||||
"Get User by USERNAME",
|
||||
@ -225,7 +225,7 @@ trait APIMethods510 {
|
||||
Some(List(canGetAnyUser))
|
||||
)
|
||||
|
||||
lazy val getUserByUsername: OBPEndpoint = {
|
||||
lazy val getUserByProviderAndUsername: OBPEndpoint = {
|
||||
case "users" :: "provider" :: provider :: "username" :: username :: Nil JsonGet _ => {
|
||||
cc =>
|
||||
for {
|
||||
@ -241,9 +241,9 @@ trait APIMethods510 {
|
||||
}
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
getBadLoginStatus,
|
||||
getUserLockStatus,
|
||||
implementedInApiVersion,
|
||||
nameOf(getBadLoginStatus),
|
||||
nameOf(getUserLockStatus),
|
||||
"GET",
|
||||
"/users/PROVIDER/USERNAME/lock-status",
|
||||
"Get User Lock Status",
|
||||
@ -258,7 +258,7 @@ trait APIMethods510 {
|
||||
List(apiTagUser, apiTagNewStyle),
|
||||
Some(List(canReadUserLockedStatus))
|
||||
)
|
||||
lazy val getBadLoginStatus: OBPEndpoint = {
|
||||
lazy val getUserLockStatus: OBPEndpoint = {
|
||||
//get private accounts for all banks
|
||||
case "users" ::provider :: username :: "lock-status" :: Nil JsonGet req => {
|
||||
cc =>
|
||||
@ -277,9 +277,9 @@ trait APIMethods510 {
|
||||
}
|
||||
|
||||
resourceDocs += ResourceDoc(
|
||||
unlockUser,
|
||||
unlockUserByProviderAndUsername,
|
||||
implementedInApiVersion,
|
||||
nameOf(unlockUser),
|
||||
nameOf(unlockUserByProviderAndUsername),
|
||||
"PUT",
|
||||
"/users/PROVIDER/USERNAME/lock-status",
|
||||
"Unlock the user",
|
||||
@ -296,7 +296,7 @@ trait APIMethods510 {
|
||||
List(UserNotLoggedIn, UserNotFoundByProviderAndUsername, UserHasMissingRoles, UnknownError),
|
||||
List(apiTagUser, apiTagNewStyle),
|
||||
Some(List(canUnlockUser)))
|
||||
lazy val unlockUser: OBPEndpoint = {
|
||||
lazy val unlockUserByProviderAndUsername: OBPEndpoint = {
|
||||
//get private accounts for all banks
|
||||
case "users" :: provider :: username :: "lock-status" :: Nil JsonPut req => {
|
||||
cc =>
|
||||
@ -321,9 +321,9 @@ trait APIMethods510 {
|
||||
}
|
||||
|
||||
staticResourceDocs += ResourceDoc(
|
||||
lockUser,
|
||||
lockUserByProviderAndUsername,
|
||||
implementedInApiVersion,
|
||||
nameOf(lockUser),
|
||||
nameOf(lockUserByProviderAndUsername),
|
||||
"POST",
|
||||
"/users/PROVIDER/USERNAME/locks",
|
||||
"Lock the user",
|
||||
@ -338,7 +338,7 @@ trait APIMethods510 {
|
||||
List($UserNotLoggedIn, UserNotFoundByProviderAndUsername, UserHasMissingRoles, UnknownError),
|
||||
List(apiTagUser, apiTagNewStyle),
|
||||
Some(List(canLockUser)))
|
||||
lazy val lockUser: OBPEndpoint = {
|
||||
lazy val lockUserByProviderAndUsername: OBPEndpoint = {
|
||||
case "users" :: provider :: username :: "locks" :: Nil JsonPost req => {
|
||||
cc =>
|
||||
for {
|
||||
|
||||
@ -40,6 +40,7 @@ import code.api.v3_1_0.APIMethods310
|
||||
import code.api.v4_0_0.APIMethods400
|
||||
import code.api.v5_0_0.{APIMethods500, OBPAPI5_0_0}
|
||||
import code.util.Helper.MdcLoggable
|
||||
import com.github.dwickern.macros.NameOf.nameOf
|
||||
import com.openbankproject.commons.util.{ApiVersion, ApiVersionStatus}
|
||||
import net.liftweb.common.{Box, Full}
|
||||
import net.liftweb.http.{LiftResponse, PlainTextResponse}
|
||||
@ -71,11 +72,18 @@ object OBPAPI5_1_0 extends OBPRestHelper
|
||||
// e.g getEndpoints(Implementations5_0_0) -- List(Implementations5_0_0.genericEndpoint, Implementations5_0_0.root)
|
||||
val endpointsOf5_1_0 = getEndpoints(Implementations5_1_0)
|
||||
|
||||
lazy val bugEndpoints = // these endpoints miss Provider parameter in the URL, we introduce new ones in V510.
|
||||
nameOf(Implementations3_0_0.getUserByUsername) ::
|
||||
nameOf(Implementations3_1_0.getBadLoginStatus) ::
|
||||
nameOf(Implementations3_1_0.unlockUser) ::
|
||||
nameOf(Implementations4_0_0.lockUser) ::
|
||||
Nil
|
||||
|
||||
// if old version ResourceDoc objects have the same name endpoint with new version, omit old version ResourceDoc.
|
||||
def allResourceDocs = collectResourceDocs(
|
||||
OBPAPI5_0_0.allResourceDocs,
|
||||
Implementations5_1_0.resourceDocs
|
||||
)
|
||||
).filterNot(it => it.partialFunctionName.matches(bugEndpoints.mkString("|")))
|
||||
|
||||
// all endpoints
|
||||
private val endpoints: List[OBPEndpoint] = OBPAPI5_0_0.routes ++ endpointsOf5_1_0
|
||||
|
||||
@ -24,9 +24,9 @@ class LockUserTest extends V510ServerSetup {
|
||||
* This is made possible by the scalatest maven plugin
|
||||
*/
|
||||
object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString)
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.lockUser))
|
||||
object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.getBadLoginStatus))
|
||||
object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.unlockUser))
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.lockUserByProviderAndUsername))
|
||||
object ApiEndpoint2 extends Tag(nameOf(Implementations5_1_0.getUserLockStatus))
|
||||
object ApiEndpoint3 extends Tag(nameOf(Implementations5_1_0.unlockUserByProviderAndUsername))
|
||||
|
||||
|
||||
feature(s"test $ApiEndpoint1,$ApiEndpoint2, $ApiEndpoint3, version $VersionOfApi - Unauthorized access") {
|
||||
|
||||
@ -25,7 +25,7 @@ class UserTest extends V510ServerSetup {
|
||||
* This is made possible by the scalatest maven plugin
|
||||
*/
|
||||
object VersionOfApi extends Tag(ApiVersion.v5_1_0.toString)
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.getUserByUsername))
|
||||
object ApiEndpoint1 extends Tag(nameOf(Implementations5_1_0.getUserByProviderAndUsername))
|
||||
|
||||
feature(s"test $ApiEndpoint1 version $VersionOfApi - Unauthorized access") {
|
||||
scenario("We will call the endpoint without user credentials", ApiEndpoint1, VersionOfApi) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user