LPS-46117 Fixing resource browser when staging environment

Hey Julio,

This is what I've mentioned during the weekly engineering meeting, the resource browser in the CKEditor was not working properly when staging was turned on. This is fixing the issue. The root cause was that we used the scope group id to find out if we should consider the staging group at all, but better use the doAsGroupId as we are setting that explicitly from where we are coming.

I also did a little refactoring.

Thanks,

Máté