Factored out and tweaked a message

This commit is contained in:
constantine2nd 2018-02-12 16:33:41 +01:00
parent cd694b3416
commit 925caa19b2
2 changed files with 4 additions and 3 deletions

View File

@ -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."

View File

@ -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)