This would be a nice feature to get a full picture of what permissions are applied by inheritance.
I have the following JCasC and JobDSL working:
jobs:
- script: |
folder("Test") {
properties {
folderCredentialsProperty {
domainCredentials {
domainCredentials {
domain {
name("Test creds")
description("Credentials only for Test folder")
}
credentials {
usernamePasswordCredentialsImpl {
scope("GLOBAL")
id("test-git-token")
description("Git token")
username("git")
password("git-password")
}
}
}
}
}
}
}
- script: |
folder('Test') {
properties {
authorizationMatrix {
inheritanceStrategy {}
permissions([
'USER:Job/Read:user1','USER:Job/Cancel:user1','USER:Job/Build:user1',
'USER:Job/Read:user2','USER:Job/Cancel:user2','USER:Job/Build:user2',
])
}
}
}
- script: |
multibranchPipelineJob('Test/test-job') {
properties {
authorizationMatrix {
}
}
displayName('test-job')
branchSources {
branchSource {
source {
git {
id('Test/test-job')
serverName('git-server')
credentialsId('ssh-key')
projectPath('Test/test-job')
}
}
}
}
}
You can see permissions at the Folder level (ignore the user not found error)

On the actually job the following only shows up if I add authorizationMatrix{} to the JobDSL

Not really straightforward. I have to think about this.
Meanwhile, https://plugins.jenkins.io/security-inspector/ might be an adequate workaround.