You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by mike-jumper <gi...@git.apache.org> on 2018/04/19 23:12:12 UTC

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

GitHub user mike-jumper opened a pull request:

    https://github.com/apache/guacamole-client/pull/274

    GUACAMOLE-220: Add base extension API support for user groups.

    This change adds the base classes necessary for exposing user groups via extensions, and for declaring the permissions which apply to a user *but are not necessarily directly granted to that user*.
    
    Overall, this involves:
    
    * A new `UserGroup` interface, as well as the usual `DelegatingUserGroup`, and `Directory<UserGroup>` on `UserContext`.
    * A new base interface, `Permissions`, which `User` and `UserGroup` share, defining the interface common to any object which can be granted permissions.
    * A new `getEffectivePermissions()` function on `User` which returns a `Permissions` that represents all permissions which apply to the user, even if those permissions are inherited through some arbitrary means (such as user groups). The traditional `getUserPermissions()`, `getConnectionPermissions()`, etc. directly on the `User` return permission sets which describe permissions which are directly granted only.
    * A new `getEffectiveUserGroups()` function on `AuthenticatedUser` which allows implementations to expose the identity of a user's group memberships in addition to the user's own identity. This forms the means by which membership in groups can be shared across extensions (for example, LDAP group membership can affect a user in MySQL so long as an identical MySQL group exists, even if that user does not exist in MySQL).
    * A new `RelatedObjectSet` interface, similar to `PermissionSet`, which abstracts batch add/remove operations on a group of objects sharing some arbitrary relation, such as the member users of a user group, the parent user groups of a user, etc. This allows relations between specific objects to be established or removed without affecting the existence of those objects (as `Directory` would require) nor necessarily other relations to those objects.
    
    The user groups themselves are exposed via a `Directory<UserGroup>` at the `UserContext` level, like all other objects. A new `ObjectPermissionSet` for user group permissions is exposed within `Permissions`. User membership within groups, group membership within groups, the set of groups containing a particular user, and the set of groups containing a particular group can all be maintained through the various getters returning `RelatedObjectSet` instances.
    
    Other than (1) updating the REST services and JavaScript to use *effective* permissions rather than directly-granted permissions and (2) any stubs necessary to allow the database auth to continue working, no changes outside the API are made here.
    
    Assuming these changes move forward, I will open further pull requests for the REST API changes, interface changes, and finally database auth changes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/mike-jumper/guacamole-client user-group-ext

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/guacamole-client/pull/274.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #274
    
----
commit dfb07edf2967a3f3a4317b062786f88b390f8dae
Author: Michael Jumper <mj...@...>
Date:   2018-04-19T21:17:25Z

    GUACAMOLE-220: Add base API support for user groups. Refactor as minimally necessary.

commit 393e1ab647e5e8f766f9485cf411651ac82f41d0
Author: Michael Jumper <mj...@...>
Date:   2018-04-19T21:18:02Z

    GUACAMOLE-220: Use effective permissions to test user access to resources.

----


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183188493
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.net.auth;
    +
    +import org.apache.guacamole.GuacamoleException;
    +
    +/**
    + * A user group of the Guacamole web application. Each user group may contain
    + * any number of Guacamole users and other user groups, and defines the
    + * permissions implicitly granted to its members.
    + */
    +public interface UserGroup extends Identifiable, Attributes, Permissions {
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable users that are members of this user group.
    +     * If permission is granted for the current user to modify the members of
    +     * this group, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set all readable users that are members of this user group,
    +     *     which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the users.
    +     */
    +    RelatedObjectSet getMemberUsers() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getMemberUserGroups() throws GuacamoleException;
    --- End diff --
    
    `getUserGroups()` returns the user groups of which the current group is a member, while `getMemberUserGroups()` returns the user groups which are members of the current group.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183219541
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java ---
    @@ -143,13 +144,14 @@ public DirectoryResource(UserContext userContext, Directory<InternalType> direct
     
             // An admin user has access to all objects
             User self = userContext.self();
    -        SystemPermissionSet systemPermissions = self.getSystemPermissions();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    Nope. No reason. Will do.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r182984489
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/sharingprofile/SharingProfileResource.java ---
    @@ -103,11 +104,13 @@ public SharingProfileResource(@Assisted UserContext userContext,
         public Map<String, String> getParameters()
                 throws GuacamoleException {
     
    +        // Pull effective permissions
             User self = userContext.self();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    As with previous places, guessing these two lines could be collapsed...


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183192668
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AuthenticatedUser.java ---
    @@ -49,6 +50,24 @@
          */
         Credentials getCredentials();
     
    +    /**
    +     * Returns a read-only set of the identifiers of all user groups which
    +     * apply to this authenticated user. The exact semantics of what user
    +     * groups apply are up to the implementation, and the user groups within
    +     * this set may be implied, derived dynamically, inherited through multiple
    +     * levels of group membership, etc.
    +     *
    +     * Note that, as with user identifiers, user group identifiers form the
    +     * basis of identity which applies across authentication providers. It is
    +     * expected that any two user groups having the same identifier represent
    +     * the same group, even if defined by different authentication providers
    --- End diff --
    
    Missing period at the end of this sentence.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183219535
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/connection/ConnectionResource.java ---
    @@ -119,11 +120,13 @@ public ConnectionResource(@Assisted UserContext userContext,
         public Map<String, String> getConnectionParameters()
                 throws GuacamoleException {
     
    +        // Pull effective permissions
             User self = userContext.self();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    Nope. Sounds fine to me. I'll make the change.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183193049
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/User.java ---
    @@ -109,85 +106,33 @@
         List<? extends ActivityRecord> getHistory() throws GuacamoleException;
     
         /**
    -     * Returns all system-level permissions given to this user.
    -     *
    -     * @return
    -     *     A SystemPermissionSet of all system-level permissions granted to
    -     *     this user.
    -     *
    -     * @throws GuacamoleException 
    -     *     If an error occurs while retrieving permissions, or if reading all
    -     *     permissions is not allowed.
    -     */
    -    SystemPermissionSet getSystemPermissions() throws GuacamoleException;
    -
    -    /**
    -     * Returns all connection permissions given to this user.
    -     *
    -     * @return
    -     *     An ObjectPermissionSet of all connection permissions granted to this
    -     *     user.
    -     *
    -     * @throws GuacamoleException 
    -     *     If an error occurs while retrieving permissions, or if reading all
    -     *     permissions is not allowed.
    -     */
    -    ObjectPermissionSet getConnectionPermissions()
    -            throws GuacamoleException;
    -
    -    /**
    -     * Returns all connection group permissions given to this user.
    -     *
    -     * @return
    -     *     An ObjectPermissionSet of all connection group permissions granted
    -     *     to this user.
    -     *
    -     * @throws GuacamoleException
    -     *     If an error occurs while retrieving permissions, or if reading all
    -     *     permissions is not allowed.
    -     */
    -    ObjectPermissionSet getConnectionGroupPermissions()
    -            throws GuacamoleException;
    -
    -    /**
    -     * Returns all sharing profile permissions given to this user.
    +     * Returns a set of all readable user groups of which this user is a member.
    +     * If permission is granted for the current user to modify the membership of
    +     * this user, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
          *
          * @return
    -     *     An ObjectPermissionSet of all sharing profile permissions granted to
    -     *     this user.
    +     *     The set of all readable user groups of which this user is a member.
          *
          * @throws GuacamoleException
    -     *     If an error occurs while retrieving permissions, or if reading all
    -     *     permissions is not allowed.
    -     */
    -    ObjectPermissionSet getSharingProfilePermissions()
    -            throws GuacamoleException;
    -
    -    /**
    -     * Returns all permissions given to this user regarding currently-active
    -     * connections.
    -     *
    -     * @return
    -     *     An ObjectPermissionSet of all active connection permissions granted
    -     *     to this user.
    -     *
    -     * @throws GuacamoleException 
    -     *     If an error occurs while retrieving permissions, or if reading all
    -     *     permissions is not allowed.
    +     *     If an error occurs while retrieving the user groups.
          */
    -    ObjectPermissionSet getActiveConnectionPermissions()
    -            throws GuacamoleException;
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
     
         /**
    -     * Returns all user permissions given to this user.
    +     * Returns a read-only view of all permissions granted to this user. The
    +     * exact semantics of what permissions are granted are up to the
    +     * implementation, and the permissions within this view may implied,
    --- End diff --
    
    "may be implied"


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r182983804
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java ---
    @@ -143,13 +144,14 @@ public DirectoryResource(UserContext userContext, Directory<InternalType> direct
     
             // An admin user has access to all objects
             User self = userContext.self();
    -        SystemPermissionSet systemPermissions = self.getSystemPermissions();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    Same note as above - any reason not to do
    
        Permissions effective = userContext.self().getEffectivePermissions()
    
    ?


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183217172
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.net.auth;
    +
    +import org.apache.guacamole.GuacamoleException;
    +
    +/**
    + * A user group of the Guacamole web application. Each user group may contain
    + * any number of Guacamole users and other user groups, and defines the
    + * permissions implicitly granted to its members.
    + */
    +public interface UserGroup extends Identifiable, Attributes, Permissions {
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable users that are members of this user group.
    +     * If permission is granted for the current user to modify the members of
    +     * this group, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set all readable users that are members of this user group,
    +     *     which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the users.
    +     */
    +    RelatedObjectSet getMemberUsers() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getMemberUserGroups() throws GuacamoleException;
    --- End diff --
    
    Oops.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183189038
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.net.auth;
    +
    +import org.apache.guacamole.GuacamoleException;
    +
    +/**
    + * A user group of the Guacamole web application. Each user group may contain
    + * any number of Guacamole users and other user groups, and defines the
    + * permissions implicitly granted to its members.
    + */
    +public interface UserGroup extends Identifiable, Attributes, Permissions {
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable users that are members of this user group.
    +     * If permission is granted for the current user to modify the members of
    +     * this group, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set all readable users that are members of this user group,
    +     *     which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the users.
    +     */
    +    RelatedObjectSet getMemberUsers() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getMemberUserGroups() throws GuacamoleException;
    --- End diff --
    
    Okay, in that case, the comments above the code need to be updated.  The comment above `getUserGroups()` says:
    
    > Returns a set of all readable user groups that are members of this user group.
    
    and the comment above `getMemberUserGroups()` starts with:
    
    > Returns a set of all readable user groups that are members of this user group.
    
    Also, the `@return` comment seems to be identical for both of them?


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r182982451
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleRelatedObjectSet.java ---
    @@ -0,0 +1,88 @@
    +/*
    + * 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.net.auth.simple;
    +
    +import java.util.Collections;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.auth.RelatedObjectSet;
    +
    +/**
    + * A read-only implementation of RelatedObjectSet which uses a backing Set
    + * of identifiers to determine which objects are present.
    + */
    +public class SimpleRelatedObjectSet implements RelatedObjectSet {
    --- End diff --
    
    Do you think there's any value to implementing a `AbstractRelatedObjectSet` class like you've done for several of the other `Simple` classes, that implements a bunch of these default behaviors?  Perhaps not initially useful for the JDBC extension, but is it something that would be helpful as other extensions implement the `RelatedObjectSet` class without having to rely on the behavior of `SimpleRelatedObjectSet`?


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r182983461
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/connection/ConnectionResource.java ---
    @@ -119,11 +120,13 @@ public ConnectionResource(@Assisted UserContext userContext,
         public Map<String, String> getConnectionParameters()
                 throws GuacamoleException {
     
    +        // Pull effective permissions
             User self = userContext.self();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    In the `ConnectionGroupTree` class you did:
    
        Permissions effective = userContext.self().getEffectivePermissions();
    
    eliminating the need for the existence of the `self` object.  Any reason not to do the same, here?


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183192561
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/AbstractAuthenticatedUser.java ---
    @@ -19,6 +19,9 @@
     
     package org.apache.guacamole.net.auth;
     
    +import java.util.Collections;
    +import java.util.Set;
    +
    --- End diff --
    
    Extra line added, here - seems like most files have a single space between `import` and class documentation.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r182981505
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.net.auth;
    +
    +import org.apache.guacamole.GuacamoleException;
    +
    +/**
    + * A user group of the Guacamole web application. Each user group may contain
    + * any number of Guacamole users and other user groups, and defines the
    + * permissions implicitly granted to its members.
    + */
    +public interface UserGroup extends Identifiable, Attributes, Permissions {
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable users that are members of this user group.
    +     * If permission is granted for the current user to modify the members of
    +     * this group, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set all readable users that are members of this user group,
    +     *     which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the users.
    +     */
    +    RelatedObjectSet getMemberUsers() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getMemberUserGroups() throws GuacamoleException;
    --- End diff --
    
    Is there a reason that `getUserGroups()` and `getMemberUserGroups()` are both necessary?  Based on the stubs and descriptions, here, they look identical?  I see that they're both implemented in `DelegatingUserGroup`, but they have identical implementations, there, and `getMemberUserGroups()` does not appear to be used anywhere outside of there?


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183219467
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleRelatedObjectSet.java ---
    @@ -0,0 +1,88 @@
    +/*
    + * 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.net.auth.simple;
    +
    +import java.util.Collections;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.auth.RelatedObjectSet;
    +
    +/**
    + * A read-only implementation of RelatedObjectSet which uses a backing Set
    + * of identifiers to determine which objects are present.
    + */
    +public class SimpleRelatedObjectSet implements RelatedObjectSet {
    --- End diff --
    
    In principle, yes, but I'm not sure what that would be. There are only two functions that are effectively unimplemented by `SimpleRelatedObjectSet`:
    
    1. `addObjects()`
    2. `removeObjects()`
    
    both of which make changes to the `RelatedObjectSet` in a way that would be implementation dependent. It does make sense to provide default behaviors, but I don't think there are any sensible default behaviors we can provide here.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183219605
  
    --- Diff: guacamole/src/main/java/org/apache/guacamole/rest/sharingprofile/SharingProfileResource.java ---
    @@ -103,11 +104,13 @@ public SharingProfileResource(@Assisted UserContext userContext,
         public Map<String, String> getParameters()
                 throws GuacamoleException {
     
    +        // Pull effective permissions
             User self = userContext.self();
    +        Permissions effective = self.getEffectivePermissions();
    --- End diff --
    
    Yup, I agree.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by mike-jumper <gi...@git.apache.org>.
Github user mike-jumper commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183219692
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/UserGroup.java ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.net.auth;
    +
    +import org.apache.guacamole.GuacamoleException;
    +
    +/**
    + * A user group of the Guacamole web application. Each user group may contain
    + * any number of Guacamole users and other user groups, and defines the
    + * permissions implicitly granted to its members.
    + */
    +public interface UserGroup extends Identifiable, Attributes, Permissions {
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getUserGroups() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable users that are members of this user group.
    +     * If permission is granted for the current user to modify the members of
    +     * this group, then the returned set will be mutable, and any such
    +     * modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set all readable users that are members of this user group,
    +     *     which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the users.
    +     */
    +    RelatedObjectSet getMemberUsers() throws GuacamoleException;
    +
    +    /**
    +     * Returns a set of all readable user groups that are members of this user
    +     * group. If permission is granted for the current user to modify the
    +     * members of this group, then the returned set will be mutable, and any
    +     * such modifications should be made through changes to the returned set.
    +     *
    +     * @return
    +     *     The set of all readable user groups that are members of this user
    +     *     group, which may be mutable.
    +     *
    +     * @throws GuacamoleException
    +     *     If an error occurs while retrieving the user groups.
    +     */
    +    RelatedObjectSet getMemberUserGroups() throws GuacamoleException;
    --- End diff --
    
    OK - this should now be corrected.


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/guacamole-client/pull/274


---

[GitHub] guacamole-client pull request #274: GUACAMOLE-220: Add base extension API su...

Posted by necouchman <gi...@git.apache.org>.
Github user necouchman commented on a diff in the pull request:

    https://github.com/apache/guacamole-client/pull/274#discussion_r183221460
  
    --- Diff: guacamole-ext/src/main/java/org/apache/guacamole/net/auth/simple/SimpleRelatedObjectSet.java ---
    @@ -0,0 +1,88 @@
    +/*
    + * 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.net.auth.simple;
    +
    +import java.util.Collections;
    +import java.util.Set;
    +import org.apache.guacamole.GuacamoleException;
    +import org.apache.guacamole.GuacamoleSecurityException;
    +import org.apache.guacamole.net.auth.RelatedObjectSet;
    +
    +/**
    + * A read-only implementation of RelatedObjectSet which uses a backing Set
    + * of identifiers to determine which objects are present.
    + */
    +public class SimpleRelatedObjectSet implements RelatedObjectSet {
    --- End diff --
    
    Make sense.


---