use of org.jenkinsci.test.acceptance.plugins.matrix_auth.MatrixAuthorizationStrategy in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method runBuildAsUserWhoTriggered.
/**
* Add project default build access control to the global security configuration.
* Additionally the permission ist added to 'user' that allows users to run
* jobs as them on agents. Without this permission the job could not be executed.
* @param sc A global security configuration.
*/
private void runBuildAsUserWhoTriggered(GlobalSecurityConfig sc) {
jenkins.login().doLogin(ADMIN);
sc.configure(() -> {
final ProjectDefaultBuildAccessControl control = sc.addBuildAccessControl(ProjectDefaultBuildAccessControl.class);
control.runAsUserWhoTriggered();
MatrixAuthorizationStrategy mas = sc.useAuthorizationStrategy(MatrixAuthorizationStrategy.class);
mas.getUser(USER).on("hudson.model.Computer.Build");
});
jenkins.logout();
}
Aggregations