Moodle
  1. Moodle
  2. MDL-35216

Introduce Admin setting for controlling (allow/prevent) guest access to My Moodle

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.1
    • Fix Version/s: 2.4, STABLE backlog
    • Component/s: My home
    • Labels:
    • Testing Instructions:
      Hide

      // Test guest access

      With:

      • Security -> Site policies: 'Force users to login' enabled.
      • Users -> Permissions -> User policies: 'Auto-login guests' enabled.
      • Appearance -> Navigation: Default home page for users = site/my moodle/user preference

      // guests allowed

      • Appearance -> Navigation: Prevent guest access to My Moodle = no (default)
      1. Logged in as guest go to My Moodle (e.g. by direct url http://your-moodle-domain.com/my).
      2. Expected: My Moodle page shows system default, no editing.

      // guests not allowed

      • Appearance -> Navigation: Prevent guest access to My Moodle = yes
      1. Logged in as guest go to My Moodle (e.g. by direct url http://your-moodle-domain.com/my).
      2. Expected: You should be redirected to front page.
      Show
      // Test guest access With: Security -> Site policies: 'Force users to login' enabled. Users -> Permissions -> User policies: 'Auto-login guests' enabled. Appearance -> Navigation: Default home page for users = site/my moodle/user preference // guests allowed Appearance -> Navigation: Prevent guest access to My Moodle = no (default) Logged in as guest go to My Moodle (e.g. by direct url http://your-moodle-domain.com/my ). Expected: My Moodle page shows system default, no editing. // guests not allowed Appearance -> Navigation: Prevent guest access to My Moodle = yes Logged in as guest go to My Moodle (e.g. by direct url http://your-moodle-domain.com/my ). Expected: You should be redirected to front page.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Rank:
      43856

      Description

      This issue proposes an Admin setting for controlling guests' access to My Moodle, which defaults to 'allow' as per current behaviour. If set to prevent guest access, guests trying to enter My Moodle will be redirected to front page.

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          I'm loathed to add another setting, but...

          Show
          Michael de Raadt added a comment - I'm loathed to add another setting, but...
          Hide
          Frédéric Massart added a comment -

          Hi Itamar,

          Thank you for providing this solution. While I am not sure whether we should have this setting or not, here are my comments on your patch.

          We are trying not to have negative settings as they are confusing from the developer point of view. Perhaps you could rename the setting to allowguestmymoodle which would be allowed by default.

          I would suggest you to use the class moodle_url in the redirect function as we try to standardise its use.

          Last thing is the minor '.' missing at the end of your comment.

          Cheers!

          Show
          Frédéric Massart added a comment - Hi Itamar, Thank you for providing this solution. While I am not sure whether we should have this setting or not, here are my comments on your patch. We are trying not to have negative settings as they are confusing from the developer point of view. Perhaps you could rename the setting to allowguestmymoodle which would be allowed by default. I would suggest you to use the class moodle_url in the redirect function as we try to standardise its use. Last thing is the minor '.' missing at the end of your comment. Cheers!
          Hide
          Itamar Tzadok added a comment -

          Thanks Frédéric.

          We should have this setting b/c there is an actual scenario where guests should not be allowed into My Moodle page that is designed for registered users.

          Setting changed to allow with default yes.
          Redirect url changed to moodle_url.
          Comment ends with '.'.

          Show
          Itamar Tzadok added a comment - Thanks Frédéric. We should have this setting b/c there is an actual scenario where guests should not be allowed into My Moodle page that is designed for registered users. Setting changed to allow with default yes. Redirect url changed to moodle_url. Comment ends with '.'.
          Hide
          Frédéric Massart added a comment - - edited

          Thanks Itamar, I am pushing your patch for integration. Cheers!

          Edit: https://github.com/itamart/moodle/compare/MDL-35216#L2R51 is still missing the . though

          Show
          Frédéric Massart added a comment - - edited Thanks Itamar, I am pushing your patch for integration. Cheers! Edit: https://github.com/itamart/moodle/compare/MDL-35216#L2R51 is still missing the . though
          Hide
          Itamar Tzadok added a comment -

          Ah, now I see which comment you meant. Sorry about that. Perhaps we could let this one pass and dot in the next one. Thanks for the review.

          Show
          Itamar Tzadok added a comment - Ah, now I see which comment you meant. Sorry about that. Perhaps we could let this one pass and dot in the next one. Thanks for the review.
          Hide
          Frédéric Massart added a comment -

          Well, you can still amend your commit, the integrators won't work on your issue until Monday at best.

          Show
          Frédéric Massart added a comment - Well, you can still amend your commit, the integrators won't work on your issue until Monday at best.
          Hide
          Itamar Tzadok added a comment -

          Done.

          Show
          Itamar Tzadok added a comment - Done.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          I'm not a fan of a new setting for this, but seems the way wanted in the other issue.

          I've integrated this to 2.4 only as its 'a new feature'.

          Show
          Dan Poltawski added a comment - I'm not a fan of a new setting for this, but seems the way wanted in the other issue. I've integrated this to 2.4 only as its 'a new feature'.
          Hide
          Mark Nelson added a comment -

          When redirecting it adds '/?redirect=0' to the end of the front page URL. Doesn't have any affect on Moodle's behaviour, just thought I would point this out.

          Show
          Mark Nelson added a comment - When redirecting it adds '/?redirect=0' to the end of the front page URL. Doesn't have any affect on Moodle's behaviour, just thought I would point this out.
          Hide
          Dan Poltawski added a comment -

          Congratulations, you've done it!

          Thanks, this change is now in the latest weekly release!

          Join the crowds of people tomorrow from 8am and download this Moodle release from your local apple store!

          Show
          Dan Poltawski added a comment - Congratulations, you've done it! Thanks, this change is now in the latest weekly release! Join the crowds of people tomorrow from 8am and download this Moodle release from your local apple store!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: