diff Lib/IMPL/Security.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children 6d8092d8ce1b
line wrap: on
line diff
--- a/Lib/IMPL/Security.pm	Tue Apr 10 08:13:22 2012 +0400
+++ b/Lib/IMPL/Security.pm	Tue Apr 10 20:08:29 2012 +0400
@@ -3,43 +3,43 @@
 require IMPL::Security::Rule::RoleCheck;
 
 our @rules = (
-	\&IMPL::Security::Rule::RoleCheck::SatisfyAll
+    \&IMPL::Security::Rule::RoleCheck::SatisfyAll
 );
 
 our $authority = undef;
 
 sub AccessCheck {
-	my ($self, $object, $desiredAccess, $context) = @_;
-	
-	$context ||= IMPL::Security::Context->contextCurrent;
-	
-	$_->() or return 0 foreach @{$self->Rules};
-	
-	return 1;
+    my ($self, $object, $desiredAccess, $context) = @_;
+    
+    $context ||= IMPL::Security::Context->contextCurrent;
+    
+    $_->() or return 0 foreach @{$self->Rules};
+    
+    return 1;
 }
 
 sub Take {
-	my ($self,$principal,$refRoles) = @_;
-	
-	die new IMPL::NotImplementedException();
+    my ($self,$principal,$refRoles) = @_;
+    
+    die new IMPL::NotImplementedException();
 }
 
 sub MakeContext {
-	my ($this,$principal,$refRoles,$auth) = @_;
-	
-	return new IMPL::Security::Context(
-		principal => $principal,
-		rolesAssigned => $refRoles,
-		auth => $auth
-	);
+    my ($this,$principal,$refRoles,$auth) = @_;
+    
+    return new IMPL::Security::Context(
+        principal => $principal,
+        rolesAssigned => $refRoles,
+        auth => $auth
+    );
 }
 
 sub Rules {
-	return \@rules;
+    return \@rules;
 }
 
 sub authority {
-	return $authority;
+    return $authority;
 }
 
 1;
@@ -59,48 +59,48 @@
 use IMPL::Security;
 
 my Method {
-	my $this = shift;
-	
-	# access check in the current context, using standard configuration
-	IMPL::Security->AccessCheck($this,'Method') or die new IMPL::AccessDeniedException("Access is denied");
-	
-	#some more results 
+    my $this = shift;
+    
+    # access check in the current context, using standard configuration
+    IMPL::Security->AccessCheck($this,'Method') or die new IMPL::AccessDeniedException("Access is denied");
+    
+    #some more results 
 }
 
 my DelegationMethod {
-	
-	my $this = shift;
-	
-	#forced delegation 
-	my $delegatedContext = IMPL::Security::Context->new(
-		principal => IMPL::Security::Principal->new(
-			name => 'suser'
-		),
-		rolesAssigned => ['administrator']
-	)
-	
-	my $result;
-	
-	$delegatedContext->Impersonate(sub{
-		$result = $this->Method();
-	});
-	
-	return $result;
+    
+    my $this = shift;
+    
+    #forced delegation 
+    my $delegatedContext = IMPL::Security::Context->new(
+        principal => IMPL::Security::Principal->new(
+            name => 'suser'
+        ),
+        rolesAssigned => ['administrator']
+    )
+    
+    my $result;
+    
+    $delegatedContext->Impersonate(sub{
+        $result = $this->Method();
+    });
+    
+    return $result;
 }
 
 my SafeDelegationMethod {
-	
-	my $this = shift;
-	
-	my $delegatedContext = IMPL::Security->Take( suser => 'administrator' );
-	
-	my $result;
-	
-	$delegatedContext->Impersonate(sub{
-		$result = $this->Method();
-	});
-	
-	return $result;
+    
+    my $this = shift;
+    
+    my $delegatedContext = IMPL::Security->Take( suser => 'administrator' );
+    
+    my $result;
+    
+    $delegatedContext->Impersonate(sub{
+        $result = $this->Method();
+    });
+    
+    return $result;
 }
 
 =end code
@@ -199,11 +199,11 @@
 use parent qw(IMPL::Security);
 
 sub Rules {
-	return [
-		\&Rule1,
-		\&Rule2,
-		#...
-	]
+    return [
+        \&Rule1,
+        \&Rule2,
+        #...
+    ]
 }
 
 =end code