Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-16 Thread Nicky Ramone
Stephen, thanks very much to you too. I did it with DescriptorImpl and I'm fine now. On Wed, Aug 15, 2012 at 7:08 PM, Jesse Glick jgl...@cloudbees.com wrote: On 08/15/2012 05:51 PM, Stephen Connolly wrote: ${instance} should be the instance of your notifier or null if not reconfiguring

Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Nicky Ramone
Hi In a plugin I'm writing, I need to hide a textbox in the project configuration depending on the user permission. My @DataBoundConstructor is in a Notifier class. How can I retrieve the user permissions? Thanks. Cheers.

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Jesse Glick
On 08/15/2012 11:53 AM, Nicky Ramone wrote: In a plugin I'm writing, I need to hide a textbox in the project configuration depending on the user permission. My @DataBoundConstructor is in a Notifier class. How can I retrieve the user permissions? Making your plugin behave in secured Jenkins

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Nicky Ramone
Thanks , it's what I was looking for. However, I still don't understand the following snippet in the example found in your link: j:if test=${h.hasPermission(app.ADMINISTER)} ... /j:if I'm not clear on what 'app' is, although it looks like the Jenkins object. I've tried doing this: j:if

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Jesse Glick
On 08/15/2012 03:25 PM, Nicky Ramone wrote: I'm not clear on what 'app' is, although it looks like the Jenkins object. Right. I have defined the getMyCustomPermission() method, but it doesn't work. Maybe the 'it' variable is not correctly parsed when being inside ${h...}? It ought to

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Nicky Ramone
This is the result of the output with the debugging lines: This is the result of the output with the debugging lines: it=hudson.model.FreeStyleProject@3d2a58[dummy2] it.myCustomPermission= I'm kinda lost. I thought 'it' was supposed to be an instance of MyCustomNotifier. So that's why it can't

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Jesse Glick
On 08/15/2012 03:52 PM, Nicky Ramone wrote: it=hudson.model.FreeStyleProject@3d2a58[dummy2] I'm kinda lost. I thought 'it' was supposed to be an instance of MyCustomNotifier. If you are on the configure screen for a project, then 'it' would be the project. In general there _is_ no

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Nicky Ramone
Cool. I'll try to do it with invokeStatic until I can find a neater way. Thanks very much for your help! Regards. On Wed, Aug 15, 2012 at 5:05 PM, Jesse Glick jgl...@cloudbees.com wrote: On 08/15/2012 03:52 PM, Nicky Ramone wrote: it=hudson.model.**FreeStyleProject@3d2a58[**dummy2] I'm

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Stephen Connolly
On 15 August 2012 21:05, Jesse Glick jgl...@cloudbees.com wrote: On 08/15/2012 03:52 PM, Nicky Ramone wrote: it=hudson.model.**FreeStyleProject@3d2a58[**dummy2] I'm kinda lost. I thought 'it' was supposed to be an instance of MyCustomNotifier. If you are on the configure screen for a

Re: Jelly views: Avoid displaying config section depending on user permissions

2012-08-15 Thread Jesse Glick
On 08/15/2012 05:51 PM, Stephen Connolly wrote: ${instance} should be the instance of your notifier or null if not reconfiguring ${descriptor} should be the descriptor of your notifier, so just stick the getter in the DescriptorImpl and you should be fine, no need for j:invokeStatic Thanks