Best way of combining Django template tags and javascript compression for security -
i programming website uses django server backend.
the website allows users different levels of privilege log in. according privilege each user has, should able see different elements of html , javascript of webpage (ie: administrators can see full website, managers can see less elements, normal users less, etc). easiest way feed every user same website , send them variable telling browser parts of site show , hide don't solution since savvy user "hack" variable , have access information shouldn't have.
so, in order keep website easy mantain having single version keep bit of security between different levels of privilege, use django template tags:
{% if administator %}
...
{ % endif %}
this works fine html. if want same javascript, unable automatically compress javascript using yuglify or similar libraries since aren't able process django template tags in middle of javascript file... addmitedly manually see tags suppossed go , add them after compression, since javascript reasonably big , have quite few tags become unmaintainable in long run.
i have seen several django addons django-pipeline allow "auto-compression before deployment" nice don't work when put django templates in scripts either.
is there way combine django "if template tags" automatic javascript compression?
Comments
Post a Comment