diff --git a/source/ubl-settings-usergroups.c b/source/ubl-settings-usergroups.c index e8fc358..56e29eb 100644 --- a/source/ubl-settings-usergroups.c +++ b/source/ubl-settings-usergroups.c @@ -764,6 +764,10 @@ void on_user_save(GtkWidget *self, dictionary *dict){ char *samba_sync = NULL; char *deactivate = NULL; char *extra_options = NULL; + char *useradd_boot = ""; + char *useradd_shutdown = ""; + char *usershadow_boot = ""; + char *usershadow_shutdown = ""; int uid_auto_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->userUIDAutoCheck)); if (uid_auto_active){ @@ -886,6 +890,30 @@ void on_user_save(GtkWidget *self, dictionary *dict){ password_changed_date = yon_char_unite(yon_char_from_int(tm.tm_mday),".",yon_char_from_int(tm.tm_mon+1),".",yon_char_from_int(1900+tm.tm_year),NULL); } + int useradd_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck)); + if (useradd_boot_active){ + useradd_boot = "boot"; + } + + int useradd_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck)); + if (useradd_shutdown_active){ + useradd_shutdown = "shutdown"; + } + + int usershadow_boot_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck)); + if (usershadow_boot_active){ + usershadow_boot = "boot"; + } + + int usershadow_shutdown_active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck)); + if (usershadow_shutdown_active){ + usershadow_shutdown = "shutdown"; + } + + char *useradd_sync_string = NULL; + useradd_sync_string = yon_char_unite(useradd_boot,!yon_char_is_empty(useradd_boot)?",":"",useradd_shutdown,NULL); + char *usershadow_sync_string = NULL; + usershadow_sync_string = yon_char_unite(usershadow_boot,!yon_char_is_empty(usershadow_boot)?",":"",usershadow_shutdown,NULL); char *shadow_string = NULL; shadow_string = yon_char_unite(yon_char_return_if_exist(password_changed_date,""), ":",yon_char_return_if_exist(password_change_interval_minimum,""), @@ -909,6 +937,12 @@ void on_user_save(GtkWidget *self, dictionary *dict){ NULL); yon_config_register(USERADD(login),"users",final_user); yon_config_register(USERSHADOW(login),"users",shadow_string); + + if (!yon_char_is_empty(useradd_sync_string)) + yon_config_register(USERADD_SYNC(login),"users",useradd_sync_string); + + if (!yon_char_is_empty(usershadow_sync_string)) + yon_config_register(USERSHADOW_SYNC(login),"users",usershadow_sync_string); GtkTreeIter iter; GtkTreeModel *model = GTK_TREE_MODEL(widgets->UsersList); if (!gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->UsersTree)),&model,&iter)) @@ -964,7 +998,11 @@ ubl_settings_usergroups_user_window *yon_ubl_settings_usergroups_user_new(){ window->UserCancelButton=yon_gtk_builder_get_widget(builder,"UserCancelButton"); window->UserOkButton=yon_gtk_builder_get_widget(builder,"UserOkButton"); window->CalendarPopup=yon_gtk_builder_get_widget(builder,"CalendarPopover"); + window->UseraddBootCheck=yon_gtk_builder_get_widget(builder,"UseraddBootCheck"); window->ExpirationCalendar=yon_gtk_builder_get_widget(builder,"ExpirationCalendar"); + window->UseraddShutdownCheck=yon_gtk_builder_get_widget(builder,"UseraddShutdownCheck"); + window->UsershadowBootCheck=yon_gtk_builder_get_widget(builder,"UsershadowBootCheck"); + window->UsershadowShutdownCheck=yon_gtk_builder_get_widget(builder,"UsershadowShutdownCheck"); gtk_window_set_title(GTK_WINDOW(window->CreateUserWindow),USER_TITLE_LABEL); int shell_size=0; @@ -1107,12 +1145,34 @@ void on_main_edit(GtkWidget *self, main_window *widgets){ gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userPasswordChangeDelayMaximumSpin),atol(parsed_size>2?parameters[2]:"0")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userWarningSpin),atol(parsed_size>3?parameters[3]:"0")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->userActivitySpin),atol(parsed_size>4?parameters[4]:"0")); - if (parsed_size>5){ + if (parsed_size>5&&!yon_char_is_empty(parameters[5])){ GDateTime *date = g_date_time_new_from_unix_local(atol(parameters[5])); gtk_entry_set_text(GTK_ENTRY(window->userPasswordExpirationEntry),g_date_time_format(date,"%c")); } gtk_window_set_transient_for(GTK_WINDOW(window->CreateUserWindow),GTK_WINDOW(widgets->Window)); gtk_widget_show(window->CreateUserWindow); + + char *useradd_sync = NULL; + useradd_sync = yon_config_get_by_key(USERADD_SYNC(name)); + if (useradd_sync){ + if (strstr(useradd_sync,"boot")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddBootCheck),1); + } + if (strstr(useradd_sync,"shutdown")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UseraddShutdownCheck),1); + } + free(useradd_sync); + } + char *usershadow_sync =yon_config_get_by_key(USERSHADOW_SYNC(name)); + if (usershadow_sync){ + if (strstr(usershadow_sync,"boot")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowBootCheck),1); + } + if (strstr(usershadow_sync,"shutdown")){ + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(window->UsershadowShutdownCheck),1); + } + free(usershadow_sync); + } } } else { model = GTK_TREE_MODEL(widgets->GroupsList); diff --git a/source/ubl-settings-usergroups.h b/source/ubl-settings-usergroups.h index dc5bdf8..5ec9ffb 100644 --- a/source/ubl-settings-usergroups.h +++ b/source/ubl-settings-usergroups.h @@ -50,6 +50,8 @@ #define USERADD(user) yon_char_unite("USERADD[",user,"]",NULL) #define GROUPADD(group) yon_char_unite("GROUPADD[",group,"]",NULL) #define USERSHADOW(user) yon_char_unite("USERSHADOW[",user,"]",NULL) +#define USERADD_SYNC(user) yon_char_unite("USERADD_SYNC[",user,"]",NULL) +#define USERSHADOW_SYNC(user) yon_char_unite("USERSHADOW_SYNC[",user,"]",NULL) #define password_hash_get_command(passwd) yon_char_append("mkpasswd2 ",passwd) @@ -250,6 +252,10 @@ typedef struct{ GtkWidget *UserOkButton; GtkWidget *CalendarPopup; GtkWidget *ExpirationCalendar; + GtkWidget *UseraddBootCheck; + GtkWidget *UseraddShutdownCheck; + GtkWidget *UsershadowBootCheck; + GtkWidget *UsershadowShutdownCheck; long expiration_unix; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 49e3d77..793dbea 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -138,6 +138,13 @@ #define TEMPORARY_DEACTIVATION_LABEL _("Temporary deactivation") #define SAVE_LABEL _("Save") +#define USERADD_SYNC_LABEL _("System user synchronization mode with configuration") +#define USERADD_BOOT_LABEL _("During system startup, load the user from the configuration") +#define USERADD_SHUTDOWN_LABEL _("When shutting down the system, save the user into the configuration") +#define USERSHADOW_SYNC_LABEL _("The mode of synchronizing system user settings with the configuration") +#define USERSHADOW_BOOT_LABEL _("When the system boots up, load the user's settings from the configuration") +#define USERSHADOW_SHUTDOWN_LABEL _("When shutting down the system, save the user's settings into the configuration") + //ubl-settings-usergroups-password.glade #define PASSWORD_REPEAT_LABEL _("Repeat password:") #define PASSWORD_HASH_LABEL _("Password hash:") \ No newline at end of file diff --git a/ubl-settings-usergroups-user.glade b/ubl-settings-usergroups-user.glade index dfd075e..e6761c5 100644 --- a/ubl-settings-usergroups-user.glade +++ b/ubl-settings-usergroups-user.glade @@ -429,6 +429,71 @@ 5 + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + + + True + False + vertical + 5 + + + During system startup, load the user from the configuration + True + True + False + True + + + False + True + 0 + + + + + When shutting down the system, save the user into the configuration + True + True + False + True + + + False + True + 1 + + + + + + + + + True + False + System user synchronization mode with configuration + + + + + False + True + 6 + + True @@ -709,7 +774,72 @@ False True - 6 + 7 + + + + + True + False + 0.019999999552965164 + in + + + True + False + 5 + 5 + 5 + + + True + False + vertical + 5 + + + When the system boots up, load the user's settings from the configuration + True + True + False + True + + + False + True + 2 + + + + + When shutting down the system, save the user's settings into the configuration + True + True + False + True + + + False + True + 3 + + + + + + + + + True + False + The mode of synchronizing system user settings with the configuration + + + + + False + True + 8 @@ -942,54 +1072,6 @@ - - False - True - 7 - - - - - False - 0.019999999552965164 - in - - - True - False - 5 - 5 - 5 - - - True - False - vertical - 5 - - - - - - - - - - - - - - - - - - - True - False - Sync configuration - - - False True diff --git a/ubl-settings-usergroups.pot b/ubl-settings-usergroups.pot index 85be400..026f03d 100644 --- a/ubl-settings-usergroups.pot +++ b/ubl-settings-usergroups.pot @@ -441,10 +441,37 @@ msgstr "" msgid "Save" msgstr "" +#: source/ubl-strings.h:141 +msgid "System user synchronization mode with configuration" +msgstr "" + #: source/ubl-strings.h:142 -msgid "Repeat password:" +msgid "During system startup, load the user from the configuration" msgstr "" #: source/ubl-strings.h:143 +msgid "When shutting down the system, save the user into the configuration" +msgstr "" + +#: source/ubl-strings.h:144 +msgid "The mode of synchronizing system user settings with the configuration" +msgstr "" + +#: source/ubl-strings.h:145 +msgid "" +"When the system boots up, load the user's settings from the configuration" +msgstr "" + +#: source/ubl-strings.h:146 +msgid "" +"When shutting down the system, save the user's settings into the " +"configuration" +msgstr "" + +#: source/ubl-strings.h:149 +msgid "Repeat password:" +msgstr "" + +#: source/ubl-strings.h:150 msgid "Password hash:" msgstr "" diff --git a/ubl-settings-usergroups_ru.po b/ubl-settings-usergroups_ru.po index ef37826..965a976 100644 --- a/ubl-settings-usergroups_ru.po +++ b/ubl-settings-usergroups_ru.po @@ -447,11 +447,38 @@ msgstr "Временное отключение учётной записи" msgid "Save" msgstr "Сохранить" +#: source/ubl-strings.h:141 +msgid "System user synchronization mode with configuration" +msgstr "Режим синхронизации пользователя системы с конфигурацией" + #: source/ubl-strings.h:142 +msgid "During system startup, load the user from the configuration" +msgstr "При загрузке системы загрузить пользователя из конфигурации" + +#: source/ubl-strings.h:143 +msgid "When shutting down the system, save the user into the configuration" +msgstr "При завершении работы системы сохранить пользователя в конфигурацию" + +#: source/ubl-strings.h:144 +msgid "The mode of synchronizing system user settings with the configuration" +msgstr "Режим синхронизации параметров пользователя системы с конфигурацией" + +#: source/ubl-strings.h:145 +msgid "" +"When the system boots up, load the user's settings from the configuration" +msgstr "При загрузке системы загрузить параметры пользователя из конфигурации" + +#: source/ubl-strings.h:146 #, fuzzy +msgid "" +"When shutting down the system, save the user's settings into the " +"configuration" +msgstr "При завершении работы системы сохранить пользователя в конфигурацию" + +#: source/ubl-strings.h:149 msgid "Repeat password:" msgstr "Подтверждение пароля:" -#: source/ubl-strings.h:143 +#: source/ubl-strings.h:150 msgid "Password hash:" msgstr "Хэш пароля:"