[Rt-commit] r6736 - in rt/branches/3.7-EXPERIMENTAL: .
ruz at bestpractical.com
ruz at bestpractical.com
Sun Jan 14 23:31:09 EST 2007
Author: ruz
Date: Sun Jan 14 23:31:09 2007
New Revision: 6736
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
Log:
r4348 at cubic-pc: cubic | 2007-01-13 04:57:24 +0300
* SetSign/Sign/SetEncrypt/Encrypt methods on RT::Queue
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Queue_Overlay.pm Sun Jan 14 23:31:09 2007
@@ -349,9 +349,11 @@
CorrespondAddress => '',
Description => '',
CommentAddress => '',
- InitialPriority => "0",
- FinalPriority => "0",
- DefaultDueIn => "0",
+ InitialPriority => 0,
+ FinalPriority => 0,
+ DefaultDueIn => 0,
+ Sign => undef,
+ Encrypt => undef,
@_
);
@@ -378,8 +380,19 @@
$RT::Handle->Rollback();
return ( 0, $self->loc('Queue could not be created') );
}
+ $RT::Handle->Commit;
+
+ if ( defined $args{'Sign'} ) {
+ my ($status, $msg) = $self->SetSign( $args{'Sign'} );
+ $RT::Logger->error("Couldn't set attribute 'Sign': $msg")
+ unless $status;
+ }
+ if ( defined $args{'Encrypt'} ) {
+ my ($status, $msg) = $self->SetEncrypt( $args{'Encrypt'} );
+ $RT::Logger->error("Couldn't set attribute 'Encrypt': $msg")
+ unless $status;
+ }
- $RT::Handle->Commit();
return ( $id, $self->loc("Queue created") );
}
@@ -466,6 +479,56 @@
# }}}
+=head2 SetSign
+
+=cut
+
+sub Sign {
+ my $self = shift;
+ my $value = shift;
+
+ return undef unless $self->CurrentUserHasRight('SeeQueue');
+ my $attr = $self->FirstAttribute('Sign') or return 0;
+ return $attr->Content;
+}
+
+sub SetSign {
+ my $self = shift;
+ my $value = shift;
+
+ return ( 0, $self->loc('Permission Denied') )
+ unless $self->CurrentUserHasRight('AdminQueue');
+
+ return $self->SetAttribute(
+ Name => 'Sign',
+ Description => 'Sign outgoing messages by default',
+ Content => $value,
+ );
+}
+
+sub Encrypt {
+ my $self = shift;
+ my $value = shift;
+
+ return undef unless $self->CurrentUserHasRight('SeeQueue');
+ my $attr = $self->FirstAttribute('Encrypt') or return 0;
+ return $attr->Content;
+}
+
+sub SetEncrypt {
+ my $self = shift;
+ my $value = shift;
+
+ return ( 0, $self->loc('Permission Denied') )
+ unless $self->CurrentUserHasRight('AdminQueue');
+
+ return $self->SetAttribute(
+ Name => 'Encrypt',
+ Description => 'Encrypt outgoing messages by default',
+ Content => $value,
+ );
+}
+
# {{{ sub Templates
=head2 Templates
More information about the Rt-commit
mailing list