brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sjcorb...@apache.org
Subject [01/12] git commit: User Feature
Date Fri, 25 Jul 2014 10:54:06 GMT
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 <bhairavi.sankar@gmail.com>
Authored: Wed Jul 9 12:37:05 2014 -0400
Committer: bhairavi sankar <bhairavi.sankar@gmail.com>
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
+		}
+	}
 }


Mime
View raw message