#################### main pod documentation begin ################### =head1 NAME Zymonic::Action::SendKeys Zymonic Workflow System Action module =head1 SYNOPSIS use Zymonic::Action::Sendkeys; Works with the KeyEntry Form class to send the key(s) to the Decryptor. =head1 DESCRIPTION Works with the KeyEntry Form class to send the key(s) to the Decryptor. =head1 USAGE Include the class in the XML, must be preceeded by the KeyEntry state. =head1 BUGS NONE =head1 SUPPORT As in the license, Zymonic is provided without warranty or support unless purchased separately, however... If you email zymonic-support@zednax.com your issue will be noted and may receive a response. For security issues, please contact zymonic-security@zednax.com and someone will respond within 8 working hours. =head1 AUTHOR Alex Masidlover et al. CPAN ID: MODAUTHOR Zednax Limited alex.masidlover@zednax.com http://www.zednax.com =head1 COPYRIGHT This program is free software licensed under the... Alfresco Public License 1.0 The full text of the license can be found in the LICENSE file included with this module. Other licenses may be acceptable if including parts of Zymonic in larger projects, please contact Zednax for details. =head1 SEE ALSO Zymonic perl(1). =cut #################### main pod documentation end ################### package Zymonic::Action::SendKeys; use strict; BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 'D1-r7186'; @ISA = qw(Exporter); #Give a hoot don't pollute, do not export more than needed by default @EXPORT = qw(); @EXPORT_OK = qw(); %EXPORT_TAGS = (); } use base "Zymonic::Action"; #################### subroutine header begin #################### =head2 do Usage : $action->do Purpose : Performs the action, i.e. generates the report Returns : nothing Argument : nothing Throws : TODO Comment : nothing =cut #################### subroutine header end #################### sub do { my $self = shift; my $fake = shift || ''; my $no_display_attributes = shift || 0; my $conditions = $self->conditions($fake); $self->{condition_passed} = 'false'; $self->{success} = 'false'; if ( $conditions->{condition_passed} ) { $self->{condition_passed} = 'true'; my @kpc_fields = map { my $ref = $self->{state}->{form}->{records}->[0]->{fields}->{$_}; $ref->{parent}->get_object($ref) } grep { $_ =~ /^kpc/ } keys( %{ $self->{state}->{form}->{records}->[0]->{fields} } ); # Work out which key group the user is in. my $keygroup = $self->{DB}->run_query( { string => 'SELECT keygroup FROM zz_keyholders WHERE username = ?', params => [ $self->{auth}->{user} ], } ); if ( ref($keygroup) ne 'ARRAY' and scalar( @{$keygroup} ) > 0 ) { $self->{success} = 'true'; return; } my $response = $self->decryptor_client()->call_decryptor( { messagetype => 'SendKEKPart', username => $self->{auth}->{user}, kek_part_number => $keygroup->[0]->{keygroup}, kek_parts => { map { substr( $_->{zname}, 4, 1 ) => $_->value, } @kpc_fields } }, 'all', 'nokey' ); Zymonic::Exception::Decryptor::KeyManagement->throw( error => 'Error from decryptor', extras => $response, info_msg => $response->{error}, catchable => 'true' ) unless $response->{ok}; $self->{success} = 'true'; } } #################### subroutine header begin #################### =head2 decyptor_client Usage : $form->decryptor_client; Purpose : TODO Returns : nothing Argument : nothing Throws : TODO Comment : See Also : =cut #################### subroutine header end #################### sub decryptor_client { my $self = shift; $self->{decryptor_client} = Zymonic::Decryptor::Client->new( parent => $self, config => $self->{config}, db => $self->{DB} ) unless ( defined( $self->{decryptor_client} ) ); return $self->{decryptor_client}; } 1;