zhuyaliang / user-admin

GNU General Public License v3.0
27 stars 16 forks source link

Feature Request: Implement support for setting default groups #17

Open JoshStrobl opened 5 years ago

JoshStrobl commented 5 years ago

In my opinion, most end users which decide to utilize user-admin as a replacement for gnome-system-tools are likely to not be technically adept enough to know which specific groups should be set by default for a new user. Their usecase is likely centered around creating another "standard" user (without specified admin group(s)) or an administrative-type user (with the admin_group from group-service, most likely).

I'd like to request a compile-time configuration flag (either in this repo or group-service, I'm happy to file a request over there too) to set default groups in which new users should be set.

This would be especially useful since most end users are not likely to know what specific groups their own account has been set up with, for example on Solus you could expect groups such as:

With the administrative account being in the sudo group. This could ideally be set with a flag such as -Ddefault_user_groups=audio,cdrom,fuse,etc... either in user-admin or group-service.

zhuyaliang commented 5 years ago

@JoshStrobl That's a good idea. But I think it would be more perfect to design an interactive graphical interface, such as: An advanced button can be added to the window where a new user is created. When the user clicks on the button, the default add group can be set.But will this be the same as what group management provides function?

kyrios123 commented 5 years ago

This would indeed make the application more convenient for non technical users (and even for advanced users actually) as it allows to have sane defaults. If you don't want to set the default groups at build time, there could maybe be defined in a properties file that each distribution could ship with the application to set their defaults ?

@zhuyaliang have you decided on what could be the best approach for this already? (I'd really have to have this feature implemented so the application can be added in our repository)

zhuyaliang commented 5 years ago

@kyrios123 I've done this, and I load the default settings for new users by reading configuration files. I'm currently testing。The configuration file looks like this

# /etc/mate-user-admin/nuconfig 
# Default configuration for new users 
[nudefault]
#Default language for new users
nulanguage = en_US.utf8

#Default Type for New User, 0 Ordinary User 1 Manage User
nutype = 0    

#Default Add Groups for New Users
nugroups =mail;audio;video;lightdm
kyrios123 commented 5 years ago

@zhuyaliang Thanks! nugroups and nutype are working fine but the language field of newly created users is set to No Settings on main screen although nulanguage is set to en_US.utf8 , is this normal ?

PS: Would it be possible to also add default groups for Administrators ? I agree it's not as important as for Standard users, but it's convenient.

zhuyaliang commented 5 years ago

@kyrios123 For language ineffectiveness, you can check the /tmp/ log-(timestamp) log to see if there are useful messages. Set nutype to 1, and the new user created is the administrator type,nugroups is his default group (administrator)

kyrios123 commented 5 years ago

Unfortunately logs don't show anything useful. I just created a new user (Admin Test) then I clicked on it. image

What I meant regarding the default groups for the Administrators is that perhaps it would be a good idea to have the possibility to provide default groups for new Standard accounts and for Administrators. For example for some reasons, I may want newly created Administrators to be member of the wheel group but not Standard accounts. Currently you can just specify default groups but they are the same regardless if the account is Standard or Administrator.

zhuyaliang commented 5 years ago

@kyrios123 Thank you for your test. I'll solve this problem.But it needs your cooperation, because I don't have the problem of language setup failure here.

kyrios123 commented 5 years ago

sure, just let me know what I should do!

zhuyaliang commented 5 years ago

@kyrios123 I added some debugging information,The generated log (/ TMP / log*) is sent to me after compilation and run, so I can analyze the cause of the problem. What would happen if you set up other languages in the configuration file? Can Manual Language Settings Succeed?

kyrios123 commented 5 years ago

Here are the logs, although it says "English (United States)", on the Screen it displays "No Setttings".

level:[Info]  message: mate-user-admin user 1
level:[Info]  message: mate-user-admin Current user name Pierre-Yves
level:[Debug]  message: nuLang = en_US.utf8
level:[Debug]  message: NewUserlang = English (United States)
level:[Debug]  message: username testuser realname Test User usertype 1 langname English (United States) passwod 1
level:[Info]  message: mate-user-admin Current user name Pierre-Yves
level:[Info]  message: mate-user-admin Current user name Test User
level:[Debug]  message: nuLang = en_US.utf8
level:[Debug]  message: NewUserlang = English (United States)
level:[Debug]  message: username testuser2 realname Test User II usertype 1 langname English (United States) passwod 1

Here are the logs. I found some more bugs

  1. Application crashes when creating 2 new users in a row
  2. When you set a language to a user then navigate on other users, it keeps on showing the language that was set on all users (like if the field is not refreshed/reloaded), but it correctly sets the language on the user.
zhuyaliang commented 5 years ago

@kyrios123 I solved the problem of language.

Application crashes when creating 2 new users in a row

I haven't encountered such a situation. Is there any error message if you start-up from the command line?

kyrios123 commented 5 years ago

@zhuyaliang I confirm the language problem is solved :) I'll open another issue for the crash.

To get back to the original topic, what about the suggestion of having the possibility to set default groups for "Standard Users" and to set different default groups for "Administrtors" ?

zhuyaliang commented 2 years ago

@kyrios123 Any questions?

kyrios123 commented 2 years ago

Hi @zhuyaliang I still would love to see a setting similar to nugroups but for setting default groups for Admin users That would be a nice enhancement imho

zhuyaliang commented 2 years ago

OK, I will change the /etc/mate-user-admin/nuconfig configuration file to add new options

administrator user group
standard user group
zhuyaliang commented 2 years ago

@kyrios123 Try this commit, adding default groups for different types of users 7011404a This is the modified configuration file

#Default Add Groups for New Users (Administrtors)
nuadmingroups =mail;audio;video;lightdm
#Default Add Groups for New Users (Standard)
nustandgroups =mail;audio;video;cdrom;sshd