@Override
    public Directory<ConnectionGroup> getConnectionGroupDirectory() throws GuacamoleException {
        return new DecoratingDirectory<ConnectionGroup>(super.getConnectionGroupDirectory()) {

            @Override
            protected ConnectionGroup decorate(ConnectionGroup object) throws GuacamoleException {
                return new RestrictedConnectionGroup(object, remoteAddress);
            }

            @Override
            protected ConnectionGroup undecorate(ConnectionGroup object) {
                assert(object instanceof RestrictedConnectionGroup);
                return ((RestrictedConnectionGroup) object).getUndecorated();
            }

        };
    }
Creates a new RestrictedUserContext which wraps the given UserContext,
providing additional control for user logins and connections.

@param userContext
    The UserContext to wrap.

@param remoteAddress
    The address the user is logging in from, if known.

@param effectiveUserGroups
    The identifiers of the groups this user is associated with.
extensions/guacamole-auth-restrict/src/main/java/org/apache/guacamole/auth/restrict/user/RestrictedUserContext.java