issue #93 - if user is SuperAdmin add it to getEntitlements

This commit is contained in:
sorinmanole 2016-08-03 16:02:31 +02:00
parent 1d6c9d0ea4
commit 2645ce5869

View File

@ -1820,8 +1820,16 @@ trait APIMethods200 {
entitlements <- Entitlement.entitlement.vend.getEntitlements(userId)
}
yield {
var json = EntitlementJSONs(Nil)
// Format the data as V2.0.0 json
val json = JSONFactory200.createEntitlementJSONs(entitlements)
if (isSuperAdmin(u.userId)) {
// If the user is SuperAdmin add it to the list
json = EntitlementJSONs(JSONFactory200.createEntitlementJSONs(entitlements).list:::List(EntitlementJSON("", "SuperAdmin", "")))
successJsonResponse(Extraction.decompose(json))
} else {
json = JSONFactory200.createEntitlementJSONs(entitlements)
}
// Return
successJsonResponse(Extraction.decompose(json))
}
}