DynStandard LoggedUserBug behoben

This commit is contained in:
holger.trampe 2020-04-24 10:31:33 +02:00
parent 05e9f37c3b
commit 97e7a1ce8f
4 changed files with 29 additions and 26 deletions

View File

@ -69,7 +69,7 @@
{% if request.user.profile.agency.dynamicprofile %}
als <span id="view_info_0">Verantwortlicher</span>
als <span id="view_info_0" style="display: none;">Verantwortlicher</span>
<span id="view_info_1" style="display: none;">Ausführender</span>
<span id="view_info_2" style="display: none;">Vertreter</span>
{% endif %}
@ -90,21 +90,21 @@
{% if request.user.profile.agency.dynamicprofile %}
{% for task in tasks %}
{% isUserInAuth task area request.user as checkIsUserAuth %}
{% isUserInAuth task area user_id as checkIsUserAuth %}
{% if task.area.pk == area.pk and task.visible and checkIsUserAuth %}
<div style="display: none; background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_0" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
</div>
{% endif %}
{% isUserInEx task area request.user as checkIsUserEx %}
{% isUserInEx task area user_id as checkIsUserEx %}
{% if task.area.pk == area.pk and task.visible and checkIsUserEx %}
<div style="display: none; background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_1" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
</div>
{% endif %}
{% isUserInRep task area request.user as checkIsUserRep %}
{% isUserInRep task area user_id as checkIsUserRep %}
{% if task.area.pk == area.pk and task.visible and checkIsUserRep %}
<div style="display: none; background-color: rgba({{area.color.0}},{{area.color.1}},{{area.color.2}}, 1)" class="mb-2 pt-3 pb-1 view_2" id="ele_{{task.pk}}">
<span ><h6 ><a style=" color: #FFFFFF;"href="{% url 'standard-task' task.pk %}"><span class="arrows_area_{{area.pk}} ml-4" style="display:none; float: left;"><i class="fas fa-sort"></i></span>{{task.name}}</a></h6></span>
@ -204,7 +204,8 @@ $( document ).ready(function() {
}
$(document).find(".view_0").show();
$(document).find(".view_1").show();
$(document).find("#view_info_1").show();
});

View File

@ -218,44 +218,46 @@ def getifuserdidcomment(standard, user):
@register.simple_tag
def isUserInAuth(task, area, user):
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
def isUserInAuth(task, area, user_id):
user = User.objects.get(pk=user_id)
#st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area, authority__in=[user])
found = False
for st in st_auth:
if user in st.authority.all():
found = True
print("AUTH FOUND")
break
if len(st_auth) > 0:
found = True
return found
@register.simple_tag
def isUserInEx(task, area, user):
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
def isUserInEx(task, area, user_id):
user = User.objects.get(pk=user_id)
#st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area, executor__in=[user])
found = False
for st in st_auth:
if user in st.executor.all():
found = True
print("EX FOUND")
break
if len(st_auth) > 0:
found = True
return found
@register.simple_tag
def isUserInRep(task, area, user):
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
def isUserInRep(task, area, user_id):
user = User.objects.get(pk=user_id)
#st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area)
st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area, representative__in=[user])
found = False
for st in st_auth:
if user in st.representative.all():
found = True
print("REP FOUND")
break
if len(st_auth) > 0:
found = True
return found