necouchman commented on a change in pull request #374: GUACAMOLE-513: Implement 
Wake-on-LAN extension
URL: https://github.com/apache/guacamole-client/pull/374#discussion_r370992150
 
 

 ##########
 File path: 
extensions/guacamole-auth-wol/src/main/java/org/apache/guacamole/auth/wol/user/WOLUserContext.java
 ##########
 @@ -0,0 +1,114 @@
+/*
+ * 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.wol.user;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import org.apache.guacamole.GuacamoleException;
+import org.apache.guacamole.net.auth.AuthenticationProvider;
+import org.apache.guacamole.net.auth.Connection;
+import org.apache.guacamole.net.auth.DecoratingDirectory;
+import org.apache.guacamole.net.auth.DelegatingUserContext;
+import org.apache.guacamole.net.auth.Directory;
+import org.apache.guacamole.net.auth.UserContext;
+import org.apache.guacamole.auth.wol.connection.WOLConnection;
+import org.apache.guacamole.auth.wol.rest.WOLUserContextResource;
+import org.apache.guacamole.form.Form;
+import org.apache.guacamole.net.auth.Permissions;
+import org.apache.guacamole.net.auth.permission.ObjectPermission;
+import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
+import org.apache.guacamole.net.auth.permission.SystemPermission;
+import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A UserContext for the Wake-on-LAN extension that delegates storage
+ * to another UserContext.
+ */
+public class WOLUserContext extends DelegatingUserContext {
+
+    /**
+     * The logger for this class.
+     */
+    private static final Logger logger = 
LoggerFactory.getLogger(WOLUserContext.class);
+
+    /**
+     * The AuthenticationProvider associated with this UserContext.
+     */
+    private final AuthenticationProvider authProvider;
+
+    /**
+     * Establish a new WOLUserContext, which delegates all functions
+     * to the specified UserContext object.
+     * 
+     * @param userContext 
+     *     The UserContext object that this will delegate to.
+     * 
+     * @param authProvider
+     *     The authentication provider associated with this user context.
+     */
+    public WOLUserContext(UserContext userContext, AuthenticationProvider 
authProvider) {
+        super(userContext);
+        this.authProvider = authProvider;
+    }
+
+    @Override
+    public Directory<Connection> getConnectionDirectory() throws 
GuacamoleException {
+        return new 
DecoratingDirectory<Connection>(super.getConnectionDirectory()) {
+
+            @Override
+            protected Connection decorate(Connection object) throws 
GuacamoleException {
+                Permissions effective = self().getEffectivePermissions();
+                SystemPermissionSet systemPermissions = 
effective.getSystemPermissions();
+                ObjectPermissionSet objectPermissions = 
effective.getConnectionPermissions();
+                Boolean canUpdate = false;
 
 Review comment:
   Because CAPS is better than lowercase.
   
   Not really.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to