Use Session among plugin and Twig

Hi, I would like to enable some views only if a user belong to a specific group.
In my plugin when a user make a login/logout I set a parameter in session in this way:

Session::put('device_allowed', true); // on login if belong to the group
Session::put('device_allowed', false); // on logout

In the view I do this:

{% if this.session.get('device_allowed')==true %}
  {% component 'devices' %}
{% endif %}

To me doesn’t work. The component devices is always shown.
Where is my mistake?
Thank you

It works, my mistake