use of com.thoughtworks.go.config.Authorization in project gocd by gocd.
the class CcTrayViewAuthorityTest method shouldNotConsiderAllUsersAsViewersOfAGroup_WhenExplicitGroupAdminIsSetup.
@Test
public void shouldNotConsiderAllUsersAsViewersOfAGroup_WhenExplicitGroupAdminIsSetup() throws Exception {
configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1A", "job1A1", "job1A2");
configMother.addAdminUserForPipelineGroup(config, "groupadmin1", "group1");
PipelineConfigs group = config.findGroup("group1");
assertThat(group.getAuthorization(), is(not(new Authorization())));
Viewers viewersOfGroup1 = getGroupsAndTheirViewers().get("group1");
assertThat(viewersOfGroup1.contains("groupadmin1"), is(true));
assertThat(viewersOfGroup1.contains("some-user"), is(false));
assertThat(viewersOfGroup1.contains("some-other-user"), is(false));
}
use of com.thoughtworks.go.config.Authorization in project gocd by gocd.
the class CcTrayViewAuthorityTest method shouldConsiderAllUsersAsViewersOfAGroupWithNoAuthorizationConfigurationSetup.
@Test
public void shouldConsiderAllUsersAsViewersOfAGroupWithNoAuthorizationConfigurationSetup() throws Exception {
configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1A", "job1A1", "job1A2");
PipelineConfigs group = config.findGroup("group1");
assertThat(group.getAuthorization(), is(new Authorization()));
Viewers viewersOfGroup1 = getGroupsAndTheirViewers().get("group1");
assertThat(viewersOfGroup1.contains("some-user"), is(true));
assertThat(viewersOfGroup1.contains("some-other-user"), is(true));
assertThat(viewersOfGroup1.contains("any-random-user"), is(true));
}
use of com.thoughtworks.go.config.Authorization in project gocd by gocd.
the class CcTrayViewAuthorityTest method shouldConsiderAllUsersAsViewersOfAGroupWithNoAuthorizationConfigurationSetup_EvenWhenExplicitSuperAdminsAreSetup.
@Test
public void shouldConsiderAllUsersAsViewersOfAGroupWithNoAuthorizationConfigurationSetup_EvenWhenExplicitSuperAdminsAreSetup() throws Exception {
configMother.addPipelineWithGroup(config, "group1", "pipeline1", "stage1A", "job1A1", "job1A2");
configMother.addUserAsSuperAdmin(config, "superadmin1");
PipelineConfigs group = config.findGroup("group1");
assertThat(group.getAuthorization(), is(new Authorization()));
Viewers viewersOfGroup1 = getGroupsAndTheirViewers().get("group1");
assertThat(viewersOfGroup1.contains("superadmin1"), is(true));
assertThat(viewersOfGroup1.contains("some-user"), is(true));
assertThat(viewersOfGroup1.contains("some-other-user"), is(true));
assertThat(viewersOfGroup1.contains("any-random-user"), is(true));
}
use of com.thoughtworks.go.config.Authorization in project gocd by gocd.
the class MingleConfigServiceIntegrationTest method setUp.
@Before
public void setUp() throws Exception {
dbHelper.onSetUp();
configHelper = new GoConfigFileHelper(goConfigDao);
configHelper.onSetUp();
configHelper.addPipeline("bar", "stage", MaterialConfigsMother.defaultMaterialConfigs(), "build");
pipelineConfig = configHelper.addPipeline("foo", "stage", MaterialConfigsMother.defaultMaterialConfigs(), "build");
configHelper.addMingleConfigToPipeline("foo", new MingleConfig("https://some-tracking-tool:8443", "project-super-secret", "hello=world"));
CruiseConfig cruiseConfig = configHelper.load();
PipelineConfigs group = cruiseConfig.findGroup("defaultGroup");
group.setAuthorization(new Authorization(new ViewConfig(new AdminUser(new CaseInsensitiveString("authorized_user")))));
configHelper.writeConfigFile(cruiseConfig);
SecurityConfig securityConfig = new SecurityConfig(new LdapConfig(new GoCipher()), new PasswordFileConfig("/tmp/foo.passwd"), true);
securityConfig.adminsConfig().add(new AdminUser(new CaseInsensitiveString("admin")));
configHelper.addSecurity(securityConfig);
}
Aggregations