core - issue in calculating hasEditPermission

Currently, the ORM translation of the SQL query that is made to the
database to check whether a user can edit a MD or not (depending on
which group he belongs to) is the following:

"SELECT
  ...
FROM
  ...
WHERE
  user is EDITOR
AND
  userID = id
AND
  groupID = x AND groupID = y AND groupID = z ..."

The correct request that has to be made should end up with
"[...]
AND
  groupID IN (x,y,z,...)"
instead.

The following patch implements this "IN / OR" logic.
Tested manually, but please review.