mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-07-01 22:46:13 +00:00
Fix budget voter for use with household
This commit is contained in:
parent
2e59c1415b
commit
f60f927549
@ -98,7 +98,7 @@ class ElementController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function indexHouseholdAction(Household $household)
|
public function indexHouseholdAction(Household $household)
|
||||||
{
|
{
|
||||||
// $this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);
|
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);
|
||||||
|
|
||||||
$charges = $this->em
|
$charges = $this->em
|
||||||
->getRepository(Charge::class)
|
->getRepository(Charge::class)
|
||||||
|
@ -282,7 +282,7 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %} #}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
||||||
@ -291,7 +291,7 @@
|
|||||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{# {% endif %} #}
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -352,7 +352,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}
|
{% if (resources|length + charges|length) == 0 or futureCharges|length > 0 or futureResources|length > 0 or pastCharges|length > 0 or pastResources|length > 0 %}
|
||||||
{# {% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %} #}
|
{% if is_granted('CHILL_BUDGET_ELEMENT_CREATE', household) %}
|
||||||
<ul class="record_actions sticky-form-buttons">
|
<ul class="record_actions sticky-form-buttons">
|
||||||
<li>
|
<li>
|
||||||
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
<a class="btn btn-create" href="{{ path('chill_budget_resource_household_new', { 'id': household.id} ) }}">{{ 'Create new resource'|trans }}</a>
|
||||||
@ -361,7 +361,7 @@
|
|||||||
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
<a class="btn btn-create" href="{{ path('chill_budget_charge_household_new', { 'id': household.id} ) }}">{{ 'Create new charge'|trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{# {% endif %} #}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -69,7 +69,7 @@ class BudgetElementVoter extends AbstractChillVoter implements ProvideRoleHierar
|
|||||||
protected function supports($attribute, $subject)
|
protected function supports($attribute, $subject)
|
||||||
{
|
{
|
||||||
return (in_array($attribute, self::ROLES, true) && $subject instanceof AbstractElement)
|
return (in_array($attribute, self::ROLES, true) && $subject instanceof AbstractElement)
|
||||||
|| ($subject instanceof Person && in_array($attribute, [self::SEE, self::CREATE], true));
|
|| (($subject instanceof Person || $subject instanceof Household) && in_array($attribute, [self::SEE, self::CREATE], true));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user