Make moodle run with only one user

Make moodle run with only one user

by giota papa -
Number of replies: 11
Hi, i'm trying to make moodle run with only one user...which means that i want moodle works with a user who don't have to login. When the user opens moodle he can answer a quiz or read a text.

I tried to delete all the logins which refered to simple users and guests and so i left only the admin user but it didn't run and no error was mentioned. Also, there are too many files that i don't know where to start modify the code to have the result i want.

How can i make moodle run with only one user without login?
From where can i start to modify the code?

If anyone has any idea for my subject please let me know because i face this problem for over two weeks sad

Thanks in advance
Giotasmiley.gif



Average of ratings: -
In reply to giota papa

Re: Make moodle run with only one user

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi

Well, firstly, I consider this out of topic of this forum (Moodle.org desing) - this thread should be moved probably to General developers forum.

Giota, imho you are going wrong way. Trying to hack all relevant libraries and scripts to force multi-user platform like Moodle to behave like a single-user environment is similar to trying to hack Linux kernel to behave like MS DOS.
Try to define your requirements in more details. Why do you need just one account? May it be you just want some your quizzes to be public? You can try to tweak your roles and permission overrides system to reach that goal then.
In reply to David Mudrák

Απάντηση: Re: Make moodle run with only one user

by giota papa -
My graduation project is about Moodle and one of the cases which i will resolve is: how we can make Moodle run with only one user in a PC and this user the only thing he can do is to import a txt file for his education or import questions to answer to confirm his education.
That's why i need only one account. And when the user runs moodle i want to have full access without login.

I couldn't understand what you mean with the sentence: "You can try to tweak your roles and permission overrides system to reach that goal then"
Could you please explain it to me?

Thanks
In reply to giota papa

Re: Απάντηση: Re: Make moodle run with only one user

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
> Could you please explain it to me?

I recommend to start with reading http://docs.moodle.org/en/Roles
You will always need a user to be logged in. You can, however, hack your setup.php (the file being called by config.php) which sets up the whole environment to automatically create a $USER global object and "fake" the login procedure. IMHO admin user will be fine here.
In reply to David Mudrák

Απάντηση: Re: Απάντηση: Re: Make moodle run with only one user

by giota papa -
I'll try to hack the setup.php and i'll let you know.

thanks a lot!
In reply to giota papa

Re: Απάντηση: Re: Make moodle run with only one user

by Chris Collman -
Picture of Documentation writers
I am sure glad you and David know what you are doing. Have fun with the hack!

"You can try to tweak your roles and permissions" means to me: you can modify any role in Moodle. As you know, Roles are a specific set of specific permissions. I believe that extends to the guest role. Thus if you have a stand alone Moodle (localhost on one PC or thumbdrive/stick), my way would be to modify the guest role permissions to achieve the result you want. The user would push the guest button.

And or, I would find the language file (moodle.php, I believe) and modify the part that gives login instructions. That way any potential student will know how to log in. This is what happens on demo.moodle.org .

What is interesting in your problem is that admin is a user. So does that mean literally one user, or one universal user that has limited privileges. I know it is possible to get rid of all admin and teachers once a site has been created but smile

Have fun with the hack which will probably be more impressive to the evaluator of your problem.

Best to both Chris


Average of ratings: Useful (1)
In reply to Chris Collman

Re: Απάντηση: Re: Make moodle run with only one user

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Hi Chris,
thanks for your contribution. I read again previous post saying

"with only one user in a PC and this user the only thing he can do is to import a txt file for his education or import questions to answer to confirm his education"

and I have realized admin user is not adequate here. However, I am a little bit afraid about the Guest role suggested. I have not checked the source code but imho there are some additional checks preventing Guests from creating anything. I am not sure about this issue. If this was the case, a new role copied from Guest but not having Legacy: Guest should be fine.

In reply to David Mudrák

Απάντηση: Re: Απάντηση: Re: Make moodle run with only one user

by giota papa -
I think i confused!mixed.gif

I had in my mind (from what you said above Mr. David) to make the guest has the admin's permissions. But with your last post: "I have realized admin user is not adequate here" i realized that giving the same permissions to the guest won't solve the problem.

Have you got any suggestions??

Is my thought right about giving to guest the admin permissions or one more time i'm going wrong way???


In reply to giota papa

Re: Απάντηση: Re: Απάντηση: Re: Make moodle run with only one user

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Well, it depends on what you want. If your intetion is to use Moodle as a standalone application and you don't mind to give a user a full access, go the "admin way" and hack setup.php to automatically login the admin user. Keep in mind that user will be able to do anything - e.g. view correct answers, bypass quiz restrictions etc.
If you want to prepare the Moodle as a standalone application but the user should be restricted in some areas, create a custom role, e.g. "Standalone user". Modify the role permissions to allow only things you want. Then either put a login information (e.g. "Log in as 'student' with password 'student'") and use Moodle in normal way.
In reply to David Mudrák

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Make moodle run with only one user

by giota papa -
I will go the admin way and then i'll cut all these qualifications that i won't need (such as view correct answers).

I tried to modify the setup.php but i couldn't find something for the admin's login. Also i saw that the form with the administrator's account setup is on the user/editadvanced.php?id=1 but i couldn't find something there too.

And one more question, is there a manual which describes all the variables used and what alternative values can these variables take in the code??

Thanks a lot