mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:56:46 +00:00
Factored out and tweaked a message
This commit is contained in:
parent
cd694b3416
commit
925caa19b2
@ -275,6 +275,7 @@ val dateformat = new java.text.SimpleDateFormat("yyyy-MM-dd")
|
||||
val EntitlementRequestAlreadyExists = "OBP-30214: Entitlement Request already exists for the user."
|
||||
val EntitlementRequestCannotBeAdded = "OBP-30214: Entitlement Request cannot be added."
|
||||
val EntitlementRequestNotFound = "OBP-30215: EntitlementRequestId not found"
|
||||
val EntitlementAlreadyExists = "OBP-30216: Entitlement already exists for the user."
|
||||
|
||||
// Branch related messages
|
||||
val branchesNotFoundLicense = "OBP-32001: No branches available. License may not be set."
|
||||
|
||||
@ -1943,8 +1943,8 @@ trait APIMethods200 {
|
||||
InvalidJsonFormat,
|
||||
IncorrectRoleName,
|
||||
EntitlementIsBankRole,
|
||||
EntitlementIsSystemRole,
|
||||
"Entitlement already exists for the user.",
|
||||
EntitlementIsSystemRole,
|
||||
EntitlementAlreadyExists,
|
||||
UnknownError
|
||||
),
|
||||
Catalogs(notCore, notPSD2, notOBWG),
|
||||
@ -1967,7 +1967,7 @@ trait APIMethods200 {
|
||||
Nil
|
||||
_ <- booleanToBox(isSuperAdmin(u.userId) || hasAtLeastOneEntitlement(postedData.bank_id, u.userId, allowedEntitlements) == true) ?~! {"Logged user is not super admin or does not have entitlements: " + allowedEntitlements.mkString(", ") + "!"}
|
||||
_ <- booleanToBox(postedData.bank_id.nonEmpty == false || Bank(BankId(postedData.bank_id)).isEmpty == false) ?~! BankNotFound
|
||||
_ <- booleanToBox(hasEntitlement(postedData.bank_id, userId, role) == false, "Entitlement already exists for the user." )
|
||||
_ <- booleanToBox(hasEntitlement(postedData.bank_id, userId, role) == false, EntitlementAlreadyExists )
|
||||
addedEntitlement <- Entitlement.entitlement.vend.addEntitlement(postedData.bank_id, userId, postedData.role_name)
|
||||
} yield {
|
||||
val viewJson = JSONFactory200.createEntitlementJSON(addedEntitlement)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user