Merge branch 'hotfix/group-for-org' into 'release'
Filtering out the groups to only return those that belong to the user's current organization See merge request theappsmith/internal-tools-server!140
This commit is contained in:
commit
4eecb3a7cc
|
|
@ -19,6 +19,7 @@ import java.util.Set;
|
||||||
public class GroupServiceImpl extends BaseService<GroupRepository, Group, String> implements GroupService {
|
public class GroupServiceImpl extends BaseService<GroupRepository, Group, String> implements GroupService {
|
||||||
|
|
||||||
private final GroupRepository repository;
|
private final GroupRepository repository;
|
||||||
|
private final SessionUserService sessionUserService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GroupServiceImpl(Scheduler scheduler,
|
public GroupServiceImpl(Scheduler scheduler,
|
||||||
|
|
@ -26,14 +27,20 @@ public class GroupServiceImpl extends BaseService<GroupRepository, Group, String
|
||||||
MongoConverter mongoConverter,
|
MongoConverter mongoConverter,
|
||||||
ReactiveMongoTemplate reactiveMongoTemplate,
|
ReactiveMongoTemplate reactiveMongoTemplate,
|
||||||
GroupRepository repository,
|
GroupRepository repository,
|
||||||
AnalyticsService analyticsService) {
|
AnalyticsService analyticsService,
|
||||||
|
SessionUserService sessionUserService) {
|
||||||
super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService);
|
super(scheduler, validator, mongoConverter, reactiveMongoTemplate, repository, analyticsService);
|
||||||
this.repository = repository;
|
this.repository = repository;
|
||||||
|
this.sessionUserService = sessionUserService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Flux<Group> getAllById(Set<String> ids) {
|
public Flux<Group> getAllById(Set<String> ids) {
|
||||||
return this.repository.findAllById(ids);
|
return sessionUserService.getCurrentUser()
|
||||||
|
.flatMapMany(user -> {
|
||||||
|
String organizationId = user.getCurrentOrganizationId();
|
||||||
|
return repository.getAllByOrganizationId(organizationId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user