r21296: remove the session specific encryption from the attributes
[Samba/ekacnet.git] / source4 / gtk / tools / gwsam_user.c
blob81580f8b19293f6db455c97409cf43aa2db9eb70
1 /*
2 Unix SMB/CIFS implementation.
3 GTK+ SAM frontend
5 Copyright (C) Jelmer Vernooij 2004
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "gtk/common/gtk-smb.h"
25 GtkWidget* create_user_edit_dialog (void)
27 GtkWidget *user_edit_dialog;
28 GtkWidget *dialog_vbox1;
29 GtkWidget *notebook;
30 GtkWidget *table1;
31 GtkWidget *label4;
32 GtkWidget *label5;
33 GtkWidget *label6;
34 GtkWidget *label7;
35 int i;
36 GtkWidget *label8;
37 GtkWidget *chk_mustchange;
38 GtkWidget *entry_fullname;
39 GtkWidget *entry_description;
40 GtkWidget *lbl_username;
41 GtkWidget *entry_password;
42 GtkWidget *entry_confirm_password;
43 GtkWidget *chk_cannotchange;
44 GtkWidget *chk_cannotexpire;
45 GtkWidget *chk_disabled;
46 GtkWidget *chk_lockedout;
47 GtkWidget *label1;
48 GtkWidget *hbox1;
49 GtkWidget *scrolledwindow3;
50 GtkWidget *treeview3;
51 GtkWidget *vbox2;
52 GtkWidget *btn_groupadd;
53 GtkWidget *btn_groupdel;
54 GtkWidget *scrolledwindow4;
55 GtkWidget *treeview4;
56 GtkWidget *label2;
57 GtkWidget *vbox3;
58 GtkWidget *frame1;
59 GtkWidget *table2;
60 GtkWidget *label12;
61 GtkWidget *label13;
62 GtkWidget *entry_profilepath;
63 GtkWidget *entry_scriptname;
64 GtkWidget *label10;
65 GtkWidget *frame2;
66 GtkWidget *table3;
67 GtkWidget *label14;
68 GtkWidget *entry_homedir;
69 GtkWidget *chk_mapdrive;
70 GtkWidget *combo_homedrive;
71 GtkWidget *label11;
72 GtkWidget *label3;
73 GtkWidget *dialog_action_area1;
74 GtkWidget *cancelbutton1;
75 GtkWidget *applybutton1;
76 GtkWidget *okbutton1;
78 user_edit_dialog = gtk_dialog_new ();
79 gtk_window_set_title (GTK_WINDOW (user_edit_dialog), "Edit User");
81 dialog_vbox1 = GTK_DIALOG (user_edit_dialog)->vbox;
83 notebook = gtk_notebook_new ();
84 gtk_box_pack_start (GTK_BOX (dialog_vbox1), notebook, TRUE, TRUE, 0);
86 table1 = gtk_table_new (10, 2, FALSE);
87 gtk_container_add (GTK_CONTAINER (notebook), table1);
89 label4 = gtk_label_new ("Username");
90 gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 0, 1,
91 (GtkAttachOptions) (GTK_FILL),
92 (GtkAttachOptions) (0), 0, 0);
93 gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
95 label5 = gtk_label_new ("Full name");
96 gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 1, 2,
97 (GtkAttachOptions) (GTK_FILL),
98 (GtkAttachOptions) (0), 0, 0);
99 gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
101 label6 = gtk_label_new ("Description");
102 gtk_table_attach (GTK_TABLE (table1), label6, 0, 1, 2, 3,
103 (GtkAttachOptions) (GTK_FILL),
104 (GtkAttachOptions) (0), 0, 0);
105 gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
107 label7 = gtk_label_new ("Password");
108 gtk_table_attach (GTK_TABLE (table1), label7, 0, 1, 3, 4,
109 (GtkAttachOptions) (GTK_FILL),
110 (GtkAttachOptions) (0), 0, 0);
111 gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
113 label8 = gtk_label_new ("Confirm password");
114 gtk_table_attach (GTK_TABLE (table1), label8, 0, 1, 4, 5,
115 (GtkAttachOptions) (GTK_FILL),
116 (GtkAttachOptions) (0), 0, 0);
117 gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
119 chk_mustchange = gtk_check_button_new_with_mnemonic ("_User Must Change Password at Next Logon");
120 gtk_table_attach (GTK_TABLE (table1), chk_mustchange, 1, 2, 5, 6,
121 (GtkAttachOptions) (GTK_FILL),
122 (GtkAttachOptions) (0), 0, 0);
124 entry_fullname = gtk_entry_new ();
125 gtk_table_attach (GTK_TABLE (table1), entry_fullname, 1, 2, 1, 2,
126 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
127 (GtkAttachOptions) (0), 0, 0);
129 entry_description = gtk_entry_new ();
130 gtk_table_attach (GTK_TABLE (table1), entry_description, 1, 2, 2, 3,
131 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
132 (GtkAttachOptions) (0), 0, 0);
134 lbl_username = gtk_label_new ("");
135 gtk_table_attach (GTK_TABLE (table1), lbl_username, 1, 2, 0, 1,
136 (GtkAttachOptions) (GTK_FILL),
137 (GtkAttachOptions) (0), 0, 0);
138 gtk_misc_set_alignment (GTK_MISC (lbl_username), 0, 0.5);
140 entry_password = gtk_entry_new ();
141 gtk_table_attach (GTK_TABLE (table1), entry_password, 1, 2, 3, 4,
142 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
143 (GtkAttachOptions) (0), 0, 0);
145 entry_confirm_password = gtk_entry_new ();
146 gtk_table_attach (GTK_TABLE (table1), entry_confirm_password, 1, 2, 4, 5,
147 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
148 (GtkAttachOptions) (0), 0, 0);
150 chk_cannotchange = gtk_check_button_new_with_mnemonic ("User Cannot Change Password");
151 gtk_table_attach (GTK_TABLE (table1), chk_cannotchange, 1, 2, 6, 7,
152 (GtkAttachOptions) (GTK_FILL),
153 (GtkAttachOptions) (0), 0, 0);
155 chk_cannotexpire = gtk_check_button_new_with_mnemonic ("Password Never Expires");
156 gtk_table_attach (GTK_TABLE (table1), chk_cannotexpire, 1, 2, 7, 8,
157 (GtkAttachOptions) (GTK_FILL),
158 (GtkAttachOptions) (0), 0, 0);
160 chk_disabled = gtk_check_button_new_with_mnemonic ("Account Disabled");
161 gtk_table_attach (GTK_TABLE (table1), chk_disabled, 1, 2, 8, 9,
162 (GtkAttachOptions) (GTK_FILL),
163 (GtkAttachOptions) (0), 0, 0);
165 chk_lockedout = gtk_check_button_new_with_mnemonic ("Account Locked Out");
166 gtk_table_attach (GTK_TABLE (table1), chk_lockedout, 1, 2, 9, 10,
167 (GtkAttachOptions) (GTK_FILL),
168 (GtkAttachOptions) (0), 0, 0);
170 label1 = gtk_label_new ("Main");
171 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 0), label1);
173 hbox1 = gtk_hbox_new (FALSE, 0);
174 gtk_container_add (GTK_CONTAINER (notebook), hbox1);
176 scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
177 gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow3, TRUE, TRUE, 0);
179 treeview3 = gtk_tree_view_new ();
180 gtk_container_add (GTK_CONTAINER (scrolledwindow3), treeview3);
182 vbox2 = gtk_vbox_new (TRUE, 0);
183 gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);
185 btn_groupadd = gtk_button_new_from_stock ("gtk-add");
186 gtk_box_pack_start (GTK_BOX (vbox2), btn_groupadd, FALSE, FALSE, 0);
188 btn_groupdel = gtk_button_new_from_stock ("gtk-remove");
189 gtk_box_pack_start (GTK_BOX (vbox2), btn_groupdel, FALSE, FALSE, 0);
191 scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL);
192 gtk_box_pack_start (GTK_BOX (hbox1), scrolledwindow4, TRUE, TRUE, 0);
194 treeview4 = gtk_tree_view_new ();
195 gtk_container_add (GTK_CONTAINER (scrolledwindow4), treeview4);
197 label2 = gtk_label_new ("Groups");
198 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 1), label2);
200 vbox3 = gtk_vbox_new (FALSE, 0);
201 gtk_container_add (GTK_CONTAINER (notebook), vbox3);
203 frame1 = gtk_frame_new (NULL);
204 gtk_box_pack_start (GTK_BOX (vbox3), frame1, TRUE, TRUE, 0);
206 table2 = gtk_table_new (2, 2, FALSE);
207 gtk_container_add (GTK_CONTAINER (frame1), table2);
209 label12 = gtk_label_new ("User Profile Path:");
210 gtk_table_attach (GTK_TABLE (table2), label12, 0, 1, 0, 1,
211 (GtkAttachOptions) (GTK_FILL),
212 (GtkAttachOptions) (0), 0, 0);
213 gtk_misc_set_alignment (GTK_MISC (label12), 0, 0.5);
215 label13 = gtk_label_new ("Logon Script Name:");
216 gtk_table_attach (GTK_TABLE (table2), label13, 0, 1, 1, 2,
217 (GtkAttachOptions) (GTK_FILL),
218 (GtkAttachOptions) (0), 0, 0);
219 gtk_misc_set_alignment (GTK_MISC (label13), 0, 0.5);
221 entry_profilepath = gtk_entry_new ();
222 gtk_table_attach (GTK_TABLE (table2), entry_profilepath, 1, 2, 0, 1,
223 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
224 (GtkAttachOptions) (0), 0, 0);
226 entry_scriptname = gtk_entry_new ();
227 gtk_table_attach (GTK_TABLE (table2), entry_scriptname, 1, 2, 1, 2,
228 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
229 (GtkAttachOptions) (0), 0, 0);
231 label10 = gtk_label_new ("User Profiles");
232 gtk_frame_set_label_widget (GTK_FRAME (frame1), label10);
234 frame2 = gtk_frame_new (NULL);
235 gtk_box_pack_start (GTK_BOX (vbox3), frame2, TRUE, TRUE, 0);
237 table3 = gtk_table_new (2, 2, FALSE);
238 gtk_container_add (GTK_CONTAINER (frame2), table3);
240 label14 = gtk_label_new ("Path");
241 gtk_table_attach (GTK_TABLE (table3), label14, 0, 1, 0, 1,
242 (GtkAttachOptions) (GTK_FILL),
243 (GtkAttachOptions) (0), 0, 0);
244 gtk_misc_set_alignment (GTK_MISC (label14), 0, 0.5);
246 entry_homedir = gtk_entry_new ();
247 gtk_table_attach (GTK_TABLE (table3), entry_homedir, 1, 2, 0, 1,
248 (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
249 (GtkAttachOptions) (0), 0, 0);
251 chk_mapdrive = gtk_check_button_new_with_mnemonic ("Map homedir to drive");
252 gtk_table_attach (GTK_TABLE (table3), chk_mapdrive, 0, 1, 1, 2,
253 (GtkAttachOptions) (GTK_FILL),
254 (GtkAttachOptions) (0), 0, 0);
256 combo_homedrive = gtk_combo_box_new();
257 gtk_table_attach (GTK_TABLE (table3), combo_homedrive, 1, 2, 1, 2,
258 (GtkAttachOptions) (GTK_FILL),
259 (GtkAttachOptions) (GTK_FILL), 0, 0);
260 for(i = 'C'; i <= 'Z'; i++)
262 char drive[3];
263 snprintf(drive, 3, "%c:", i);
264 gtk_combo_box_append_text (GTK_COMBO_BOX (combo_homedrive), drive);
267 label11 = gtk_label_new ("Home Directory");
268 gtk_frame_set_label_widget (GTK_FRAME (frame2), label11);
270 label3 = gtk_label_new ("Profile");
271 gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 2), label3);
273 dialog_action_area1 = GTK_DIALOG (user_edit_dialog)->action_area;
274 gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
276 cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
277 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), cancelbutton1, GTK_RESPONSE_CANCEL);
278 GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
280 applybutton1 = gtk_button_new_from_stock ("gtk-apply");
281 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), applybutton1, GTK_RESPONSE_APPLY);
282 GTK_WIDGET_SET_FLAGS (applybutton1, GTK_CAN_DEFAULT);
284 okbutton1 = gtk_button_new_from_stock ("gtk-ok");
285 gtk_dialog_add_action_widget (GTK_DIALOG (user_edit_dialog), okbutton1, GTK_RESPONSE_OK);
286 GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
288 gtk_widget_show_all(dialog_vbox1);
290 return user_edit_dialog;