Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AEF03116E4 for ; Fri, 25 Jul 2014 10:54:28 +0000 (UTC) Received: (qmail 59583 invoked by uid 500); 25 Jul 2014 10:54:28 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 59561 invoked by uid 500); 25 Jul 2014 10:54:28 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 59522 invoked by uid 99); 25 Jul 2014 10:54:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2014 10:54:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 25 Jul 2014 10:54:27 +0000 Received: (qmail 56392 invoked by uid 99); 25 Jul 2014 10:54:07 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2014 10:54:07 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C40EE9B4730; Fri, 25 Jul 2014 10:54:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sjcorbett@apache.org To: commits@brooklyn.incubator.apache.org Date: Fri, 25 Jul 2014 10:54:06 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [01/12] git commit: User Feature X-Virus-Checked: Checked by ClamAV on apache.org Repository: incubator-brooklyn Updated Branches: refs/heads/master 8030224f1 -> 1107f2f15 User Feature Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/35454cbb Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/35454cbb Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/35454cbb Branch: refs/heads/master Commit: 35454cbbfaaebffcf21fbdc33f83baaac5d9e4fe Parents: e315de3 Author: bhairavi sankar Authored: Wed Jul 9 12:37:05 2014 -0400 Committer: bhairavi sankar Committed: Tue Jul 22 23:20:25 2014 -0400 ---------------------------------------------------------------------- .../src/main/java/brooklyn/rest/api/ServerApi.java | 6 +++++- .../java/brooklyn/rest/resources/ServerResource.java | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35454cbb/usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java ---------------------------------------------------------------------- diff --git a/usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java b/usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java index 1bfb909..8aae011 100644 --- a/usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java +++ b/usage/rest-api/src/main/java/brooklyn/rest/api/ServerApi.java @@ -71,5 +71,9 @@ public interface ServerApi { @ApiOperation(value = "Fetches the status of all Brooklyn instances in the management plane", responseClass = "brooklyn.rest.domain.HighAvailabilitySummary") public HighAvailabilitySummary getHighAvailability(); - + + @GET + @Path("/user") + @ApiOperation(value = "Return user information for this Brooklyn instance", responseClass = "String", multiValueResponse = false) + public String getUser(); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/35454cbb/usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java b/usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java index 5a92352..032bd05 100644 --- a/usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java +++ b/usage/rest-server/src/main/java/brooklyn/rest/resources/ServerResource.java @@ -30,6 +30,8 @@ import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.EntityLocal; import brooklyn.entity.basic.StartableApplication; import brooklyn.management.Task; +import brooklyn.management.entitlement.EntitlementContext; +import brooklyn.management.entitlement.Entitlements; import brooklyn.management.ha.ManagementPlaneSyncRecord; import brooklyn.management.internal.ManagementContextInternal; import brooklyn.rest.api.ServerApi; @@ -93,4 +95,14 @@ public class ServerResource extends AbstractBrooklynRestResource implements Serv ManagementPlaneSyncRecord memento = mgmt().getHighAvailabilityManager().getManagementPlaneSyncState(); return HighAvailabilityTransformer.highAvailabilitySummary(mgmt().getManagementNodeId(), memento); } + + @Override + public String getUser() { + EntitlementContext entitlementContext = Entitlements.getEntitlementContext(); + if(entitlementContext!=null && entitlementContext.user()!=null){ + return entitlementContext.user(); + }else{ + return null; //User can be null if no authentication was requested + } + } }