Disable change password for non admin users

In some cases, the administrator may want to deny the users the ability of change password.
I found in this topic that is possible by commenting the line $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser())); in the settings/personal.php file.
It works also on nextcloud 11 but this will remove the change password box to all users, including users of the admin grup.

Is there a way to exclude users of the admin group?

Thank you.

Ok, I didn’t think that admin users can change their own password also from ‘users’ menu.
So, the solution I found is already good enough!

Bye.

I still have a use case for this: in our church I don’t like to give everyone (900 members) access to nextcloud so I was planning to make 1 account available that can be used by ~500 or more users as a read only account for looking and importaing the general calendar (ical) and look at files etc. through the web UI; however that means that they can change as well the password at their own personal section. How can I disable the way to certain users like this one to change themselves their own password; I can change it back easily through admin account but that still means at random times if people do it (by accident or on purpose) that others suffer. Anyone any suggestion on how we can define limits in user accounts by user?
thnx!

You can just continue to temper with the code to prevent password changes by a certain user. You have to apply these changes after each update and with time the fix might not work like it used to work. Better solution would be a permanent feature for this. There is a guest app which creates such a user but I don’t know if this works for calendar as well: https://github.com/nextcloud/guests

Other idea is to just revoke the permission on the oc_users-database. But then you can’t make any changes to any user (no new user, no password change, not mail address change).

For calendar, I don’t know if you need it in the webinterface. On external clients, it’s probably enough to create a sharing link.

You can try to put a if condition around:

if(OC_User::getUser() !== 'myspecialuser') {
      $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser()));
}

@tflidd so if I just take the line of script:
if(OC_User::getUser() !== ‘myspecialuser’) {
$tmpl->assign(‘passwordChangeSupported’, OC_User::canUserChangePassword(OC_User::getUser()));

and I ONLY change the myspecialuser to my own useraccount I made for this user then it should disable/remove the password change option in the GUI?

I see that the guest app work is still stalled since june and that the info.xml for it still only shows owncloud 10 not even nextcloud? Aka 3 open issues?

cheers, jeroen

I didn’t test the code. There are perhaps better solutions.

Guest app is not completely finished, there are some issues. There is no official date announced but I hope it will be soon (this autumn).

Im on 18.0.3
Pls HowTo


I found in this topic that is possible by commenting the line $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User::getUser())); in the settings/personal.php file.



in Settings there is no settings/personal.php file.

image

do you mean settings/settings/???