-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.1.13
-
None
-
MOODLE_401_STABLE
I found a problem with this query from lib/accesslib.php function get_roles_with_cap_in_context:
$sql = "SELECT rc.id, rc.roleid, rc.permission, ctx.depth
FROM {role_capabilities} rc
JOIN {context} ctx ON ctx.id = rc.contextid
JOIN {capabilities} cap ON rc.capability = cap.name
WHERE rc.capability = :cap AND ctx.id IN ($ctxids)
ORDER BY rc.roleid ASC, ctx.depth DESC";
The role_capabilities table should be joined with the role table because when a role is removed, the roleid data related column in the role_capabilities table remains. As a quick solution to address the missing cascade deletion, I suggest adding JOIN {role} r ON r.id = rc.roleid to the query.
I came across with the issue described above by clicling in settings tab in module forum after remove some user roles:
Exception - role_get_name(): Argument #1 ($role) must be of type stdClass, null given, called in [dirroot]/lib/accesslib.php on line 4634
- has been marked as being related by
-
MDL-80162 Glossary settings not working after upgrade to 4.3
-
- Open
-