From 2645ce58692e423b447ce551f955dfd5c6bebb65 Mon Sep 17 00:00:00 2001 From: sorinmanole Date: Wed, 3 Aug 2016 16:02:31 +0200 Subject: [PATCH] issue #93 - if user is SuperAdmin add it to getEntitlements --- src/main/scala/code/api/v2_0_0/APIMethods200.scala | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/scala/code/api/v2_0_0/APIMethods200.scala b/src/main/scala/code/api/v2_0_0/APIMethods200.scala index 2af801d37..8c197ec32 100644 --- a/src/main/scala/code/api/v2_0_0/APIMethods200.scala +++ b/src/main/scala/code/api/v2_0_0/APIMethods200.scala @@ -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)) } }