use of org.nzbhydra.config.ConfigChangedEvent in project nzbhydra2 by theotherp.
the class DontRestrictStatsAuthTest method shouldAllowChangingRestrictionsAtRuntime.
@Test
public void shouldAllowChangingRestrictionsAtRuntime() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/config").with(csrf())).andExpect(status().is(401));
baseConfig.getAuth().setRestrictAdmin(false);
authenticationFilter.handleConfigChangedEvent(new ConfigChangedEvent(this, new BaseConfig(), baseConfig));
mvc.perform(MockMvcRequestBuilders.get("/config").with(csrf())).andExpect(status().is(200));
}
use of org.nzbhydra.config.ConfigChangedEvent in project nzbhydra2 by theotherp.
the class HttpBasicAuthTest method shouldAllowChangingUserRolesAtRuntime.
@Test
public void shouldAllowChangingUserRolesAtRuntime() throws Exception {
checkMainStatsAndConfig("u", "u", 200, 403, 403);
baseConfig.getAuth().getUsers().get(0).setMaySeeStats(true);
baseConfig.getAuth().getUsers().get(0).setMaySeeAdmin(true);
userDetailsManager.handleConfigChangedEvent(new ConfigChangedEvent(this, new BaseConfig(), baseConfig));
checkMainStatsAndConfig("u", "u", 200, 200, 200);
}
use of org.nzbhydra.config.ConfigChangedEvent in project nzbhydra2 by theotherp.
the class HttpBasicAuthTest method setup.
@Before
public void setup() {
mvc = MockMvcBuilders.webAppContextSetup(context).apply(SecurityMockMvcConfigurers.springSecurity()).build();
baseConfig.getAuth().getUsers().get(0).setMaySeeStats(false);
baseConfig.getAuth().getUsers().get(0).setMaySeeAdmin(false);
userDetailsManager.handleConfigChangedEvent(new ConfigChangedEvent(this, new BaseConfig(), baseConfig));
}
Aggregations