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

Badges assigned at course level don't check roles consistantly

XMLWordPrintable

    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • git@github.com:danmarsden/moodle.git
    • master_MDL-45583
    • Hide

      Go to Administration > Site administration > Users > Permissions > Define roles and add a new role called for example "Site badge awarder"
      Add it to the "System" context
      Set the following capabilities to "allow": moodle/badges:awardbadge, moodle/badges:viewbadges, moodle/badges:configurecriteria
      Assign this role to a user at the site level.

      Create a new badge inside a course
      Set the criteria "Manual issue by role" and only select the new role created.
      Enable the badge
      Make sure you are logged in as the user with that role (don't use site admin if possible)

      Try to assign the badge to a user.

      Show
      Go to Administration > Site administration > Users > Permissions > Define roles and add a new role called for example "Site badge awarder" Add it to the "System" context Set the following capabilities to "allow": moodle/badges:awardbadge, moodle/badges:viewbadges, moodle/badges:configurecriteria Assign this role to a user at the site level. Create a new badge inside a course Set the criteria "Manual issue by role" and only select the new role created. Enable the badge Make sure you are logged in as the user with that role (don't use site admin if possible) Try to assign the badge to a user.

      if you set up a badge at course level and set it to be assignable by a single role it only checks course context roles.
      $users = get_role_users($acceptedroles[0], $context, false, 'u.id', 'u.id ASC');
      due to "false" being passed in 3rd param.

      but if you select multiple roles it uses:
      get_user_roles($context, $USER->id);

      which checks parent contexts as well.

      so if you have a role at site level that allows badges to be assigned and the user exists at the site level when they try to assign a badge at course level (and only one role is used) they get the error "your current role assignment is not among the roles that can manually issue this badge."

            danmarsden Dan Marsden
            danmarsden Dan Marsden
            Ankit Agarwal Ankit Agarwal
            Damyon Wiese Damyon Wiese
            Sam Hemelryk Sam Hemelryk
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.