You are my hero James! It worked :)

import hudson.security.*
import org.jvnet.hudson.plugins.m2release.*

def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
def authorizationMatrixProperty = 
job.getProperty(AuthorizationMatrixProperty.class)

authorizationMatrixProperty?.add(M2ReleaseBuildWrapper.DescriptorImpl.CREATE_RELEASE,"TESTUSER")



On Wednesday, 17 May 2017 23:19:49 UTC+2, James Nord wrote:
>
> Did you try 
>     
> org.jvnet.hudson.plugins.m2release.M2ReleaseBuildWrapper.DescriptorImpl.CREATE_RELEASE
>  
> ?
>
> /James
>
>
>
> On 5/16/2017 7:50 PM, Logan Twedt wrote:
>
> Hi Tina, et all,
>
> I'm also trying to configure the Release permission using a groovy script. 
> I do see that the permission is called CREATE_RELEASE inside an inner 
> class in the m2Release plugin code on GitHub: 
> https://github.com/jenkinsci/m2release-plugin/blob/2f2865cffdd7e4be2a60156f245fabc9508d870b/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java
>  
> - but I've also tried that Permission name and it doesn't work. Maybe I'm 
> reading that code wrong, not sure.
>
> Has anyone been able to get this working?
>
> -Logan
>
> On Thursday, April 6, 2017 at 9:59:42 AM UTC-5, Tina Danielsson wrote: 
>>
>> I'm trying to create a groovy script where I set the release permissions 
>> fort he M2 Release Plugin. But I can't figure out how to do that. The build 
>> in permissons can be accessed via hudson.model.Item.PROPERTY, for example 
>> hudson.model.Item.CANCEL. But hudson.model.Item.Release just returns "No 
>> such property".
>>
>> Any ideas on how to access this property?
>>
>> import hudson.security.*
>>
>> def job = Hudson.instance.items.find{job -> job.name == "MyJob"}
>> def authorizationMatrixProperty = job.getProperty(
>> AuthorizationMatrixProperty.class)
>>
>> authorizationMatrixProperty?.add(hudson.model.Item.CANCEL,"TESTUSER")
>> authorizationMatrixProperty?.add(hudson.model.Item.RELEASE,"TESTUSER")
>>
>>
>> -- 
> You received this message because you are subscribed to the Google Groups 
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ff456b35-6552-4830-af89-801e94b9b1b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to