use of com.thoughtworks.go.config.RoleUser in project gocd by gocd.
the class GoCDRoleConfigRepresenter method fromJSON.
public static RoleConfig fromJSON(JsonReader jsonReader) {
RoleConfig model = new RoleConfig();
if (jsonReader == null) {
return model;
}
jsonReader.readArrayIfPresent("users", users -> {
users.forEach(user -> model.addUser(new RoleUser(user.getAsString())));
});
return model;
}
use of com.thoughtworks.go.config.RoleUser in project gocd by gocd.
the class StageApprovalAuthorizationTest method shouldAuthorizeIfRoleIsInApprovalList.
@Test
public void shouldAuthorizeIfRoleIsInApprovalList() throws Exception {
CONFIG_HELPER.addSecurityWithAdminConfig();
CONFIG_HELPER.addRole(new RoleConfig(new CaseInsensitiveString("adminRole"), new RoleUser(new CaseInsensitiveString("tester"))));
StageConfig stage = StageConfigMother.custom("test", authConfigWithAdminRole);
PipelineConfig pipeline = CONFIG_HELPER.addStageToPipeline(PIPELINE_NAME, stage);
assertThat("User tester should have permission on test stage", securityService.hasOperatePermissionForStage(CaseInsensitiveString.str(pipeline.name()), CaseInsensitiveString.str(stage.name()), "tester"), is(true));
}
Aggregations