extract the addedSuperAdminEntitlementJson method

This commit is contained in:
hongwei 2020-04-01 13:57:26 +02:00
parent 2f4346501e
commit 8477a22ee6
4 changed files with 7 additions and 3 deletions

View File

@ -2045,7 +2045,7 @@ trait APIMethods200 {
// Format the data as V2.0.0 json
if (isSuperAdmin(userId)) {
// If the user is SuperAdmin add it to the list
json = EntitlementJSONs(JSONFactory200.createEntitlementJSONs(entitlements).list:::List(EntitlementJSON("", "SuperAdmin", "")))
json = addedSuperAdminEntitlementJson(entitlements)
successJsonResponse(Extraction.decompose(json))
} else {
json = JSONFactory200.createEntitlementJSONs(entitlements)

View File

@ -837,6 +837,10 @@ def createTransactionTypeJSON(transactionType : TransactionType) : TransactionTy
))
)))
def addedSuperAdminEntitlementJson(entitlements: List[Entitlement]) = {
EntitlementJSONs(JSONFactory200.createEntitlementJSONs(entitlements).list ::: List(EntitlementJSON("", "SuperAdmin", "")))
}

View File

@ -821,7 +821,7 @@ trait APIMethods210 {
// Format the data as V2.1.0 json
if (isSuperAdmin(userId)) {
// If the user is SuperAdmin add it to the list
json = EntitlementJSONs(JSONFactory200.createEntitlementJSONs(filteredEntitlements).list:::List(EntitlementJSON("", "SuperAdmin", "")))
json = JSONFactory200.addedSuperAdminEntitlementJson(filteredEntitlements)
successJsonResponse(Extraction.decompose(json))
} else {
json = JSONFactory200.createEntitlementJSONs(filteredEntitlements)

View File

@ -1326,7 +1326,7 @@ trait APIMethods400 {
// Format the data as V2.0.0 json
if (isSuperAdmin(userId)) {
// If the user is SuperAdmin add it to the list
json = EntitlementJSONs(JSONFactory200.createEntitlementJSONs(entitlements).list:::List(EntitlementJSON("", "SuperAdmin", "")))
json = JSONFactory200.addedSuperAdminEntitlementJson(entitlements)
} else {
json = JSONFactory200.createEntitlementJSONs(entitlements)
}