setting roles in role-strategy-plugin through groovy script

420 views
Skip to first unread message

Maneesh M P

unread,
Jun 13, 2016, 7:03:47 PM6/13/16
to Jenkins Users

Can anyone help me to figure out to how to write a groovy script to set roles through groovy script in role based strategy ?

I am able to do it for MatrixAuthorization 

def strategy = new GlobalMatrixAuthorizationStrategy()
strategy.add(Jenkins.ADMINISTER, "test")  
strategy.add(Jenkins.READ, "test")  
strategy.add(Jenkins.RUN_SCRIPTS, "test")
instance.setAuthorizationStrategy(strategy)
instance.save()

but same way if i try for RoleBasedAuthorization it doesn't work
def strategy = new com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy()

Thanks,
Maneesh
Reply all
Reply to author
Forward
0 new messages