Commit 6df730cd2972bfaa8a50c7a6ba42ec51a0bb39bf

Authored by ALEXIS-PC\alexis
1 parent f0f9b299
Exists in dev

fixing display of links on the left side menu depending the role of user

src/core/pyros_django/dashboard/templatetags/__init__.py 0 → 100644
src/core/pyros_django/dashboard/templatetags/tags.py
... ... @@ -54,6 +54,7 @@ def active_account(pk):
54 54 except PyrosUser.DoesNotExist:
55 55 return ("NO USER DB")
56 56  
  57 +@register.simple_tag
57 58 def user_level(request):
58 59 if request.user.is_authenticated:
59 60 return (request.user.get_priority())
... ...
src/core/pyros_django/misc/templates/base.html
... ... @@ -102,6 +102,7 @@ a {
102 102 </style>
103 103  
104 104 {% load tags %}
  105 +{% user_level request as USER_LEVEL %}
105 106 {% get_level "USER_LEVEL_TAS" as USER_LEVEL_TAC %}
106 107 {% get_level "USER_LEVEL_OBSERVER" as USER_LEVEL_OBSERVER %}
107 108 {% get_level "USER_LEVEL_IE" as USER_LEVEL_IE %}
... ... @@ -151,7 +152,7 @@ a {
151 152 <li><a href="{% url "proposal" %}">Proposal</a></li>
152 153 {% endif %}
153 154  
154   -
  155 +
155 156 </ul>
156 157 <ul class="nav navbar-nav navbar-right navbar-user navbar-expand-lg">
157 158 <li><a id="plc_state"></a></li>
... ...
src/core/pyros_django/monitoring/views.py
... ... @@ -8,7 +8,7 @@ from common.models import AgentCmd
8 8 def index(request):
9 9 if request.user.is_authenticated:
10 10 # return the initial view (the dashboard's one)
11   - return render(request, 'dashboard/index.html', {'USER_LEVEL': request.user.get_priority, 'base_template' : "base.html"})
  11 + return render(request, 'dashboard/index.html', {'USER_LEVEL': request.user.get_priority(), 'base_template' : "base.html"})
12 12 return render(request, 'dashboard/index.html', {'USER_LEVEL': 0, 'base_template' : "base_unlogged.html"})
13 13  
14 14  
... ...