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

unable to add sub category by using a user with Admin role in parent category

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Minor Minor
    • 1.9.4
    • 1.9.2
    • Administration
    • None
    • MOODLE_19_STABLE
    • MOODLE_19_STABLE
    • Easy

      i set a user to be an Admin (role) on some category and tried to use
      that user to add new sub categories under that category... and was not able to.

      i was keep getting the "add new category" page filled with what i defined previously
      but i could not submit it.

      to solve this issue i had to:

      open course/editcategory_form.php and change line 28 from:
      $mform->addElement('hidden', 'id', null);
      to:
      $mform->addElement('hidden', 'id', $this->_customdata['id']);

      and open course/editcategory.php and change line 69 from :
      if (empty($category) && has_capability('moodle/category:create', $context)) { // Create a new category
      to:
      if (empty($category) && has_capability('moodle/category:create', get_context_instance(CONTEXT_COURSECAT, $id,$USER))) { // Create a new category

      and line 75 from :
      redirect('index.php?categoryedit=on');
      to:
      redirect('category.php?id='.$id.'&categoryedit=on');

      it was not passing the category id to the form and it was not checking
      the capabilities against the specific user in that specific category.
      as far as i can tell.

      now it works fine

            poltawski Dan Poltawski
            nadavkav Nadav Kavalerchik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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