× How To / General

Unable to restrict students from editing their profiles in Moodle

1 week 4 days ago 1 week 4 days ago by Web Buster UK Ltd.
Web Buster UK Ltd
Posts: 75
More
Topic Author
Unable to restrict students from editing their profiles in Moodle #1
Authentication method set is "Joomdle" for affected users. In Moodle, within Site Administration -> Plugins -> Authentication -> Joomdle, all user fields are locked. However, when the user logs in and edit his profile within Moodle, all the fields are unlocked.

When authentication method for the user is changed to "Manual account" (corresponding settings for locking profile fields is set for "manual account" authentication method), the fields are locked.

Also, is there a way to completely prevent a user from editing their profile field values in Moodle? The "Lock user fields" settings in Joomdle do not cover all - eg, profile pictures.
1 week 1 day ago
Antonio Durán
Posts: 7004
More
Unable to restrict students from editing their profiles in Moodle #2
Thanks for the info. I will look into it and get back to you as soon as possible.
1 week 22 hours ago
Antonio Durán
Posts: 7004
More
Unable to restrict students from editing their profiles in Moodle #3
Hi.

I looked into this, and found the problem.
To fix it, edit file: moodle/auth/joomdle/auth.php
Function: __construct
Change:
    //    $this->config = get_config('auth/joomdle');
By:
        $this->config = get_config('auth_joomdle');

As for totally locking profile editing:, this may come handy:
docs.moodle.org/36/en/Capabilities/moodle/user:editownprofile k

You would need to remove that capablity from the authenticated user role, so teachers cannot edit profiles either (which I guess is ok, as profile editing is done in Joomla).

Also for profile image you can check this:
moodle.org/mod/forum/discuss.php?d=321642 k
6 days 14 hours ago 6 days 14 hours ago by Web Buster UK Ltd.
Web Buster UK Ltd
Posts: 75
More
Topic Author
Unable to restrict students from editing their profiles in Moodle #4
Changed the code for __construct as above, but now we can't save moodle's joomdle authentication plugin settings.

It came up with "Error writing to database" when we click save changes. Looking at the console, it came up with this error:

Failed to load resource: the server responded with a status of 404 ()
ourwebsite.com/moodle/admin/settings.php...n=authsettingjoomdle k

It also still doesn't stop users from editing their profile fields.
6 days 7 hours ago
Antonio Durán
Posts: 7004
More
Unable to restrict students from editing their profiles in Moodle #5
Hi.

Did you change the code or just uncomment it? There is a small change.
The change is working for me locally.
4 days 16 hours ago 4 days 15 hours ago by Web Buster UK Ltd.
Web Buster UK Ltd
Posts: 75
More
Topic Author
Unable to restrict students from editing their profiles in Moodle #6
Yeah, we changed it, but users are still able to edit their profile fields. Not sure if this is related, but every time we try to save joomdle authentication plugin settings it throws up this error. Would you know what is causing this?







If I understood that right, it seems that it's trying to add "Joomdle" into the table mdl_external_services, but there is already an entry for Joomdle in that table (likely from previous manual creation of joomdle external service). We ended up just dropping the existing key and that solved the issue.

Edit: The issue with users still allowed to edit their profile fields possibly is a bug with the adaptable template. We just turned off the ability to editownprofile for now.
Attachments:
2 days 21 hours ago
Antonio Durán
Posts: 7004
More
Unable to restrict students from editing their profiles in Moodle #7
Thanks for the info.

The problem with the database happens because of a duplicate index problem. I hadn't noticed this index before, so there are no check in the code, like there are so there is no duplicate values for unique fields.
With your detailed report I could replicate the issue and should be able to fix it. Even if it is not an issue for you anymore, I am sure it can help other users.