Search in sources :

Example 6 with DBGrantService

use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.

the class ViewOwnershipToGrantsMigrationTest method setUp.

@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider objectMapperProvider, GRNRegistry grnRegistry, @Mock ClusterConfigService clusterConfigService, @Mock UserService userService, @Mock ViewSummaryService viewSummaryService) {
    this.userService = userService;
    this.grantService = new DBGrantService(mongodb.mongoConnection(), objectMapperProvider, grnRegistry);
    final EntityOwnershipService entityOwnershipService = new EntityOwnershipService(grantService, grnRegistry);
    final TestViewService viewService = new TestViewService(mongodb.mongoConnection(), objectMapperProvider, clusterConfigService, entityOwnershipService, viewSummaryService);
    this.migration = new ViewOwnerShipToGrantsMigration(userService, grantService, "admin", viewService, grnRegistry);
}
Also used : EntityOwnershipService(org.graylog.security.entities.EntityOwnershipService) DBGrantService(org.graylog.security.DBGrantService) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 7 with DBGrantService

use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.

the class RolesToGrantsMigrationTest method setUp.

@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider mongoJackObjectMapperProvider, GRNRegistry grnRegistry, TestUserService userService) {
    when(permissions.readerBasePermissions()).thenReturn(ImmutableSet.of());
    when(validator.validate(any())).thenReturn(ImmutableSet.of());
    this.grnRegistry = grnRegistry;
    roleService = new RoleServiceImpl(mongodb.mongoConnection(), mongoJackObjectMapperProvider, permissions, validator);
    dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, grnRegistry);
    this.userService = userService;
    DBGrantService dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, grnRegistry);
    migration = new RolesToGrantsMigration(roleService, userService, dbGrantService, grnRegistry, "admin");
}
Also used : DBGrantService(org.graylog.security.DBGrantService) RoleServiceImpl(org.graylog2.users.RoleServiceImpl) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

DBGrantService (org.graylog.security.DBGrantService)7 BeforeEach (org.junit.jupiter.api.BeforeEach)7 EntityOwnershipService (org.graylog.security.entities.EntityOwnershipService)2 EventBus (com.google.common.eventbus.EventBus)1 GRN (org.graylog.grn.GRN)1 BuiltinCapabilities (org.graylog.security.BuiltinCapabilities)1 Permissions (org.graylog2.shared.security.Permissions)1 RoleServiceImpl (org.graylog2.users.RoleServiceImpl)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1