How to use project-based matrix authorization strategy for Jobs created using a job template?

Article ID:213492857
1 minute readKnowledge base

Issue

I am using enterprise jenkins along with template plugin. I have created a job template and I want the jobs that will be created from this template to also have the option to enable project based matrix authorization Matrix Authorization Strategy Plugin. I don’t know how this can be enabled.

Environment

Resolution

The configuration of project-based matrix authorization strategy for jobs is similar to other job properties. So you need to declare the hudson.security.AuthorizationMatrixProperty snippet in the proper location. The best way to get a sample configuration is to import it from an existing job using such control in Groovy Transformer.

In order to add the property conditionally, you can use conditional expressions in your template transformers. See Transformer Reference section in the documentation. There is an example for Conditional expression for groovy.

Please Note: The Jelly transformer is deprecated. Always use the Groovy transformer.