Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Verifying if user is in group (outside of master node)? #4016

JShelton ·


I'm trying to verify that a user is in a particular group via a config that is not running on the master node. Specifically, a remote Windows node. Is this possible? How am I able to accomplish this?

Code I am currently using is this:

import com.pmease.quickbuild.persistence.*

try {
    def user = system.userManager.load(request.requesterId)
    if (user.groupNames.contains("SpecialUsers"))'user is in this group')
    else'user is not in this group')
} finally {

Error (only on remote node):

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.pmease.quickbuild.model.User.memberships, could not initialize proxy - no Session
    at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(
    at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(
    at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(
    at org.hibernate.collection.internal.PersistentBag.iterator(
    at java_util_List$ Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(
  • solved #2
  • replies 1
  • views 23
  • stars 0
robinshen ADMIN ·

Unfortunately this only works on server node. You may run the logic on server and store the result into a variable, and access that variable from agent if necessary.