mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Fix tests, CS && typo
This commit is contained in:
@@ -445,7 +445,7 @@ class Users implements ControllerProviderInterface
|
|||||||
foreach ($deny as $usr => $bases) {
|
foreach ($deny as $usr => $bases) {
|
||||||
$cache_to_update[$usr] = true;
|
$cache_to_update[$usr] = true;
|
||||||
foreach ($bases as $bas) {
|
foreach ($bases as $bas) {
|
||||||
if (null !== $registration = $this->getRepository()->findOneBy([
|
if (null !== $registration = $app['registration-manager']->getRepository()->findOneBy([
|
||||||
'user' => $usr,
|
'user' => $usr,
|
||||||
'baseId' => $bas
|
'baseId' => $bas
|
||||||
])) {
|
])) {
|
||||||
@@ -461,12 +461,12 @@ class Users implements ControllerProviderInterface
|
|||||||
|
|
||||||
foreach ($bases as $bas) {
|
foreach ($bases as $bas) {
|
||||||
$collection = \collection::get_from_base_id($app, $bas);
|
$collection = \collection::get_from_base_id($app, $bas);
|
||||||
if (null !== $registration = $this->getRepository()->findOneBy([
|
if (null !== $registration = $app['registration-manager']->getRepository()->findOneBy([
|
||||||
'user' => $user->get_id(),
|
'user' => $user->get_id(),
|
||||||
'baseId' => $collection->get_base_id()
|
'baseId' => $collection->get_base_id()
|
||||||
])) {
|
])) {
|
||||||
$done[$usr][$bas] = true;
|
$done[$usr][$bas] = true;
|
||||||
$app['registration-manager']->acceptDemand($registration, $user, $collection, $options[$usr][$bas]['HD'], $options[$usr][$bas]['WM']);
|
$app['registration-manager']->acceptRegistration($registration, $user, $collection, $options[$usr][$bas]['HD'], $options[$usr][$bas]['WM']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -81,11 +81,6 @@ class PhraseaRegisterForm extends AbstractType
|
|||||||
if (false === $collInfo['can-register']) {
|
if (false === $collInfo['can-register']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($choices[$dbName])) {
|
|
||||||
$choices[$dbName] = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$choices[$dbName][$baseId] = \phrasea::bas_labels($baseId, $this->app);
|
$choices[$dbName][$baseId] = \phrasea::bas_labels($baseId, $this->app);
|
||||||
$baseIds[] = $baseId;
|
$baseIds[] = $baseId;
|
||||||
}
|
}
|
||||||
|
@@ -54,8 +54,7 @@ class RegistrationManager
|
|||||||
/**
|
/**
|
||||||
* Rejects a registration.
|
* Rejects a registration.
|
||||||
*
|
*
|
||||||
* @param $usrId
|
* @param Registration $registration
|
||||||
* @param $baseId
|
|
||||||
*/
|
*/
|
||||||
public function rejectRegistration(Registration $registration)
|
public function rejectRegistration(Registration $registration)
|
||||||
{
|
{
|
||||||
@@ -68,8 +67,11 @@ class RegistrationManager
|
|||||||
/**
|
/**
|
||||||
* Accepts a registration.
|
* Accepts a registration.
|
||||||
*
|
*
|
||||||
* @param $userId
|
* @param Registration $registration
|
||||||
* @param $basId
|
* @param \User_Adapter $user
|
||||||
|
* @param \Collection $collection
|
||||||
|
* @param bool $grantHd
|
||||||
|
* @param bool $grantWatermark
|
||||||
*/
|
*/
|
||||||
public function acceptRegistration(Registration $registration, \User_Adapter $user, \Collection $collection, $grantHd = false, $grantWatermark = false)
|
public function acceptRegistration(Registration $registration, \User_Adapter $user, \Collection $collection, $grantHd = false, $grantWatermark = false)
|
||||||
{
|
{
|
||||||
@@ -208,6 +210,8 @@ class RegistrationManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Deletes registration for given user.
|
||||||
|
*
|
||||||
* @param $userId
|
* @param $userId
|
||||||
* @param array $baseList
|
* @param array $baseList
|
||||||
*
|
*
|
||||||
|
@@ -1484,7 +1484,7 @@ class databox extends base
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells whether the registration is enable for provided databox or not.
|
* Tells whether the registration is enable or not.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
@@ -172,7 +172,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if table['users'] | length > 0 %}
|
{% if users | length > 0 %}
|
||||||
<form id="accept-demand" action="{{ path('users_submit_demands') }}" method="post">
|
<form id="accept-demand" action="{{ path('users_submit_demands') }}" method="post">
|
||||||
<div class="btn-group btn-all-action">
|
<div class="btn-group btn-all-action">
|
||||||
<button data-event="deny" class="btn deny-checker" type="button">
|
<button data-event="deny" class="btn deny-checker" type="button">
|
||||||
|
@@ -368,18 +368,6 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
|
|||||||
|
|
||||||
public function testRenderDemands()
|
public function testRenderDemands()
|
||||||
{
|
{
|
||||||
$nativeQueryMock = $this->getMockBuilder('Alchemy\Phrasea\Model\NativeQueryProvider')
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$nativeQueryMock->expects($this->once())->method('getUsersRegistrationDemand')->will($this->returnValue([[
|
|
||||||
self::$DI['user'],
|
|
||||||
'date_demand' => new \DateTime(),
|
|
||||||
'base_demand' => 1
|
|
||||||
]]));
|
|
||||||
|
|
||||||
self::$DI['app']['EM.native-query'] = $nativeQueryMock;
|
|
||||||
|
|
||||||
self::$DI['client']->request('GET', '/admin/users/demands/');
|
self::$DI['client']->request('GET', '/admin/users/demands/');
|
||||||
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user