$contact_str = '<' . $contact_id . '>';
- $condition = ["`uid` = ? AND (`allow_cid` = '' OR`allow_cid` REGEXP ?)
- AND (`deny_cid` = '' OR NOT `deny_cid` REGEXP ?)
- AND (`allow_gid` = '' OR `allow_gid` REGEXP ?)
- AND (`deny_gid` = '' OR NOT `deny_gid` REGEXP ?)",
- $uid, $contact_str, $contact_str, $group_str, $group_str];
+ $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR deny_gid REGEXP ?)
+ AND (allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
+ $uid, $contact_str, $group_str, $contact_str, $group_str];
$ret = DBA::select('permissionset', ['id'], $condition);
$set = [];