From 3ef62a0570055da710328937e7f65dbb2c027c62 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 12 Aug 2002 06:17:09 +0000 Subject: import rt 2.0.14 --- rt/webrt/Admin/Users/Modify.html | 259 +++++++++++++++++++++++++++++++++++++++ rt/webrt/Admin/Users/Prefs.html | 97 +++++++++++++++ rt/webrt/Admin/Users/Rights.html | 1 + rt/webrt/Admin/Users/index.html | 71 +++++++++++ 4 files changed, 428 insertions(+) create mode 100755 rt/webrt/Admin/Users/Modify.html create mode 100755 rt/webrt/Admin/Users/Prefs.html create mode 100644 rt/webrt/Admin/Users/Rights.html create mode 100755 rt/webrt/Admin/Users/index.html (limited to 'rt/webrt/Admin/Users') diff --git a/rt/webrt/Admin/Users/Modify.html b/rt/webrt/Admin/Users/Modify.html new file mode 100755 index 000000000..b6daed49b --- /dev/null +++ b/rt/webrt/Admin/Users/Modify.html @@ -0,0 +1,259 @@ +<& /Admin/Elements/Header, Title => $title &> +<& /Admin/Elements/UserTabs, id => $id, current_subtab => '/Admin/Elements/Modify.html?id='.$id &> + +<& /Elements/ListActions, actions => \@results &> + +
+%if ($Create) { + +% } else { + +% } + + + + + + + + + + + + + + +
+<& /Elements/TitleBoxStart, title => 'Identity' &> + +Username: (required)
+Email:
+Real Name:
+Nickname: +
+Unix login: +
+Extra info: +<& /Elements/TitleBoxEnd &> +
+<& /Elements/TitleBoxStart, title => 'Access control' &> + +> +Let this user access RT
+ + + +> Let this user be granted rights
+ +% unless ($RT::WebExternalAuth) { + + + + + + + + +
+New Password: + + +
+Retype Password: + + +
+% } +<& /Elements/TitleBoxEnd &> +
+<& /Elements/TitleBoxStart, title => 'Location' &> +Organization: +
+Address1: +
+Address2: +
+City: + +State: + +Zip: +
+Country: +
+ + +<& /Elements/TitleBoxEnd &> +
+ + +<& /Elements/TitleBoxStart, title => 'Phone numbers' &> +Home: + +Work: + +Mobile: + +Pager: +<& /Elements/TitleBoxEnd &> +
+<& /Elements/TitleBoxStart, title => 'Comments about this user' &> + +<& /Elements/TitleBoxEnd &> + + +%if ($UserObj->Privileged) { +
+<& /Elements/TitleBoxStart, title => 'Signature' &> + +<& /Elements/TitleBoxEnd &> +% } + +
+ + +<& /Elements/Submit &> +
+ + +<%INIT> + +my $UserObj = new RT::User($session{'CurrentUser'}); +my ($title, $PrivilegedChecked, $EnabledChecked, $Disabled, $result, @results); + +my ($val, $msg); + +if ($Create) { + $title = "Create a new user"; +} +else { + + if ($id eq 'new') { + ($val, $msg) = $UserObj->Create( Name => $Name, + EmailAddress => $ARGS{'EmailAddress'} + ); + if ($val) { + push @results, $msg; + } else { + push @results, 'User could not be created: '. $msg; + } + + } + else { + $UserObj->Load($id) || $UserObj->Load($Name) || Abort("Couldn't load user '$Name'"); + $val = $UserObj->Id(); + } + + if ($val) { + $title = "Modify the user ". $UserObj->Name; + } + + # If the create failed + else { + $title = "Create a new user"; + $Create = 1; + } + + + +} + + + + +# If we have a user to modify, lets try. +if ($UserObj->Id) { + + my @fields = qw(Name Comments Signature EmailAddress FreeformContactInfo + Organization RealName NickName Lang EmailEncoding WebEncoding + ExternalContactInfoId ContactInfoSystem Gecos ExternalAuthId + AuthSystem HomePhone WorkPhone MobilePhone PagerPhone Address1 + Address2 City State Zip Country + ); + + my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields, + Object => $UserObj, + ARGSRef => \%ARGS ); + push (@results,@fieldresults); + + +# {{{ Deal with special fields: Privileged, Enabled and Password +if ( ($SetPrivileged) and ( $Privileged != $UserObj->Privileged) ) { +my ($code, $msg) = $UserObj->SetPrivileged($Privileged); + push @results, 'Privileged status: '. $msg; +} + +#we're asking about enabled on the web page but really care about disabled. +if ($Enabled == 1) { + $Disabled = 0; +} +else { + $Disabled = 1; +} +if ( ($SetEnabled) and ( $Disabled != $UserObj->Disabled) ) { + my ($code, $msg) = $UserObj->SetDisabled($Disabled); + push @results, 'Enabled status '. $msg; +} + + +#TODO: make this report errors properly +if ((defined $Pass1) and ($Pass1 ne '') and ($Pass1 eq $Pass2) and (!$UserObj->IsPassword($Pass1))) { + my ($code, $msg); + ($code, $msg) = $UserObj->SetPassword($Pass1); + push @results, 'Password: '. $msg; +} + +# }}} +} + + +# {{{ Do some setup for the ui +unless ($UserObj->Disabled()) { + $EnabledChecked ="CHECKED"; +} + +if ($UserObj->Privileged()) { + $PrivilegedChecked = "CHECKED"; +} + +# }}} + + + +<%ARGS> +$id => undef +$Name => undef +$Comments => undef +$Signature => undef +$EmailAddress => undef +$FreeformContactInfo => undef +$Organization => undef +$RealName => undef +$NickName => undef +$Privileged => undef +$SetPrivileged => undef +$Enabled => undef +$SetEnabled => undef +$Lang => undef +$EmailEncoding => undef +$WebEncoding => undef +$ExternalContactInfoId => undef +$ContactInfoSystem => undef +$Gecos => undef +$ExternalAuthId => undef +$AuthSystem => undef +$HomePhone => undef +$WorkPhone => undef +$MobilePhone => undef +$PagerPhone => undef +$Address1 => undef +$Address2 => undef +$City => undef +$State => undef +$Zip => undef +$Country => undef +$Pass1 => undef +$Pass2=> undef +$Create=> undef + diff --git a/rt/webrt/Admin/Users/Prefs.html b/rt/webrt/Admin/Users/Prefs.html new file mode 100755 index 000000000..4a9fc5cdf --- /dev/null +++ b/rt/webrt/Admin/Users/Prefs.html @@ -0,0 +1,97 @@ +<& /Elements/Header, Title=>"User view" &> + +<& /Elements/ViewUser, User=>$u &> + +%if ($session{CurrentUser} && ($session{CurrentUser}->Id == $id)) { + <& /Elements/TitleBoxStart, title => 'Signature' &> +
+> +

+ +
+ <& /Elements/TitleBoxEnd &> +
+ Open tickets (from listing) in another window: >
+ Open tickets (from listing) in a new window: >
+ +
+%} + + <& /Elements/TitleBoxStart, title => 'Email' &> +
+ + +
+ <& /Elements/TitleBoxEnd &> + <& /Elements/TitleBoxStart, title => 'Real Name' &> +
+ + +
+ <& /Elements/TitleBoxEnd &> + + <& /Elements/TitleBoxStart, title => 'User ID' &> +
+ + +
+ <& /Elements/TitleBoxEnd &> + +%# TODO: alternative email addresses + merging users + +<%ARGS> +$id => $session{CurrentUser} ? $session{CurrentUser}->Id : 0 +$Signature => undef +$Email => undef +$RealName => undef +$Name => undef + + +<%INIT> +require RT::User; +my $u=RT::User->new($session{CurrentUser}); +$u->Load($id) || die "Couldn't load that user ($id)"; +if ($Signature) { +my ($val, $msg)=$u->SetSignature($Signature); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($Email) { +my ($val, $msg)=$u->SetEmailAddress($Email); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($RealName) { +my ($val, $msg)=$u->SetRealName($RealName); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($Name) { +my ($val, $msg)=$u->SetName($Name); +$RT::Logger->log(level=>($val ? 'info' : 'error'), message=>$msg); +} + +if ($ARGS{NewWindowSetting}) { +if ($ARGS{NewWindowOption}) { +$session{NewWindowOption}=1; +} else { +delete $session{NewWindowOption}; +} +if ($ARGS{AlwaysNewWindowOption}) { +$session{NewWindowOption}=1; +$session{AlwaysNewWindowOption}=1; +} else { +delete $session{AlwaysNewWindowOption}; +} +} + + + + + + + + + + + diff --git a/rt/webrt/Admin/Users/Rights.html b/rt/webrt/Admin/Users/Rights.html new file mode 100644 index 000000000..3b94f9157 --- /dev/null +++ b/rt/webrt/Admin/Users/Rights.html @@ -0,0 +1 @@ +Placeholder diff --git a/rt/webrt/Admin/Users/index.html b/rt/webrt/Admin/Users/index.html new file mode 100755 index 000000000..383513710 --- /dev/null +++ b/rt/webrt/Admin/Users/index.html @@ -0,0 +1,71 @@ +<& /Admin/Elements/Header, Title => 'Admin users' &> +<& /Admin/Elements/Tabs, current_tab => 'Admin/Users/' &> + + +<& /Elements/TitleBoxStart, title => 'Select a user' &> + + + + + + +
+ +
+ +Find people whose <& /Elements/SelectUsers &>
+ Include disabled users in search. +
+
+
+
+
    +% if ($session{'CurrentUser'}->HasSystemRight('AdminUsers')) { +
  • Create a new user

  • +
+% } + +<%$caption%>
+ +
+<& /Elements/TitleBoxEnd &> + +<%INIT> +my ($user, $caption); +my $users = new RT::Users($session{'CurrentUser'}); + +if ($FindDisabledUsers) { + $users->{'find_disabled_rows'} = 1; +} + +unless (defined $UserString) { + $users->LimitToPrivileged(); + $caption = "Privileged users"; +} +else { + $caption = "Users matching search criteria"; + + if ($UserString) { + $users->Limit( FIELD => $UserField, + OPERATOR => $UserOp, + VALUE => $UserString); + +} +} + +<%ARGS> +$UserString => undef +$UserOp => '=' +$UserField => 'Name' +$IdLike => undef +$EmailLike => undef +$FindDisabledUsers => 0 + -- cgit v1.2.1