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

\coursecat::get_all $options.returnhidden param allows not user visible categories to be returned

    XMLWordPrintable

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.5
    • None
    • Course
    • None
    • MOODLE_35_STABLE

    Description

      For what I understand \coursecat::get_all is supposed to check that the user has permissions to see the categories. If 'returnhidden' option is provided permissions are not checked.

      It seems to me that

      if (!empty($options['returnhidden']) || $category->is_uservisible()) {
      

      should be converted to

      if ($category->is_uservisible() && ($options['returnhidden'] || $category->visible)) {
      

      Maybe it is just that I am not interpreting well how the function works or maybe we just need to update 'returnhidden' param docs, but the current returnhidden status is not clear and I can't see any usage of it in core that helps me confirm if it makes sense or not.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dmonllao David Monllaó
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: