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

Unenrol self button shows on profile, but cant complete

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.9
    • Component/s: General, Roles / Access
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      Bug in user/view.php that shows the unenrol self button when you don't have the moodle/role:unassignself, but you do the moodle/role:assign role. To bring this more in line with how course/unenrol.php and the admin block work, it should be changed so that the button doesn't show (you get an error if you try to use it anyways.

      This is a diff of my proposed fix:

      Index: user/view.php
      ===================================================================
      RCS file: /cvsroot/moodle/moodle/user/view.php,v
      retrieving revision 1.168.2.4
      diff -r1.168.2.4 view.php
      451c451
      < (has_capability('moodle/role:assign', $coursecontext, NULL) && // I can assign roles

      > ($user->id != $USER->id && has_capability('moodle/role:assign', $coursecontext, NULL) && // I can assign roles

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            emerrill Eric Merrill
            Tester:
            Séverin Terrier
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

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