Hi Everyone, Trying to add user with permission. Using AzureAD auth strategy. So far used below -
stage('Update Jenkins Security Matrix') {
steps {
script {
def userId = env.userObjectId
def permission = hudson.model.Hudson.Administer
def azureStrategy = Jenkins.instance.getAuthorizationStrategy()
def permissionEntry = new org.jenkinsci.plugins.matrixauth.PermissionEntry(permission, userId)
azureStrategy.add(permission, permissionEntry)
Jenkins.instance.save()
}
}
}
Getting error :
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: dafbe164-8fec-45cc-85f3-253d8806485b **14:31:04** groovy.lang.MissingPropertyException: No such field found: field java.lang.Class Administer **14:31:04** at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.unclassifiedField(SandboxInterceptor.java:402) **14:31:04** at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:386) **14:31:04** at org.kohsuke.groovy.sandbox.impl.Checker$7.call(Checker.java:375)