guacamole-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmuehl...@apache.org
Subject [4/5] incubator-guacamole-client git commit: GUACAMOLE-5: Rename JDBC-specific UserContext to ModeledUserContext for clarity.
Date Sat, 30 Jul 2016 18:22:33 GMT
GUACAMOLE-5: Rename JDBC-specific UserContext to ModeledUserContext for clarity.

Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/commit/212e559e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/tree/212e559e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/diff/212e559e

Branch: refs/heads/master
Commit: 212e559edfbc5681fda947f3f0ecc3f94bc2e9cd
Parents: 544b3c6
Author: Michael Jumper <mjumper@apache.org>
Authored: Fri Jul 29 15:19:33 2016 -0700
Committer: Michael Jumper <mjumper@apache.org>
Committed: Fri Jul 29 22:05:39 2016 -0700

----------------------------------------------------------------------
 .../jdbc/JDBCAuthenticationProviderModule.java  |   4 +-
 .../jdbc/JDBCAuthenticationProviderService.java |   8 +-
 .../auth/jdbc/user/ModeledUserContext.java      | 192 +++++++++++++++++++
 .../guacamole/auth/jdbc/user/UserContext.java   | 192 -------------------
 4 files changed, 198 insertions(+), 198 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/212e559e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderModule.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderModule.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderModule.java
index f2ef805..6aa52af 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderModule.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderModule.java
@@ -20,7 +20,7 @@
 package org.apache.guacamole.auth.jdbc;
 
 import com.google.inject.Scopes;
-import org.apache.guacamole.auth.jdbc.user.UserContext;
+import org.apache.guacamole.auth.jdbc.user.ModeledUserContext;
 import org.apache.guacamole.auth.jdbc.connectiongroup.RootConnectionGroup;
 import org.apache.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
 import org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupDirectory;
@@ -140,12 +140,12 @@ public class JDBCAuthenticationProviderModule extends MyBatisModule
{
         bind(ModeledGuacamoleConfiguration.class);
         bind(ModeledSharingProfile.class);
         bind(ModeledUser.class);
+        bind(ModeledUserContext.class);
         bind(RootConnectionGroup.class);
         bind(SharingProfileDirectory.class);
         bind(SharingProfilePermissionSet.class);
         bind(SystemPermissionSet.class);
         bind(TrackedActiveConnection.class);
-        bind(UserContext.class);
         bind(UserDirectory.class);
         bind(UserPermissionSet.class);
         

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/212e559e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java
index e5743f4..a362e81 100644
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/JDBCAuthenticationProviderService.java
@@ -23,7 +23,7 @@ import com.google.inject.Inject;
 import com.google.inject.Provider;
 import org.apache.guacamole.GuacamoleException;
 import org.apache.guacamole.auth.jdbc.user.ModeledUser;
-import org.apache.guacamole.auth.jdbc.user.UserContext;
+import org.apache.guacamole.auth.jdbc.user.ModeledUserContext;
 import org.apache.guacamole.auth.jdbc.user.UserService;
 import org.apache.guacamole.net.auth.AuthenticatedUser;
 import org.apache.guacamole.net.auth.AuthenticationProvider;
@@ -50,7 +50,7 @@ public class JDBCAuthenticationProviderService implements AuthenticationProvider
      * Provider for retrieving UserContext instances.
      */
     @Inject
-    private Provider<UserContext> userContextProvider;
+    private Provider<ModeledUserContext> userContextProvider;
 
     @Override
     public AuthenticatedUser authenticateUser(AuthenticationProvider authenticationProvider,
@@ -67,7 +67,7 @@ public class JDBCAuthenticationProviderService implements AuthenticationProvider
     }
 
     @Override
-    public UserContext getUserContext(AuthenticationProvider authenticationProvider,
+    public ModeledUserContext getUserContext(AuthenticationProvider authenticationProvider,
             AuthenticatedUser authenticatedUser) throws GuacamoleException {
 
         // Retrieve user account for already-authenticated user
@@ -76,7 +76,7 @@ public class JDBCAuthenticationProviderService implements AuthenticationProvider
             return null;
 
         // Link to user context
-        UserContext context = userContextProvider.get();
+        ModeledUserContext context = userContextProvider.get();
         context.init(user.getCurrentUser());
         return context;
 

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/212e559e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
new file mode 100644
index 0000000..1ec5981
--- /dev/null
+++ b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/ModeledUserContext.java
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.guacamole.auth.jdbc.user;
+
+
+import org.apache.guacamole.auth.jdbc.connectiongroup.RootConnectionGroup;
+import org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupDirectory;
+import org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import java.util.Collection;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
+import org.apache.guacamole.auth.jdbc.activeconnection.ActiveConnectionDirectory;
+import org.apache.guacamole.auth.jdbc.connection.ConnectionRecordSet;
+import org.apache.guacamole.auth.jdbc.connection.ModeledConnection;
+import org.apache.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
+import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
+import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileDirectory;
+import org.apache.guacamole.form.Form;
+import org.apache.guacamole.net.auth.ActiveConnection;
+import org.apache.guacamole.net.auth.AuthenticationProvider;
+import org.apache.guacamole.net.auth.Connection;
+import org.apache.guacamole.net.auth.ConnectionGroup;
+import org.apache.guacamole.net.auth.Directory;
+import org.apache.guacamole.net.auth.SharingProfile;
+import org.apache.guacamole.net.auth.User;
+
+/**
+ * UserContext implementation which is driven by an arbitrary, underlying
+ * database.
+ *
+ * @author James Muehlner
+ * @author Michael Jumper
+ */
+public class ModeledUserContext extends RestrictedObject
+    implements org.apache.guacamole.net.auth.UserContext {
+
+    /**
+     * User directory restricted by the permissions of the user associated
+     * with this context.
+     */
+    @Inject
+    private UserDirectory userDirectory;
+ 
+    /**
+     * Connection directory restricted by the permissions of the user
+     * associated with this context.
+     */
+    @Inject
+    private ConnectionDirectory connectionDirectory;
+
+    /**
+     * Connection group directory restricted by the permissions of the user
+     * associated with this context.
+     */
+    @Inject
+    private ConnectionGroupDirectory connectionGroupDirectory;
+
+    /**
+     * Sharing profile directory restricted by the permissions of the user
+     * associated with this context.
+     */
+    @Inject
+    private SharingProfileDirectory sharingProfileDirectory;
+
+    /**
+     * ActiveConnection directory restricted by the permissions of the user
+     * associated with this context.
+     */
+    @Inject
+    private ActiveConnectionDirectory activeConnectionDirectory;
+
+    /**
+     * Provider for creating the root group.
+     */
+    @Inject
+    private Provider<RootConnectionGroup> rootGroupProvider;
+
+    /**
+     * Provider for creating connection record sets.
+     */
+    @Inject
+    private Provider<ConnectionRecordSet> connectionRecordSetProvider;
+    
+    @Override
+    public void init(ModeledAuthenticatedUser currentUser) {
+
+        super.init(currentUser);
+        
+        // Init directories
+        userDirectory.init(currentUser);
+        connectionDirectory.init(currentUser);
+        connectionGroupDirectory.init(currentUser);
+        sharingProfileDirectory.init(currentUser);
+        activeConnectionDirectory.init(currentUser);
+
+    }
+
+    @Override
+    public User self() {
+        return getCurrentUser().getUser();
+    }
+
+    @Override
+    public AuthenticationProvider getAuthenticationProvider() {
+        return getCurrentUser().getModelAuthenticationProvider();
+    }
+
+    @Override
+    public Directory<User> getUserDirectory() throws GuacamoleException {
+        return userDirectory;
+    }
+
+    @Override
+    public Directory<Connection> getConnectionDirectory() throws GuacamoleException
{
+        return connectionDirectory;
+    }
+
+    @Override
+    public Directory<ConnectionGroup> getConnectionGroupDirectory() throws GuacamoleException
{
+        return connectionGroupDirectory;
+    }
+
+    @Override
+    public Directory<SharingProfile> getSharingProfileDirectory()
+            throws GuacamoleException {
+        return sharingProfileDirectory;
+    }
+
+    @Override
+    public Directory<ActiveConnection> getActiveConnectionDirectory()
+            throws GuacamoleException {
+        return activeConnectionDirectory;
+    }
+
+    @Override
+    public ConnectionRecordSet getConnectionHistory()
+            throws GuacamoleException {
+        ConnectionRecordSet connectionRecordSet = connectionRecordSetProvider.get();
+        connectionRecordSet.init(getCurrentUser());
+        return connectionRecordSet;
+    }
+
+    @Override
+    public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
+
+        // Build and return a root group for the current user
+        RootConnectionGroup rootGroup = rootGroupProvider.get();
+        rootGroup.init(getCurrentUser());
+        return rootGroup;
+
+    }
+
+    @Override
+    public Collection<Form> getUserAttributes() {
+        return ModeledUser.ATTRIBUTES;
+    }
+
+    @Override
+    public Collection<Form> getConnectionAttributes() {
+        return ModeledConnection.ATTRIBUTES;
+    }
+
+    @Override
+    public Collection<Form> getConnectionGroupAttributes() {
+        return ModeledConnectionGroup.ATTRIBUTES;
+    }
+
+    @Override
+    public Collection<Form> getSharingProfileAttributes() {
+        return ModeledSharingProfile.ATTRIBUTES;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-guacamole-client/blob/212e559e/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserContext.java
----------------------------------------------------------------------
diff --git a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserContext.java
b/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserContext.java
deleted file mode 100644
index b70cdec..0000000
--- a/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/user/UserContext.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.guacamole.auth.jdbc.user;
-
-
-import org.apache.guacamole.auth.jdbc.connectiongroup.RootConnectionGroup;
-import org.apache.guacamole.auth.jdbc.connectiongroup.ConnectionGroupDirectory;
-import org.apache.guacamole.auth.jdbc.connection.ConnectionDirectory;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import java.util.Collection;
-import org.apache.guacamole.GuacamoleException;
-import org.apache.guacamole.auth.jdbc.base.RestrictedObject;
-import org.apache.guacamole.auth.jdbc.activeconnection.ActiveConnectionDirectory;
-import org.apache.guacamole.auth.jdbc.connection.ConnectionRecordSet;
-import org.apache.guacamole.auth.jdbc.connection.ModeledConnection;
-import org.apache.guacamole.auth.jdbc.connectiongroup.ModeledConnectionGroup;
-import org.apache.guacamole.auth.jdbc.sharingprofile.ModeledSharingProfile;
-import org.apache.guacamole.auth.jdbc.sharingprofile.SharingProfileDirectory;
-import org.apache.guacamole.form.Form;
-import org.apache.guacamole.net.auth.ActiveConnection;
-import org.apache.guacamole.net.auth.AuthenticationProvider;
-import org.apache.guacamole.net.auth.Connection;
-import org.apache.guacamole.net.auth.ConnectionGroup;
-import org.apache.guacamole.net.auth.Directory;
-import org.apache.guacamole.net.auth.SharingProfile;
-import org.apache.guacamole.net.auth.User;
-
-/**
- * UserContext implementation which is driven by an arbitrary, underlying
- * database.
- *
- * @author James Muehlner
- * @author Michael Jumper
- */
-public class UserContext extends RestrictedObject
-    implements org.apache.guacamole.net.auth.UserContext {
-
-    /**
-     * User directory restricted by the permissions of the user associated
-     * with this context.
-     */
-    @Inject
-    private UserDirectory userDirectory;
- 
-    /**
-     * Connection directory restricted by the permissions of the user
-     * associated with this context.
-     */
-    @Inject
-    private ConnectionDirectory connectionDirectory;
-
-    /**
-     * Connection group directory restricted by the permissions of the user
-     * associated with this context.
-     */
-    @Inject
-    private ConnectionGroupDirectory connectionGroupDirectory;
-
-    /**
-     * Sharing profile directory restricted by the permissions of the user
-     * associated with this context.
-     */
-    @Inject
-    private SharingProfileDirectory sharingProfileDirectory;
-
-    /**
-     * ActiveConnection directory restricted by the permissions of the user
-     * associated with this context.
-     */
-    @Inject
-    private ActiveConnectionDirectory activeConnectionDirectory;
-
-    /**
-     * Provider for creating the root group.
-     */
-    @Inject
-    private Provider<RootConnectionGroup> rootGroupProvider;
-
-    /**
-     * Provider for creating connection record sets.
-     */
-    @Inject
-    private Provider<ConnectionRecordSet> connectionRecordSetProvider;
-    
-    @Override
-    public void init(ModeledAuthenticatedUser currentUser) {
-
-        super.init(currentUser);
-        
-        // Init directories
-        userDirectory.init(currentUser);
-        connectionDirectory.init(currentUser);
-        connectionGroupDirectory.init(currentUser);
-        sharingProfileDirectory.init(currentUser);
-        activeConnectionDirectory.init(currentUser);
-
-    }
-
-    @Override
-    public User self() {
-        return getCurrentUser().getUser();
-    }
-
-    @Override
-    public AuthenticationProvider getAuthenticationProvider() {
-        return getCurrentUser().getModelAuthenticationProvider();
-    }
-
-    @Override
-    public Directory<User> getUserDirectory() throws GuacamoleException {
-        return userDirectory;
-    }
-
-    @Override
-    public Directory<Connection> getConnectionDirectory() throws GuacamoleException
{
-        return connectionDirectory;
-    }
-
-    @Override
-    public Directory<ConnectionGroup> getConnectionGroupDirectory() throws GuacamoleException
{
-        return connectionGroupDirectory;
-    }
-
-    @Override
-    public Directory<SharingProfile> getSharingProfileDirectory()
-            throws GuacamoleException {
-        return sharingProfileDirectory;
-    }
-
-    @Override
-    public Directory<ActiveConnection> getActiveConnectionDirectory()
-            throws GuacamoleException {
-        return activeConnectionDirectory;
-    }
-
-    @Override
-    public ConnectionRecordSet getConnectionHistory()
-            throws GuacamoleException {
-        ConnectionRecordSet connectionRecordSet = connectionRecordSetProvider.get();
-        connectionRecordSet.init(getCurrentUser());
-        return connectionRecordSet;
-    }
-
-    @Override
-    public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
-
-        // Build and return a root group for the current user
-        RootConnectionGroup rootGroup = rootGroupProvider.get();
-        rootGroup.init(getCurrentUser());
-        return rootGroup;
-
-    }
-
-    @Override
-    public Collection<Form> getUserAttributes() {
-        return ModeledUser.ATTRIBUTES;
-    }
-
-    @Override
-    public Collection<Form> getConnectionAttributes() {
-        return ModeledConnection.ATTRIBUTES;
-    }
-
-    @Override
-    public Collection<Form> getConnectionGroupAttributes() {
-        return ModeledConnectionGroup.ATTRIBUTES;
-    }
-
-    @Override
-    public Collection<Form> getSharingProfileAttributes() {
-        return ModeledSharingProfile.ATTRIBUTES;
-    }
-
-}


Mime
View raw message