use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.
the class EntityDependencyResolverTest method setUp.
@BeforeEach
void setUp(@Mock ContentPackService contentPackService, GRNRegistry grnRegistry, @Mock GRNDescriptorService grnDescriptorService, MongoDBTestService mongodb, MongoJackObjectMapperProvider objectMapperProvider) {
this.grnRegistry = grnRegistry;
DBGrantService dbGrantService = new DBGrantService(mongodb.mongoConnection(), objectMapperProvider, this.grnRegistry);
this.contentPackService = contentPackService;
this.grnDescriptorService = grnDescriptorService;
entityDependencyResolver = new EntityDependencyResolver(contentPackService, grnRegistry, grnDescriptorService, dbGrantService);
}
use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.
the class UserPermissionsToGrantsMigrationTest method setUp.
@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider mongoJackObjectMapperProvider, GRNRegistry grnRegistry, TestUserService userService, @Mock ViewService viewService) {
this.grnRegistry = grnRegistry;
this.viewService = viewService;
this.userSelfEditPermissionCount = new Permissions(ImmutableSet.of()).userSelfEditPermissions("dummy").size();
dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, grnRegistry);
this.userService = userService;
DBGrantService dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, grnRegistry);
migration = new UserPermissionsToGrantsMigration(userService, dbGrantService, grnRegistry, viewService, "admin");
}
use of org.graylog.security.DBGrantService 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);
}
use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.
the class EntitySharesServiceTest method setUp.
@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider mongoJackObjectMapperProvider, GRNRegistry grnRegistry) {
this.grnRegistry = grnRegistry;
dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, this.grnRegistry);
lenient().when(entityDependencyResolver.resolve(any())).thenReturn(ImmutableSet.of());
lenient().when(entityDependencyPermissionChecker.check(any(), any(), any())).thenReturn(ImmutableMultimap.of());
lenient().when(granteeService.getAvailableGrantees(any())).thenReturn(ImmutableSet.of());
final EventBus serverEventBus = mock(EventBus.class);
this.entitySharesService = new EntitySharesService(dbGrantService, entityDependencyResolver, entityDependencyPermissionChecker, grnRegistry, granteeService, serverEventBus);
// TODO this is needed to initialize the CAPABILITIES field
new BuiltinCapabilities();
}
use of org.graylog.security.DBGrantService in project graylog2-server by Graylog2.
the class GranteeSharesServiceTest method setUp.
@BeforeEach
void setUp(MongoDBTestService mongodb, MongoJackObjectMapperProvider mongoJackObjectMapperProvider, GRNRegistry grnRegistry, @Mock GRNDescriptorService grnDescriptorService, @Mock GranteeService granteeService) {
this.grnDescriptorService = grnDescriptorService;
final DBGrantService dbGrantService = new DBGrantService(mongodb.mongoConnection(), mongoJackObjectMapperProvider, grnRegistry);
when(granteeService.getGranteeAliases(any(GRN.class))).thenAnswer(a -> Collections.singleton(a.getArgument(0)));
this.granteeSharesService = new GranteeSharesService(dbGrantService, grnDescriptorService, granteeService);
}
Aggregations