protected ObjectPermissionSet getRelevantPermissionSet(ModeledUser user,
            ModeledPermissions<? extends EntityModel> targetEntity)
            throws GuacamoleException {

        if (targetEntity.isUser())
            return user.getUserPermissions();

        if (targetEntity.isUserGroup())
            return user.getUserGroupPermissions();

        // Entities should be only users or groups
        throw new UnsupportedOperationException("Unexpected entity type.");
        
    }
Returns the ObjectPermissionSet related to the type of the given entity.
If the given entity represents a user, then the ObjectPermissionSet
containing user permissions is returned. If the given entity represents
a user group, then the ObjectPermissionSet containing user group
permissions is returned.

@param user
    The user to retrieve the ObjectPermissionSet from.

@param targetEntity
    The entity whose type dictates the ObjectPermissionSet returned.

@return
    The ObjectPermissionSet related to the type of the given entity.

@throws GuacamoleException
    If the relevant ObjectPermissionSet cannot be retrieved.
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/permission/AbstractPermissionService.java