Re: Access M2 Release Plugin release permission through groovy

2017-05-18 Thread Tina Danielsson
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 jenkinsci-use...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com
>  
> 
> .
> 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 jenkinsci-users+unsubscr...@googlegroups.com.
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.


Re: Access M2 Release Plugin release permission through groovy

2017-05-17 Thread James Nord

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?

|
importhudson.security.*

defjob =Hudson.instance.items.find{job ->job.name =="MyJob"}
defauthorizationMatrixProperty
=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 jenkinsci-users+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com 
.

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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/10f8985b-6acb-1cec-a85b-1ce48ab591b5%40teilo.net.
For more options, visit https://groups.google.com/d/optout.


Re: Access M2 Release Plugin release permission through groovy

2017-05-16 Thread Logan Twedt
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4f03307f-0a28-4af2-8b5a-9af572d80300%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.