mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Allow some Acl method to be used with RecordReference
This commit is contained in:
@@ -10,15 +10,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use Alchemy\Phrasea\Application;
|
use Alchemy\Phrasea\Application;
|
||||||
use Alchemy\Phrasea\Model\Entities\User;
|
|
||||||
use Doctrine\DBAL\DBALException;
|
|
||||||
use Alchemy\Phrasea\Model\RecordInterface;
|
|
||||||
|
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\AclEvents;
|
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\AccessPeriodChangedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\AccessPeriodChangedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\AccessToBaseGrantedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\AccessToBaseGrantedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\AccessToBaseRevokedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\AccessToBaseRevokedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\AccessToSbasGrantedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\AccessToSbasGrantedEvent;
|
||||||
|
use Alchemy\Phrasea\Core\Event\Acl\AclEvents;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasOnBaseChangedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasOnBaseChangedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasOnBaseRemovedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasOnBaseRemovedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasResetEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\DownloadQuotasResetEvent;
|
||||||
@@ -26,6 +22,10 @@ use Alchemy\Phrasea\Core\Event\Acl\MasksOnBaseChangedEvent;
|
|||||||
use Alchemy\Phrasea\Core\Event\Acl\RightsToBaseChangedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\RightsToBaseChangedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\RightsToSbasChangedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\RightsToSbasChangedEvent;
|
||||||
use Alchemy\Phrasea\Core\Event\Acl\SysadminChangedEvent;
|
use Alchemy\Phrasea\Core\Event\Acl\SysadminChangedEvent;
|
||||||
|
use Alchemy\Phrasea\Model\Entities\User;
|
||||||
|
use Alchemy\Phrasea\Model\RecordInterface;
|
||||||
|
use Alchemy\Phrasea\Model\RecordReferenceInterface;
|
||||||
|
use Doctrine\DBAL\DBALException;
|
||||||
|
|
||||||
|
|
||||||
class ACL implements cache_cacheableInterface
|
class ACL implements cache_cacheableInterface
|
||||||
@@ -52,51 +52,40 @@ class ACL implements cache_cacheableInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var User
|
||||||
* @var user
|
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var array
|
||||||
* @var Array
|
|
||||||
*/
|
*/
|
||||||
protected $_rights_sbas;
|
protected $_rights_sbas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var array
|
||||||
* @var Array
|
|
||||||
*/
|
*/
|
||||||
protected $_rights_bas;
|
protected $_rights_bas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var array
|
||||||
* @var Array
|
|
||||||
*/
|
*/
|
||||||
protected $_rights_records_document;
|
protected $_rights_records_document;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var array
|
||||||
* @var Array
|
|
||||||
*/
|
*/
|
||||||
protected $_rights_records_preview;
|
protected $_rights_records_preview;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var array
|
||||||
* @var Array
|
|
||||||
*/
|
*/
|
||||||
protected $_limited;
|
protected $_limited;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @var bool
|
||||||
* @var boolean
|
|
||||||
*/
|
*/
|
||||||
protected $is_admin;
|
protected $is_admin;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @var Array
|
|
||||||
*/
|
|
||||||
protected $_global_rights = [
|
protected $_global_rights = [
|
||||||
'addrecord' => false,
|
'addrecord' => false,
|
||||||
'addtoalbum' => false,
|
'addtoalbum' => false,
|
||||||
@@ -121,7 +110,6 @@ class ACL implements cache_cacheableInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @var Application
|
* @var Application
|
||||||
*/
|
*/
|
||||||
protected $app;
|
protected $app;
|
||||||
@@ -140,15 +128,11 @@ class ACL implements cache_cacheableInterface
|
|||||||
*
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @param Application $app
|
* @param Application $app
|
||||||
*
|
|
||||||
* @return \ACL
|
|
||||||
*/
|
*/
|
||||||
public function __construct(User $user, Application $app)
|
public function __construct(User $user, Application $app)
|
||||||
{
|
{
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->app = $app;
|
$this->app = $app;
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,10 +148,10 @@ class ACL implements cache_cacheableInterface
|
|||||||
/**
|
/**
|
||||||
* Check if a hd grant has been received for a record
|
* Check if a hd grant has been received for a record
|
||||||
*
|
*
|
||||||
* @param \record_adapter $record
|
* @param RecordReferenceInterface $record
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_hd_grant(RecordInterface $record)
|
public function has_hd_grant(RecordReferenceInterface $record)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->load_hd_grant();
|
$this->load_hd_grant();
|
||||||
@@ -179,7 +163,7 @@ class ACL implements cache_cacheableInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function grant_hd_on(RecordInterface $record, User $pusher, $action)
|
public function grant_hd_on(RecordReferenceInterface $record, User $pusher, $action)
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO records_rights
|
$sql = 'REPLACE INTO records_rights
|
||||||
(id, usr_id, sbas_id, record_id, document, `case`, pusher_usr_id)
|
(id, usr_id, sbas_id, record_id, document, `case`, pusher_usr_id)
|
||||||
@@ -203,7 +187,7 @@ class ACL implements cache_cacheableInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function grant_preview_on(RecordInterface $record, User $pusher, $action)
|
public function grant_preview_on(RecordReferenceInterface $record, User $pusher, $action)
|
||||||
{
|
{
|
||||||
$sql = 'REPLACE INTO records_rights
|
$sql = 'REPLACE INTO records_rights
|
||||||
(id, usr_id, sbas_id, record_id, preview, `case`, pusher_usr_id)
|
(id, usr_id, sbas_id, record_id, preview, `case`, pusher_usr_id)
|
||||||
@@ -230,10 +214,10 @@ class ACL implements cache_cacheableInterface
|
|||||||
/**
|
/**
|
||||||
* Check if a hd grant has been received for a record
|
* Check if a hd grant has been received for a record
|
||||||
*
|
*
|
||||||
* @param \record_adapter $record
|
* @param RecordReferenceInterface $record
|
||||||
* @return boolean
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has_preview_grant(RecordInterface $record)
|
public function has_preview_grant(RecordReferenceInterface $record)
|
||||||
{
|
{
|
||||||
$this->load_hd_grant();
|
$this->load_hd_grant();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user