Merge pull request #127 from somanole/issue93

Issue93
This commit is contained in:
Simon Redfern 2016-08-05 16:45:50 +02:00 committed by GitHub
commit e242008868

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