mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
add ACTIVITY_SEE_DETAILS role
This new role allow to see the details (remark + reasons) in the timeline.
This commit is contained in:
parent
f7c9e6f3b8
commit
239ea38e92
@ -78,9 +78,10 @@ class ChillActivityExtension extends Extension implements PrependExtensionInterf
|
||||
{
|
||||
$container->prependExtensionConfig('security', array(
|
||||
'role_hierarchy' => array(
|
||||
ActivityVoter::UPDATE => array(ActivityVoter::SEE),
|
||||
ActivityVoter::CREATE => array(ActivityVoter::SEE),
|
||||
ActivityVoter::DELETE => array(ActivityVoter::SEE)
|
||||
ActivityVoter::UPDATE => array(ActivityVoter::SEE_DETAILS),
|
||||
ActivityVoter::CREATE => array(ActivityVoter::SEE_DETAILS),
|
||||
ActivityVoter::DELETE => array(ActivityVoter::SEE_DETAILS),
|
||||
ActivityVoter::SEE_DETAILS => array(ActivityVoter::SEE)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
{% import 'ChillActivityBundle:ActivityReason:macro.html.twig' as m %}
|
||||
|
||||
<div>
|
||||
<h3>{{ activity.date|localizeddate('long', 'none') }}<span class="activity"> / {{ 'Activity'|trans }}</span></h3>
|
||||
<div class="statement">
|
||||
@ -9,5 +11,20 @@
|
||||
) }}</span> <span class="links"><a href="{{ path('chill_activity_activity_show',
|
||||
{ 'person_id': person.id, 'id': activity.id} ) }}">{{ 'Show the activity'|trans }}</a></span>
|
||||
|
||||
{% if is_granted(constant('Chill\\ActivityBundle\\Security\\Authorization\\ActivityVoter::SEE_DETAILS'), activity) %}
|
||||
<dl class="chill_view_data">
|
||||
<dt class="inline">{{ 'Remark'|trans }}</dt>
|
||||
<dd>{% if activity.remark is empty %}{{ 'No remarks'|trans }}{% else %}<blockquote class="chill-user-quote">{{ activity.remark|nl2br }}</blockquote>{% endif %}</dd>
|
||||
|
||||
<dt class="inline">{{ 'Reasons'|trans }}</dt>
|
||||
{%- if activity.reasons is empty -%}
|
||||
<dd><span class="chill-no-data-statement">{{ 'No reason associated'|trans }}</span></dd>
|
||||
{%- else -%}
|
||||
<dd>{% for r in activity.reasons %}{{ m.reason(r) }} {% endfor %}</dd>
|
||||
{%- endif -%}
|
||||
|
||||
</dl>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -21,7 +21,7 @@ namespace Chill\ActivityBundle\Security\Authorization;
|
||||
|
||||
use Chill\MainBundle\Security\Authorization\AbstractChillVoter;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
|
||||
use Chill\MainBundle\Security\ProvideRoleInterface;
|
||||
use Chill\MainBundle\Security\ProvideRoleHierarchyInterface;
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
|
||||
/**
|
||||
@ -29,7 +29,7 @@ use Chill\MainBundle\Entity\Center;
|
||||
*
|
||||
* @author Julien Fastré <julien.fastre@champs-libres.coop>
|
||||
*/
|
||||
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleInterface
|
||||
class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleHierarchyInterface
|
||||
{
|
||||
const STATS = 'CHILL_ACTIVITY_STATS';
|
||||
const LISTS = 'CHILL_ACTIVITY_LIST';
|
||||
@ -74,4 +74,8 @@ class ActivityStatsVoter extends AbstractChillVoter implements ProvideRoleInterf
|
||||
return $this->getSupportedAttributes();
|
||||
}
|
||||
|
||||
public function getRolesWithHierarchy()
|
||||
{
|
||||
return [ 'Activity' => $this->getRoles() ];
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
{
|
||||
const CREATE = 'CHILL_ACTIVITY_CREATE';
|
||||
const SEE = 'CHILL_ACTIVITY_SEE';
|
||||
const SEE_DETAILS = 'CHILL_ACTIVITY_SEE_DETAILS';
|
||||
const UPDATE = 'CHILL_ACTIVITY_UPDATE';
|
||||
const DELETE = 'CHILL_ACTIVITY_DELETE';
|
||||
|
||||
@ -48,7 +49,8 @@ class ActivityVoter extends AbstractChillVoter implements ProvideRoleHierarchyIn
|
||||
|
||||
protected function getSupportedAttributes()
|
||||
{
|
||||
return array(self::CREATE, self::SEE, self::UPDATE, self::DELETE);
|
||||
return array(self::CREATE, self::SEE, self::UPDATE, self::DELETE,
|
||||
self::SEE_DETAILS);
|
||||
}
|
||||
|
||||
protected function getSupportedClasses()
|
||||
|
Loading…
x
Reference in New Issue
Block a user