Search in sources :

Example 1 with EntityOwnershipService

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

the class ViewSharingToGrantsMigrationTest method setUp.

@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider objectMapperProvider, GRNRegistry grnRegistry, @Mock ClusterConfigService clusterConfigService, @Mock UserService userService, @Mock RoleService roleService) {
    this.dbCollection = mongodb.mongoCollection("view_sharings");
    this.userService = userService;
    this.roleService = roleService;
    this.grantService = new DBGrantService(mongodb.mongoConnection(), objectMapperProvider, grnRegistry);
    when(userService.load(anyString())).thenAnswer(a -> {
        final String argument = a.getArgument(0);
        return createUser(argument);
    });
    final EntityOwnershipService entityOwnershipService = new EntityOwnershipService(grantService, grnRegistry);
    final TestViewService viewService = new TestViewService(mongodb.mongoConnection(), objectMapperProvider, clusterConfigService, entityOwnershipService);
    this.migration = new ViewSharingToGrantsMigration(mongodb.mongoConnection(), grantService, userService, roleService, "admin", viewService, grnRegistry);
}
Also used : EntityOwnershipService(org.graylog.security.entities.EntityOwnershipService) DBGrantService(org.graylog.security.DBGrantService) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EntityOwnershipService

use of org.graylog.security.entities.EntityOwnershipService 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)

Aggregations

DBGrantService (org.graylog.security.DBGrantService)2 EntityOwnershipService (org.graylog.security.entities.EntityOwnershipService)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1