Search in sources :

Example 1 with RestPermissions

use of org.graylog2.shared.security.RestPermissions in project graylog2-server by Graylog2.

the class PermissionsTest method testPluginPermissions.

@Test
public void testPluginPermissions() throws Exception {
    final ImmutableSet<Permission> pluginPermissions = ImmutableSet.of(Permission.create("foo:bar", "bar"), Permission.create("foo:baz", "baz"), Permission.create("hello:world", "hello"));
    final PermissionsPluginPermissions plugin = new PermissionsPluginPermissions(pluginPermissions);
    final Permissions permissions = new Permissions(ImmutableSet.of(restPermissions, plugin));
    assertThat(permissions.allPermissionsMap().get("foo")).containsOnly("bar", "baz");
    assertThat(permissions.allPermissionsMap().get("hello")).containsOnly("world");
}
Also used : Permission(org.graylog2.plugin.security.Permission) PluginPermissions(org.graylog2.plugin.security.PluginPermissions) Test(org.junit.Test)

Example 2 with RestPermissions

use of org.graylog2.shared.security.RestPermissions in project graylog2-server by Graylog2.

the class PermissionsTest method setUp.

@Before
public void setUp() throws Exception {
    restPermissions = new RestPermissions();
    permissions = new Permissions(ImmutableSet.of(restPermissions));
}
Also used : PluginPermissions(org.graylog2.plugin.security.PluginPermissions) Before(org.junit.Before)

Example 3 with RestPermissions

use of org.graylog2.shared.security.RestPermissions in project graylog2-server by Graylog2.

the class UserServiceImplTest method setUp.

@Before
public void setUp() throws Exception {
    this.mongoConnection = mongodb.mongoConnection();
    this.configuration = new Configuration();
    this.permissions = new Permissions(ImmutableSet.of(new RestPermissions()));
    this.userFactory = new UserImplFactory(configuration, permissions);
    this.userService = new UserServiceImpl(mongoConnection, configuration, roleService, accessTokenService, userFactory, permissionsResolver, serverEventBus, GRNRegistry.createWithBuiltinTypes(), permissionAndRoleResolver);
    when(roleService.getAdminRoleObjectId()).thenReturn("deadbeef");
}
Also used : RestPermissions(org.graylog2.shared.security.RestPermissions) Configuration(org.graylog2.Configuration) RestPermissions(org.graylog2.shared.security.RestPermissions) Permissions(org.graylog2.shared.security.Permissions) Before(org.junit.Before)

Aggregations

PluginPermissions (org.graylog2.plugin.security.PluginPermissions)2 Before (org.junit.Before)2 Configuration (org.graylog2.Configuration)1 Permission (org.graylog2.plugin.security.Permission)1 Permissions (org.graylog2.shared.security.Permissions)1 RestPermissions (org.graylog2.shared.security.RestPermissions)1 Test (org.junit.Test)1