make sure that we don't find the wrong shares if a user and a group have the same ID

Make sure that always the right users see the shared file if users and groups with the same ID exists.

Steps to test:

- create a user "foo"
- create a user "testUser"
- create a group "foo"
- add user "testUser" to group "foo"
- share file with user "foo" and check that only user "foo" can see the file
- unshare for user "foo" and share it with group "foo" make sure that onls "testUser" can see the file

fix #12211 
same for tearDown()