1 <& /Admin/Elements/Header, Title => $title &>
2 <& /Admin/Elements/UserTabs, id => $id, current_subtab => '/Admin/Elements/Modify.html?id='.$id &>
4 <& /Elements/ListActions, actions => \@results &>
6 <FORM ACTION="<%$RT::WebPath%>/Admin/Users/Modify.html" METHOD=POST>
8 <INPUT TYPE=HIDDEN NAME=id VALUE="new">
10 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$UserObj->Id%>">
13 <TABLE WIDTH=100% BORDER=0>
16 <TD VALIGN=TOP ROWSPAN=2>
17 <& /Elements/TitleBoxStart, title => 'Identity' &>
19 Username: <input name="Name" value="<%$UserObj->Name%>"> <b>(required)</b> <BR>
20 Email: <input name="EmailAddress" value="<%$UserObj->EmailAddress%>"><BR>
21 Real Name: <input name="RealName" value="<%$UserObj->RealName%>"> <BR>
22 Nickname: <input name="NickName" value="<%$UserObj->NickName%>">
24 Unix login: <input name="Gecos" value="<%$UserObj->Gecos%>">
26 Extra info: <textarea name="FreeformContactInfo" cols=20 rows=5><%$UserObj->FreeformContactInfo%></TEXTAREA>
27 <& /Elements/TitleBoxEnd &>
30 <& /Elements/TitleBoxStart, title => 'Access control' &>
31 <INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
32 <INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>>
33 Let this user access RT<BR>
36 <INPUT TYPE=HIDDEN NAME="SetPrivileged" VALUE="1">
37 <INPUT TYPE=CHECKBOX NAME="Privileged" VALUE="1" <%$PrivilegedChecked%>> Let this user be granted rights<BR>
39 % unless ($RT::WebExternalAuth) {
46 <input type=password name="Pass1">
53 <input type=password name="Pass2">
58 <& /Elements/TitleBoxEnd &>
63 <& /Elements/TitleBoxStart, title => 'Location' &>
64 Organization: <input name="Organization" value="<%$UserObj->Organization%>">
66 Address1: <input name="Address1" value="<%$UserObj->Address1%>">
68 Address2: <input name="Address2" value="<%$UserObj->Address2%>">
70 City: <input name="City" value="<%$UserObj->City%>" size=14>
72 State: <input name="State" value="<%$UserObj->State%>" size=3>
74 Zip: <input name="Zip" value="<%$UserObj->Zip%>" size=9>
76 Country: <input name="Country" value="<%$UserObj->Country%>">
80 <& /Elements/TitleBoxEnd &>
84 <TD COLSPAN=2 VALIGN=TOP>
87 <& /Elements/TitleBoxStart, title => 'Phone numbers' &>
88 Home: <input name="HomePhone" value="<%$UserObj->HomePhone%>" size=13>
90 Work: <input name="WorkPhone" value="<%$UserObj->WorkPhone%>" size=13>
92 Mobile: <input name="MobilePhone" value="<%$UserObj->MobilePhone%>" size=13>
94 Pager: <input name="PagerPhone" value="<%$UserObj->PagerPhone%>" size=13>
95 <& /Elements/TitleBoxEnd &>
97 <& /Elements/TitleBoxStart, title => 'Comments about this user' &>
98 <TEXTAREA name="Comments" COLS=80 ROWS=5 WRAP=VIRTUAL><%$UserObj->Comments%></TEXTAREA>
99 <& /Elements/TitleBoxEnd &>
102 %if ($UserObj->Privileged) {
104 <& /Elements/TitleBoxStart, title => 'Signature' &>
105 <TEXTAREA COLS=80 ROWS=5 name="Signature" WRAP=HARD>
106 <%$UserObj->Signature%></TEXTAREA>
107 <& /Elements/TitleBoxEnd &>
116 <& /Elements/Submit &>
122 my $UserObj = new RT::User($session{'CurrentUser'});
123 my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results);
128 $title = "Create a new user";
133 ($val, $msg) = $UserObj->Create( Name => $Name,
134 EmailAddress => $ARGS{'EmailAddress'}
139 push @results, 'User could not be created: '. $msg;
144 $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'");
145 $val = $UserObj->Id();
149 $title = "Modify the user ". $UserObj->Name;
152 # If the create failed
154 $title = "Create a new user";
165 # If we have a user to modify, lets try.
168 my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo
169 Organization RealName NickName Lang EmailEncoding WebEncoding
170 ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId
171 AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1
172 Address2 City State Zip Country
175 my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
178 push (@results,@fieldresults);
181 # {{{ Deal with special fields: Privileged, Enabled and Password
182 if ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) {
183 my ($code, $msg) = $UserObj->SetPrivileged($Privileged);
184 push @results, 'Privileged status: '. $msg;
187 #we're asking about enabled on the web page but really care about disabled.
194 if ( ($SetEnabled) and ( $Disabled != $UserObj->Disabled) ) {
195 my ($code, $msg) = $UserObj->SetDisabled($Disabled);
196 push @results, 'Enabled status '. $msg;
200 #TODO: make this report errors properly
201 if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) {
203 ($code, $msg) = $UserObj->SetPassword($Pass1);
204 push @results, 'Password: '. $msg;
211 # {{{ Do some setup for the ui
212 unless ($UserObj->Disabled()) {
213 $EnabledChecked ="CHECKED";
216 if ($UserObj->Privileged()) {
217 $PrivilegedChecked = "CHECKED";
229 $EmailAddress => undef
230 $FreeformContactInfo => undef
231 $Organization => undef
235 $SetPrivileged => undef
239 $EmailEncoding => undef
240 $WebEncoding => undef
241 $ExternalContactInfoId => undef
242 $ContactInfoSystem => undef
244 $ExternalAuthId => undef
248 $MobilePhone => undef