/
FormEnd
33 lines (26 loc) · 924 Bytes
/
FormEnd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<%args>
$UserObj => undef
</%args>
<%init>
my $cfs = $UserObj->CustomFields();
$cfs->Limit(FIELD => 'Name', VALUE => 'PublicKey');
my $cf = $cfs->First;
unless ( $cf && $cf->id ) {
$RT::Logger->error("Couldn't load 'PublicKey' user's CF");
return;
}
my %request = $m->request_args();
if (my $content = $request{'SMIME-'.$cf->id. '-Values'}) {
$UserObj->DeleteAttribute('SMIMEKeyNotAfter');
if ($session{'CurrentUser'}->HasRight( Right => 'ModifySelf', Object => $RT::System )
and ($content ne $UserObj->FirstCustomFieldValue($cf->id))
) {
my $u = RT::User->new($RT::SystemUser);
$u->Load($session{'CurrentUser'}->id);
$u->AddCustomFieldValue(Field => $cf->id, Value => $content);
}
}
</%init>
<&|/Widgets/TitleBox, title => 'S/MIME Public Key'&>
<&/Elements/EditCustomField, Object=> $UserObj, CustomField => $cf, Cols => 80, NamePrefix=> 'SMIME-' &>
</&>