mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
39 lines
957 B
PHP
39 lines
957 B
PHP
<?php
|
|
/**
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2016 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Alchemy\Phrasea\Order;
|
|
|
|
use Alchemy\Phrasea\Application\Helper\AclAware;
|
|
use Alchemy\Phrasea\Model\Entities\OrderElement;
|
|
use Alchemy\Phrasea\Model\Entities\User;
|
|
|
|
class OrderValidator
|
|
{
|
|
use AclAware;
|
|
|
|
/**
|
|
* @param User $acceptor
|
|
* @param OrderElement[] $elements
|
|
* @return bool
|
|
*/
|
|
public function isGrantedValidation(User $acceptor, $elements)
|
|
{
|
|
$acceptableCollections = $this->getAclForUser($acceptor)->getOrderMasterCollectionsBaseIds();
|
|
|
|
$elementsCollections = [];
|
|
|
|
foreach ($elements as $element) {
|
|
$elementsCollections[$element->getBaseId()] = true;
|
|
}
|
|
|
|
return empty(array_diff(array_keys($elementsCollections), $acceptableCollections));
|
|
}
|
|
}
|