I've searching options to set my users
isFrozen = true, which I found here, but after trying it I got a weird error:
List<UserLogin> users = [SELECT Id,IsFrozen,UserId FROM UserLogin WHERE UserId IN (SELECT Id FROM User WHERE Profile.Name != 'System Administrator' AND IsActive = true) AND UserId != :UserInfo.getUserId()]; users.IsFrozen = true; update users;
I don't get why, but its giving me:
System.DmlException: Update failed. First exception on row 0 with id 0Yw29000001XZqMCAW; first error: UNKNOWN_EXCEPTION, You cannot edit this field: 
Am I mistaken in something related to the code?