title: Configure matrix authorization plugin using Groovy script
body: <p>I am learning to write the groovy script to configure matrix authorization plugin. I have written this script where only authenticated users can access Jenkins:</p>
  
  <pre><code>import jenkins.model.*
  import hudson.security.*
  import com.cloudbees.hudson.plugins.folder.properties.AuthorizationMatrixProperty
  
  try {
      def instance = Jenkins.getInstance()
      def realm = new HudsonPrivateSecurityRealm(false)
      instance.setSecurityRealm(realm)
  
      def strategy = new hudson.security.GlobalMatrixAuthorizationStrategy()
      strategy.add(Jenkins.ADMINISTER, 'authenticated')
      instance.setAuthorizationStrategy(strategy)
  
      instance.save()
  
  }
  catch(Throwable exc) {
      println '!!! Error configuring jenkins'
      org.codehaus.groovy.runtime.StackTraceUtils.sanitize(new Exception(exc)).printStackTrace()
      println '!!! Shutting down Jenkins to prevent possible mis-configuration from going live'
      jenkins.cleanUp()
      System.exit(1)
  }
  </code></pre>
  
  <p>Now, I want to configure this matrix plugin in a way that nobody can access the Jenkins settings area(even authenticated users can not access the Jenkins settings). I have done lot of research on that and not able to move forward with this. Any help/pointer will be appreciated. Thanks!</p>