| 1 | package SPOPS::Exception::Security; | ||||||||||
| 2 | |||||||||||
| 3 | # $Id: Security.pm,v 3.2 2004/06/02 00:48:22 lachoy Exp $ | ||||||||||
| 4 | |||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use base qw( SPOPS::Exception ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use SPOPS::Secure qw( :verbose :level ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | $SPOPS::Exception::Security::VERSION = sprintf("%d.%02d", q$Revision: 3.2 $ =~ /(\d+)\.(\d+)/); | |||||||||
| 10 | 3 | @SPOPS::Exception::Security::EXPORT_OK = qw( spops_security_error ); | |||||||||
| 11 | |||||||||||
| 12 | 3 | my @FIELDS = qw( security_required security_found ); | |||||||||
| 13 | 3 | SPOPS::Exception::Security->mk_accessors( @FIELDS ); | |||||||||
| 14 | |||||||||||
| 15 | 3 | my %LEVELS = ( | |||||||||
| 16 | SEC_LEVEL_NONE() => SEC_LEVEL_NONE_VERBOSE, | ||||||||||
| 17 | SEC_LEVEL_SUMMARY() => SEC_LEVEL_SUMMARY_VERBOSE, | ||||||||||
| 18 | SEC_LEVEL_READ() => SEC_LEVEL_READ_VERBOSE, | ||||||||||
| 19 | SEC_LEVEL_WRITE() => SEC_LEVEL_WRITE_VERBOSE, | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | 1 | ▶ | sub get_fields { | ||||||||
|
Subroutine
get_fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 23 | 1 | return ( $_[0]->SUPER::get_fields, @FIELDS ); | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub spops_security_error { | ||||||||
|
Subroutine
spops_security_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | goto &SPOPS::Exception( 'SPOPS::Exception::Security', @_ ); | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | ▶ | sub to_string { | ||||||||
|
Subroutine
to_string: called CC=3 SCAR=11.4
Pod
undocumented
| |||||||||||
| 31 | 1 | my ( $self ) = @_; | |||||||||
| 32 | my $req = ( $self->security_required ) | ||||||||||
| 33 | 1 | ▶ | ? $LEVELS{ $self->security_required } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | : 'none specified'; | ||||||||||
| 35 | my $fnd = ( $self->security_found ) | ||||||||||
| 36 | 1 | ▶ | ? $LEVELS{ $self->security_found } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | : 'none specified'; | ||||||||||
| 38 | 1 | return "Security violation. Object requested [$req] and got [$fnd]"; | |||||||||
| 39 | } | ||||||||||
| 40 | |||||||||||
| 41 | 3 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||