Access to Moodle

Access to Moodle

by Lance Hinds -
Number of replies: 5

Hi All, 

I am trying to find a way to control access to my Moodle platform based on the time of day. Does anyone know of any feature that can do this. Looking to all responses. Thanks much. 

Lance Hinds h


Average of ratings: -
In reply to Lance Hinds

Re: Access to Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Well, you said "looking at all responses" ... sooooooo .... here's 'two cents' worth ....

Got Linux?

One could setup two cron jobs ... 1 to allow access and 2 to disallow access ... those cron jobs point to scripts in moodlecode/admin/cli/ ... one called 'online' the other called 'offline'.  Scripts belong to root user an no other group or others have any access to the scripts. Cannot be execute by the web interface even if Google discovers their existence. ;)

The 'online' script contains a moodle command to set the site *out* of the maintenance mode:

php /path/to/moodle/code/admin/cli/maintenance.php --disable

The 'offline' script ...

ditto but at the end --enable

That would keep the server up and you as admin user could still login to the moodle.

I think that would be the simplest ... and have the ability to reverse the state of access to the Moodle via command line.

But if you want something 'more difficult' see:

https://www.ntu.edu.sg/home/ehchua/programming/howto/Apache_HowToConfigure.html

which does suggest one could set a time of day but doesn't provide that specific example.

Have to ask cause am curious type ... what's the reason for desiring online/offline times?

'spirit of sharing', Ken


In reply to Ken Task

Re: Access to Moodle

by Lance Hinds -

I meant 'looking forward to all responses' the goodly fingers took on a mind of their own smile. Working on a project where we are providing free access to selected schools during daytime hours. Also researching how to lock it down by IP range.

Regards

 

In reply to Lance Hinds

Re: Access to Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

So there is some additional criteria *and* using a single instance of a Moodle accessed by multiple entities of which only one needs the time restriction.    Is that right?

Well, then forget what I suggested as that was for one site ... all entities that access.

Range of IP addresses ... now that could be done via .htaccess and apache config, but what about 'after hours'?   Users accessing could be using home computer, a borrowed laptop or personal device connected upstream to ?, on 'vacation' @ some resort, or just playing 'hookie'.    Good luck with sorting out a range of IP addresses at the OS level and/or IP restrictions in Moodle.   A whitelist or blacklisting of IP address ranges etc. is mega admin and never ending.

Anyone else care to share?

'spirit of sharing', Ken



In reply to Ken Task

Re: Access to Moodle

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I haven't used it myself, but this plugin https://moodle.org/plugins/auth_ip allows the admin to specify IP addresses (both individual and subnet ranges) for the clients. The IP restriction is in addition to providing the account password.

One could extend the plugin to include temporal restrictions too, with a moderate effort.

Saludos. Iñaki.

Average of ratings: Useful (1)
In reply to Iñaki Arenaza

Re: Access to Moodle

by Ray Lawrence -

Recent versions allow IP based restrictions by default.

As Ken mentioned a cron based solution could work. Maybe to suspend/make active, but I can envisage a lack of granularity in that approach even as I type.