Added new columns at user inspector table

pull/14/head
parent 27ad063df5
commit 578b10a1f8

@ -606,19 +606,15 @@ ubl_settings_usergroups_password_window *yon_ubl_settings_usergroups_password_ne
return window;
}
void on_mode_changed(GtkWidget *self, ubl_settings_usergroups_system_window *window){
if (window->show_all==0){
window->show_all=1;
} else {
window->show_all=0;
}
void yon_system_load(ubl_settings_usergroups_system_window *window){
gtk_list_store_clear(window->liststore1);
gtk_list_store_clear(window->liststore2);
GtkTreeIter iter;
for (int i=0;i<main_config.groups_size;i++){
int parsed_size;
if (main_config.groups[i][strlen(main_config.groups[i])-1]=='\n') main_config.groups[i][strlen(main_config.groups[i])-1]='\0';
config_str parsed = yon_char_parse(main_config.groups[i],&parsed_size,":");
if ((atoi(parsed[2])>=main_config.MINUID&&atoi(parsed[2])<=main_config.MAXUID)||window->show_all==1){
if (atoi(parsed[2])>=main_config.MINGID&&atoi(parsed[2])<=main_config.MAXGID){
gtk_list_store_append(window->liststore2,&iter);
gtk_list_store_set(window->liststore2,&iter,0,atol(parsed[2]),1,parsed[0],2,parsed[3],-1);
}
@ -645,6 +641,29 @@ void on_mode_changed(GtkWidget *self, ubl_settings_usergroups_system_window *win
}
yon_char_parsed_free(parsed,parsed_size);
}
int shadow_size;
config_str shadow = yon_file_open(shadow_path,&shadow_size);
for (int i=0;i<shadow_size;i++){
if (shadow[i][strlen(shadow[i])-1]=='\n') shadow[i][strlen(shadow[i])-1]='\0';
int parsed_size=0;
config_str parsed = yon_char_parse(shadow[i],&parsed_size,":");
if (yon_gtk_list_store_find_text(window->liststore1,&iter,3,parsed[0])){
GDateTime *date = g_date_time_new_from_unix_local(atol(parsed[2]));
char *date_string;
date_string = g_date_time_format(date,"%c");
gtk_list_store_set(window->liststore1,&iter,8,parsed_size>2?date_string:"",9,parsed_size>7?parsed[7]:"",10,parsed_size>3?parsed[3]:"",11,parsed_size>4?parsed[4]:"",12,parsed_size>5?parsed[5]:"",13,parsed_size>2?parsed[6]:"",-1);
}
}
}
void on_mode_changed(GtkWidget *self, ubl_settings_usergroups_system_window *window){
if (window->show_all==0){
window->show_all=1;
} else {
window->show_all=0;
}
yon_system_load(window);
}
void on_system_update(GtkWidget *self, ubl_settings_usergroups_system_window *window){
@ -674,39 +693,7 @@ void on_system_update(GtkWidget *self, ubl_settings_usergroups_system_window *wi
}
}
yon_char_parsed_free(login_defs,login_size);
gtk_list_store_clear(window->liststore1);
gtk_list_store_clear(window->liststore2);
GtkTreeIter iter;
for (int i=0;i<main_config.groups_size;i++){
int parsed_size;
config_str parsed = yon_char_parse(main_config.groups[i],&parsed_size,":");
if ((atoi(parsed[2])>=main_config.MINUID&&atoi(parsed[2])<=main_config.MAXUID)||window->show_all==1){
gtk_list_store_append(window->liststore2,&iter);
gtk_list_store_set(window->liststore2,&iter,0,atol(parsed[2]),1,parsed[0],2,parsed[3],-1);
}
}
for (int i=0;i<main_config.users_size;i++){
int parsed_size;
config_str parsed = yon_char_parse(main_config.users[i],&parsed_size,":");
if ((atoi(parsed[2])>=main_config.MINUID&&atoi(parsed[2])<=main_config.MAXUID)||window->show_all==1){
char *groups_string="";
char *main_group_name="";
for (int j=0;j<main_config.groups_size;j++){
int parsed_gr_size;
config_str parsed_group = yon_char_parse(main_config.groups[j],&parsed_gr_size,":");
if (atol(parsed[2])==atol(parsed_group[2])){
main_group_name=yon_char_new(parsed_group[0]);
}
if (strstr(parsed_group[3],parsed[0])){
groups_string = yon_char_unite(groups_string,!yon_char_is_empty(groups_string)?",":"",parsed_group[0],NULL);
}
yon_char_parsed_free(parsed_group,parsed_gr_size);
}
gtk_list_store_append(window->liststore1,&iter);
gtk_list_store_set(window->liststore1,&iter,1,atol(parsed[2]),2,parsed[0],3,parsed[0],4,main_group_name,5,groups_string,6,parsed[5],-1);
}
yon_char_parsed_free(parsed,parsed_size);
}
yon_system_load(window);
}
ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(){
@ -718,42 +705,13 @@ ubl_settings_usergroups_system_window *yon_ubl_settings_usergroups_system_new(){
window->ToggleAllButton=yon_gtk_builder_get_widget(builder,"ToggleAllButton");
window->UpdateButton=yon_gtk_builder_get_widget(builder,"UpdateButton");
window->show_all=0;
gtk_window_set_title(GTK_WINDOW(window->MonitorWindow),INSPECTOR_TITLE_LABEL);
g_signal_connect(G_OBJECT(window->ToggleAllButton),"clicked",G_CALLBACK(on_mode_changed),window);
g_signal_connect(G_OBJECT(window->UpdateButton),"clicked",G_CALLBACK(on_system_update),window);
GtkTreeIter iter;
for (int i=0;i<main_config.groups_size;i++){
int parsed_size;
if (main_config.groups[i][strlen(main_config.groups[i])-1]=='\n') main_config.groups[i][strlen(main_config.groups[i])-1]='\0';
config_str parsed = yon_char_parse(main_config.groups[i],&parsed_size,":");
if (atoi(parsed[2])>=main_config.MINGID&&atoi(parsed[2])<=main_config.MAXGID){
gtk_list_store_append(window->liststore2,&iter);
gtk_list_store_set(window->liststore2,&iter,0,atol(parsed[2]),1,parsed[0],2,parsed[3],-1);
}
}
for (int i=0;i<main_config.users_size;i++){
int parsed_size;
config_str parsed = yon_char_parse(main_config.users[i],&parsed_size,":");
if (atoi(parsed[2])>=main_config.MINUID&&atoi(parsed[2])<=main_config.MAXUID){
char *groups_string="";
char *main_group_name="";
for (int j=0;j<main_config.groups_size;j++){
int parsed_gr_size;
config_str parsed_group = yon_char_parse(main_config.groups[j],&parsed_gr_size,":");
if (atol(parsed[2])==atol(parsed_group[2])){
main_group_name=yon_char_new(parsed_group[0]);
}
if (strstr(parsed_group[3],parsed[0])){
groups_string = yon_char_unite(groups_string,!yon_char_is_empty(groups_string)?",":"",parsed_group[0],NULL);
}
yon_char_parsed_free(parsed_group,parsed_gr_size);
}
gtk_list_store_append(window->liststore1,&iter);
gtk_list_store_set(window->liststore1,&iter,1,atol(parsed[2]),2,parsed[0],3,parsed[0],4,main_group_name,5,groups_string,6,parsed[5],-1);
}
yon_char_parsed_free(parsed,parsed_size);
}
yon_system_load(window);
return window;
}

@ -40,6 +40,7 @@
#define groups_path "/etc/group"
#define users_path "/etc/passwd"
#define shadow_path "/etc/shadow"
#define uid_path "/etc/login.defs"
#define password_limits_path "/etc/security/pwquiality.conf"

@ -105,6 +105,13 @@
#define PASSWORD_MISMATCH_LABEL _("Password mismatch")
#define PASSWORD_SHORT_LABEL(min_size_char) yon_char_unite(_("Password must be at least")," ", min_size_char," ",_("characters"))
#define GROUP_LABEL _("Group")
#define DAYS_WARNING_TABLE_LABEL _("Days until warning")
#define DAYS_ACTIVITY_TABLE_LABEL _("Days without activity")
#define SHALL_TABLE_LABEL _("Shell path")
#define PASSWORD_CHANGED_TABLE_LABEL _("Password has been changed")
#define EXPIRATION_TABLE_LABEL _("Expiration date")
#define INTERVAL_MIN_TABLE_LABEL _("Password change interval (min)")
#define INTERVAL_MAX_TABLE_LABEL _("Password change interval (max)")
//ubl-settings-usergroups-user.glade
#define USER_TITLE_LABEL _("Users and groups - user configuration")
@ -119,8 +126,8 @@
#define PASSWORD_MIN_INTERVAL_LABEL _("Password change interval: minimum")
#define PASSWORD_MAX_INTERVAL_LABEL _("days, maximum")
#define DAYS_LABEL _("days")
#define DAYS_WARNING_LABEL _("Days until warning")
#define DAYS_ACTIVITY_LABEL _("Days without activity")
#define DAYS_WARNING_LABEL _("Days until warning:")
#define DAYS_ACTIVITY_LABEL _("Days without activity:")
#define FORCE_CONFIGURE_LABEL _("Force change at next login")
#define USER_SHELL_LABEL _("User shell")
#define HOME_DIR_LABEL _("Home directory")

@ -29,6 +29,20 @@
<column type="gchararray"/>
<!-- column-name gchararray6 -->
<column type="gchararray"/>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<!-- column-name gchararray7 -->
<column type="gchararray"/>
<!-- column-name gchararray8 -->
<column type="gchararray"/>
<!-- column-name gchararray9 -->
<column type="gchararray"/>
<!-- column-name gchararray10 -->
<column type="gchararray"/>
<!-- column-name gchararray11 -->
<column type="gchararray"/>
<!-- column-name gchararray12 -->
<column type="gchararray"/>
</columns>
</object>
<object class="GtkListStore" id="liststore2">
@ -218,6 +232,83 @@
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Shell path</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">7</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Password has been changed</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">8</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Expiration date</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">9</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Password change interval (min)</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">10</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Password change interval (max)</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">11</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Days until warning</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">12</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Days without activity</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">13</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>

@ -305,7 +305,7 @@ msgstr ""
msgid "Primary group"
msgstr ""
#: source/ubl-strings.h:102 source/ubl-strings.h:126
#: source/ubl-strings.h:102 source/ubl-strings.h:133
msgid "Home directory"
msgstr ""
@ -325,98 +325,126 @@ msgstr ""
msgid "characters"
msgstr ""
#: source/ubl-strings.h:108
msgid "Days until warning"
msgstr ""
#: source/ubl-strings.h:109
msgid "Days without activity"
msgstr ""
#: source/ubl-strings.h:110
msgid "Users and groups - user configuration"
msgid "Shell path"
msgstr ""
#: source/ubl-strings.h:111
msgid "Set"
msgid "Password has been changed"
msgstr ""
#: source/ubl-strings.h:112
msgid "Empty important field"
msgid "Expiration date"
msgstr ""
#: source/ubl-strings.h:113
msgid "Loading has failed"
msgid "Password change interval (min)"
msgstr ""
#: source/ubl-strings.h:114
msgid "Password change interval (max)"
msgstr ""
#: source/ubl-strings.h:117
msgid "Users and groups - user configuration"
msgstr ""
#: source/ubl-strings.h:118
msgid "Set"
msgstr ""
#: source/ubl-strings.h:119
msgid "Empty important field"
msgstr ""
#: source/ubl-strings.h:120
msgid "Loading has failed"
msgstr ""
#: source/ubl-strings.h:121
msgid "Login name"
msgstr ""
#: source/ubl-strings.h:115
#: source/ubl-strings.h:122
msgid "Additional groups:"
msgstr ""
#: source/ubl-strings.h:116
#: source/ubl-strings.h:123
msgid "Password configuration"
msgstr ""
#: source/ubl-strings.h:117
#: source/ubl-strings.h:124
msgid "Password has been changed:"
msgstr ""
#: source/ubl-strings.h:118
#: source/ubl-strings.h:125
msgid "expiration date:"
msgstr ""
#: source/ubl-strings.h:119
#: source/ubl-strings.h:126
msgid "Password change interval: minimum"
msgstr ""
#: source/ubl-strings.h:120
#: source/ubl-strings.h:127
msgid "days, maximum"
msgstr ""
#: source/ubl-strings.h:121
#: source/ubl-strings.h:128
msgid "days"
msgstr ""
#: source/ubl-strings.h:122
msgid "Days until warning"
#: source/ubl-strings.h:129
msgid "Days until warning:"
msgstr ""
#: source/ubl-strings.h:123
msgid "Days without activity"
#: source/ubl-strings.h:130
msgid "Days without activity:"
msgstr ""
#: source/ubl-strings.h:124
#: source/ubl-strings.h:131
msgid "Force change at next login"
msgstr ""
#: source/ubl-strings.h:125
#: source/ubl-strings.h:132
msgid "User shell"
msgstr ""
#: source/ubl-strings.h:127
#: source/ubl-strings.h:134
msgid "Don't set"
msgstr ""
#: source/ubl-strings.h:128
#: source/ubl-strings.h:135
msgid "Create system user"
msgstr ""
#: source/ubl-strings.h:129
#: source/ubl-strings.h:136
msgid "Create user with ununique (repeating) UID"
msgstr ""
#: source/ubl-strings.h:130
#: source/ubl-strings.h:137
msgid "Do not check login for compliance with character rules"
msgstr ""
#: source/ubl-strings.h:131
#: source/ubl-strings.h:138
msgid "Temporary deactivation"
msgstr ""
#: source/ubl-strings.h:132
#: source/ubl-strings.h:139
msgid "Save"
msgstr ""
#: source/ubl-strings.h:135
#: source/ubl-strings.h:142
msgid "Repeat password:"
msgstr ""
#: source/ubl-strings.h:136
#: source/ubl-strings.h:143
msgid "Password hash:"
msgstr ""

@ -309,7 +309,7 @@ msgstr "Имя пользователя"
msgid "Primary group"
msgstr "Основная группа"
#: source/ubl-strings.h:102 source/ubl-strings.h:126
#: source/ubl-strings.h:102 source/ubl-strings.h:133
msgid "Home directory"
msgstr "Домашний каталог"
@ -329,102 +329,129 @@ msgstr "Пароль должен состоять из как минимум"
msgid "characters"
msgstr "символов"
#: source/ubl-strings.h:108
msgid "Days until warning"
msgstr "Дней до предупреждения"
#: source/ubl-strings.h:109
msgid "Days without activity"
msgstr "Дней без активности"
#: source/ubl-strings.h:110
msgid "Shell path"
msgstr "Путь до оболочки"
#: source/ubl-strings.h:111
msgid "Password has been changed"
msgstr "Пароль изменён"
#: source/ubl-strings.h:112
msgid "Expiration date"
msgstr "Дата устаревания"
#: source/ubl-strings.h:113
msgid "Password change interval (min)"
msgstr "Интервал смены пароля (мин.)"
#: source/ubl-strings.h:114
msgid "Password change interval (max)"
msgstr "Интервал смены пароля (макс.)"
#: source/ubl-strings.h:117
msgid "Users and groups - user configuration"
msgstr "Пользователи и группы - настройка пользователя"
#: source/ubl-strings.h:111
#: source/ubl-strings.h:118
msgid "Set"
msgstr "Задать"
#: source/ubl-strings.h:112
#: source/ubl-strings.h:119
msgid "Empty important field"
msgstr "Пустое важное поле"
#: source/ubl-strings.h:113
#: source/ubl-strings.h:120
msgid "Loading has failed"
msgstr "Ошибка загрузки"
#: source/ubl-strings.h:114
#: source/ubl-strings.h:121
msgid "Login name"
msgstr "Имя логина"
#: source/ubl-strings.h:115
#: source/ubl-strings.h:122
msgid "Additional groups:"
msgstr "Дополнительные группы:"
#: source/ubl-strings.h:116
#: source/ubl-strings.h:123
msgid "Password configuration"
msgstr "Конфигурация пароля"
#: source/ubl-strings.h:117
#: source/ubl-strings.h:124
msgid "Password has been changed:"
msgstr "Пароль изменён:"
#: source/ubl-strings.h:118
#: source/ubl-strings.h:125
msgid "expiration date:"
msgstr "Дата устаревания:"
#: source/ubl-strings.h:119
#: source/ubl-strings.h:126
msgid "Password change interval: minimum"
msgstr "Интервал смены пароля: минимум"
#: source/ubl-strings.h:120
#: source/ubl-strings.h:127
msgid "days, maximum"
msgstr "дней, максимум"
#: source/ubl-strings.h:121
#: source/ubl-strings.h:128
msgid "days"
msgstr "дней"
#: source/ubl-strings.h:122
#, fuzzy
msgid "Days until warning"
#: source/ubl-strings.h:129
msgid "Days until warning:"
msgstr "Дней до предупреждения:"
#: source/ubl-strings.h:123
#: source/ubl-strings.h:130
#, fuzzy
msgid "Days without activity"
msgid "Days without activity:"
msgstr "Дней без активности:"
#: source/ubl-strings.h:124
#: source/ubl-strings.h:131
msgid "Force change at next login"
msgstr "Принулительно сменить при следующем входе в систему"
#: source/ubl-strings.h:125
#: source/ubl-strings.h:132
#, fuzzy
msgid "User shell"
msgstr "Оболочка пользователя:"
#: source/ubl-strings.h:127
#: source/ubl-strings.h:134
msgid "Don't set"
msgstr "Не создавать"
#: source/ubl-strings.h:128
#: source/ubl-strings.h:135
msgid "Create system user"
msgstr "Создать системного пользователя"
#: source/ubl-strings.h:129
#: source/ubl-strings.h:136
msgid "Create user with ununique (repeating) UID"
msgstr "Создать пользователя с повторяющимися (не уникальными) UID"
#: source/ubl-strings.h:130
#: source/ubl-strings.h:137
msgid "Do not check login for compliance with character rules"
msgstr "Не проверять логин на несоответствие правилам использования символов"
#: source/ubl-strings.h:131
#: source/ubl-strings.h:138
msgid "Temporary deactivation"
msgstr "Временное отключение учётной записи"
#: source/ubl-strings.h:132
#: source/ubl-strings.h:139
msgid "Save"
msgstr "Сохранить"
#: source/ubl-strings.h:135
#: source/ubl-strings.h:142
#, fuzzy
msgid "Repeat password:"
msgstr "Подтверждение пароля:"
#: source/ubl-strings.h:136
#: source/ubl-strings.h:143
msgid "Password hash:"
msgstr "Хэш пароля:"

Loading…
Cancel
Save