Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-13160

get_context_users_bycap() fails when there are no roles implementing a capability

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: Roles / Access
    • Labels:
      None
    • Environment:
      Postgres 8.2
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Here's what I am doing:

      $contextuser = get_context_instance(CONTEXT_USER, $userid);
      $users = get_context_users_bycap($contextuser, 'mymodule:myrole');

      And the error I get:

      ERROR: syntax error at or near ")" LINE 12: AND ra.roleid IN () ^

      SELECT u.id,u.username, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel FROM mdl_user u JOIN mdl_context ctx ON (u.id=ctx.instanceid AND ctx.contextlevel=30) JOIN (SELECT ra.userid, SUM(rc.permission) AS permission FROM mdl_role_assignments ra JOIN mdl_role_capabilities rc ON (ra.roleid = rc.roleid AND rc.contextid IN (1,34)) WHERE ra.contextid IN (1,34) AND ra.roleid IN () GROUP BY ra.userid) up ON u.id = up.userid WHERE up.permission > 0 AND u.username != 'guest'

      • line 692 of lib/dmllib.php: call to debugging()
      • line 1177 of lib/accesslib.php: call to get_recordset_sql()
      • line 739 of mod/lplan/lib.php: call to get_context_users_bycap()
      • line 103 of mod/lplan/approve.php: call to get_approvers()

        Attachments

          Activity

            People

            Assignee:
            martinlanghoff Martín Langhoff
            Reporter:
            francois Francois Marier
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              3/Mar/08