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

If passwordunmask field is hardcoded in config.php, do not show the value

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_35_STABLE

      Description

      A number of passwordunmask fields should (in some situations) be hidden from admins, e.g. if you don't want Moodle admins to know the passwords for, e.g.:

      • auth_cas | bind_pw
      • enrol_database | dbpass
      • logstore_database | dbpass

      There's cases where admins do set these values via the Moodle UI, and in those cases it should be visible.

      One flexible way to do this is to prevent the value of passwordunmask fields from being populated if the value is hard-coded in config.php

      pseuocode

      class admin_setting_configpasswordunmask extends admin_setting_configtext {
      ...
          public function output_html($data, $query='') {
              global $OUTPUT;
              $context = (object) [
                  'id' => $this->get_id(),
                  'name' => $this->get_full_name(),
                  'size' => $this->size,
                  'value' => (isset($CFG->...):'':$data),
                  'forceltr' => $this->get_force_ltr(),
              ];
              $element = $OUTPUT->render_from_template('core_admin/setting_configpasswordunmask', $context);
              return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', null, $query);
          }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mwebster Mark van Hoek
                Participants:
                Component watchers:
                Jake Dallimore, Jun Pataleta, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: