JOIN {context} sc ON (sc.path = c.path OR sc.path LIKE ".$DB->sql_concat('c.path', "'/%'").")
JOIN {role_assignments} ra ON (ra.contextid = sc.id AND ra.roleid = rc.roleid)
JOIN {user} u ON u.id = ra.userid
- WHERE ".$DB->sql_bitand('cap.riskbitmask', RISK_XSS)."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', RISK_XSS)." <> 0
AND rc.permission = :capallow
AND u.deleted = 0";
$sql = "SELECT COUNT(DISTINCT rc.contextid)
FROM {role_capabilities} rc
JOIN {capabilities} cap ON cap.name = rc.capability
- WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))." <> 0
AND rc.permission = :capallow
AND rc.roleid = :roleid";
$sql = "SELECT COUNT(DISTINCT rc.contextid)
FROM {role_capabilities} rc
JOIN {capabilities} cap ON cap.name = rc.capability
- WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))." <> 0
AND rc.permission = :capallow
AND rc.roleid = :roleid";
$sql = "SELECT COUNT(DISTINCT rc.contextid)
FROM {role_capabilities} rc
JOIN {capabilities} cap ON cap.name = rc.capability
- WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))." <> 0
AND rc.permission = :capallow
AND rc.roleid = :roleid";
$sql = "SELECT DISTINCT rc.contextid
FROM {role_capabilities} rc
JOIN {capabilities} cap ON cap.name = rc.capability
- WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))." <> 0
AND rc.permission = :capallow
AND rc.roleid = :roleid";
$sql = "SELECT rc.roleid, rc.contextid
FROM {role_capabilities} rc
JOIN {capabilities} cap ON cap.name = rc.capability
- WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))."
+ WHERE ".$DB->sql_bitand('cap.riskbitmask', (RISK_XSS | RISK_CONFIG | RISK_DATALOSS))." <> 0
AND rc.permission = :capallow
AND rc.roleid $inroles
GROUP BY rc.roleid, rc.contextid
/**
* Returns the SQL text to be used in order to perform one bitwise AND operation
* between 2 integers.
+ *
+ * NOTE: The SQL result is a number and can not be used directly in
+ * SQL condition, please compare it to some number to get a bool!!
+ *
* @param integer int1 first integer in the operation
* @param integer int2 second integer in the operation
- * @return string the piece of SQL code to be used in your statement.
+ * @return string the piece of SQL code to be used in your statement
*/
public function sql_bitand($int1, $int2) {
return '((' . $int1 . ') & (' . $int2 . '))';
* Returns the SQL text to be used in order to perform one bitwise OR operation
* between 2 integers.
*
+ * NOTE: The SQL result is a number and can not be used directly in
+ * SQL condition, please compare it to some number to get a bool!!
+ *
* @param integer int1 first integer in the operation
* @param integer int2 second integer in the operation
* @return string the piece of SQL code to be used in your statement.
* Returns the SQL text to be used in order to perform one bitwise XOR operation
* between 2 integers.
*
+ * NOTE: The SQL result is a number and can not be used directly in
+ * SQL condition, please compare it to some number to get a bool!!
+ *
* @param integer int1 first integer in the operation
* @param integer int2 second integer in the operation
* @return string the piece of SQL code to be used in your statement.