Commit 4da68b7f authored by Muhamad's avatar Muhamad

output permission

parent 4d5698da
...@@ -509,11 +509,15 @@ class Dashboard(generic.TemplateView): ...@@ -509,11 +509,15 @@ class Dashboard(generic.TemplateView):
'kecamatan':j[8], 'kecamatan':j[8],
} }
res_all.append(data_all) res_all.append(data_all)
perm_group = []
if request.user.is_authenticated: if request.user.is_authenticated:
current_user = request.user current_user = request.user
thisUser = current_user.id thisUser = current_user.id
for xx in request.user.get_group_permissions():
perm_group.append(xx.split(".")[1])
if thisUser == None: if thisUser == None:
user_data = {"filepath":'placeholder.jpg'} user_data = {"filepath":'placeholder.jpg'}
else: else:
...@@ -582,7 +586,7 @@ class Dashboard(generic.TemplateView): ...@@ -582,7 +586,7 @@ class Dashboard(generic.TemplateView):
auth_group ag auth_group ag
WHERE WHERE
au.id = aug.user_id AND au.id = aug.user_id AND
ag.id = aug.group_id AND ag.id = aug.group_id
ORDER BY ORDER BY
au.username ASC""" au.username ASC"""
userlist_.execute(sql) userlist_.execute(sql)
...@@ -626,6 +630,7 @@ class Dashboard(generic.TemplateView): ...@@ -626,6 +630,7 @@ class Dashboard(generic.TemplateView):
'global':all[0], 'global':all[0],
'res_all':res_all, 'res_all':res_all,
'thisUser' : user_data, 'thisUser' : user_data,
'perm_group' : perm_group
# 'user_res':user_res # 'user_res':user_res
} }
return render (request, self.template_name, context) return render (request, self.template_name, context)
......
This diff is collapsed.
This diff is collapsed.
<script>
var list_perm = []
</script>
{% for p in perm_group %}
<script>
var perm = "{{p}}"
list_perm.push(perm)
</script>
{% endfor %}
<script>
console.log(list_perm)
if (list_perm.indexOf('add_roads') >= 0 === false) {
$(".btn_create_jalan").remove();
}
if (list_perm.indexOf('add_bangunan') >= 0 === false) {
$(".btn_create_bangunan").remove();
}
if (list_perm.indexOf('add_kantor_administrasi') >= 0 === false || list_perm.indexOf('add_layanan_kesehatan') >= 0 === false || list_perm.indexOf('add_puskesmas') >= 0 === false || list_perm.indexOf('add_rumah_sakit') >= 0 === false || list_perm.indexOf('add_sarana_ibadah') >= 0 === false || list_perm.indexOf('add_sarana_pendidikan') >= 0 === false || list_perm.indexOf('add_stasiun') >= 0 === false || list_perm.indexOf('add_terminal_bus') >= 0 === false || list_perm.indexOf('add_cagar_budaya') >= 0 === false || list_perm.indexOf('add_gardu_listrik') >= 0 === false) {
$(".btn_create_point").remove();
}
if (list_perm.indexOf('add_roads') >= 0 === false && list_perm.indexOf('add_bangunan') >= 0 === false && list_perm.indexOf('add_kantor_administrasi') >= 0 === false || list_perm.indexOf('add_layanan_kesehatan') >= 0 === false || list_perm.indexOf('add_puskesmas') >= 0 === false || list_perm.indexOf('add_rumah_sakit') >= 0 === false || list_perm.indexOf('add_sarana_ibadah') >= 0 === false || list_perm.indexOf('add_sarana_pendidikan') >= 0 === false || list_perm.indexOf('add_stasiun') >= 0 === false || list_perm.indexOf('add_terminal_bus') >= 0 === false || list_perm.indexOf('add_cagar_budaya') >= 0 === false || list_perm.indexOf('add_gardu_listrik') >= 0 === false) {
$("#modal_option_create").remove();
}
alert(list_perm.indexOf('change_rumah_sakit') >= 0)
</script>
\ No newline at end of file
...@@ -49,23 +49,20 @@ ...@@ -49,23 +49,20 @@
font-family: 'gilroyultralight'; font-family: 'gilroyultralight';
src: url('/static/css/Gilroy-UltraLight.woff') format('woff'); src: url('/static/css/Gilroy-UltraLight.woff') format('woff');
} }
/* start hide fitur modal */ /* start hide fitur modal */
.tab_kdb_klb { .tab_kdb_klb {
display: none; display: none;
} }
.btn_create_lahan{ .btn_create_lahan {
display: none; display: none;
} }
.btn_cek_KDBKLB{ .btn_cek_KDBKLB {
display: none; display: none;
} }
/* end hide fitur modal */ /* end hide fitur modal */
</style> </style>
{% include 'includes/css-o.html' %} {% include 'includes/css-m.html' %} {% include 'includes/css-o.html' %} {% include 'includes/css-m.html' %}
...@@ -142,7 +139,7 @@ ...@@ -142,7 +139,7 @@
<div class="content"> <div class="content">
<div id="map"> <div id="map">
<div class="help_bangunan" style="position: absolute;z-index: 999;top: 0px;right: 60px;"></div> <div class="help_bangunan" style="position: absolute;z-index: 999;top: 0px;right: 60px;"></div>
<div class="row" style="margin-top: 20px;"> <div class="row" style="margin-top: 20px;">
<div class="col-sm-4 head"> <div class="col-sm-4 head">
...@@ -187,8 +184,8 @@ ...@@ -187,8 +184,8 @@
</div> </div>
</div> </div>
<!-- </div> --> <!-- </div> -->
<!-- <div class="row" id="searchbar" style="margin-top: 2%;"> <!-- <div class="row" id="searchbar" style="margin-top: 2%;">
<div class="col-sm-4 head"> <div class="col-sm-4 head">
...@@ -248,16 +245,16 @@ ...@@ -248,16 +245,16 @@
</button> </button>
</span> </span>
</div> --> </div> -->
<!-- </div> --> <!-- </div> -->
<!-- <div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="z-index: 999;"> <!-- <div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="z-index: 999;">
<div class="row row-full-height" style="width: 100%;margin-left: 10px;"> --> <div class="row row-full-height" style="width: 100%;margin-left: 10px;"> -->
{% if user.is_authenticated %} {% else %} {% if user.is_authenticated %} {% else %}
<div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="height: fit-content;"> <div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="height: fit-content;">
<div class="row row-full-height"> <div class="row row-full-height">
<div class="col-md-1 col-sm-12"> <div class="col-md-1 col-sm-12">
<img src="/static/img/logo-ok.png" alt="" class="img-centered" style="max-height: 28px;max-width: 21.999998092651367px;/* left: 27px; *//* top: 14px; */border-radius: 0px;"> <img src="/static/img/logo-ok.png" alt="" class="img-centered" style="max-height: 28px;max-width: 21.999998092651367px;/* left: 27px; *//* top: 14px; */border-radius: 0px;">
...@@ -273,10 +270,10 @@ ...@@ -273,10 +270,10 @@
<a href="{% url 'login' %}" class="btn btn-primary vertical-centered" id="btn-signin">SIGN IN</a> <a href="{% url 'login' %}" class="btn btn-primary vertical-centered" id="btn-signin">SIGN IN</a>
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
</div> </div>
<!-- <div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="z-index: 999;"> <!-- <div class="col-md-6 col-md-offset-3 modal-login input-group content-group foot centered" style="z-index: 999;">
<div class="row row-full-height" style="width: 100%;margin-left: 10px;"> <div class="row row-full-height" style="width: 100%;margin-left: 10px;">
<div class="col-md-1"> <div class="col-md-1">
<img src="/static/img/logo-ok.png" alt="" class="img-centered" style="max-height: 28px;max-width: 21.999998092651367px;/* left: 27px; *//* top: 14px; */border-radius: 0px;"> <img src="/static/img/logo-ok.png" alt="" class="img-centered" style="max-height: 28px;max-width: 21.999998092651367px;/* left: 27px; *//* top: 14px; */border-radius: 0px;">
...@@ -295,7 +292,7 @@ ...@@ -295,7 +292,7 @@
</div> --> </div> -->
{% if user.is_authenticated %} {% if user.is_authenticated %}
<div class="user-p-nav" style="height: 10%;width: 10%;position: absolute;top: 30px;right: 65px;z-index: 999;"> <div class="user-p-nav" style="height: 10%;width: 10%;position: absolute;top: 30px;right: 65px;z-index: 999;">
<!-- <a href="#"> <!-- <a href="#">
...@@ -440,9 +437,9 @@ ...@@ -440,9 +437,9 @@
<!-- /page content --> <!-- /page content -->
</div> </div>
{% include 'includes/modal.html' %} {% include 'includes/modal.html' %}
<div class="modal fade" id="modal-kelurahan" tabindex="-1" role="dialog"> <div class="modal fade" id="modal-kelurahan" tabindex="-1" role="dialog">
...@@ -873,8 +870,7 @@ ...@@ -873,8 +870,7 @@
</body> </body>
</html> </html>
{% include 'includes/permission.html' %} {% include 'includes/js-o.html' %} {% include 'includes/js-m.html' %}
{% include 'includes/js-o.html' %} {% include 'includes/js-m.html' %}
<script type="text/javascript" src="{% static 'js/action.js' %}"></script> <script type="text/javascript" src="{% static 'js/action.js' %}"></script>
<script> <script>
// start disabled inspect // start disabled inspect
...@@ -903,7 +899,7 @@ ...@@ -903,7 +899,7 @@
// end disabled inspect // end disabled inspect
var dar = null; var dar = null;
$('#search_spes li a').on('click', function() { $('#search_spes li a').on('click', function() {
...@@ -916,7 +912,7 @@ ...@@ -916,7 +912,7 @@
$("#pilihcari").html('<i class="icon-home4 text-muted text-size-base" style="color: #5A9AFB;"></i>') $("#pilihcari").html('<i class="icon-home4 text-muted text-size-base" style="color: #5A9AFB;"></i>')
} else if (dar == ' Jalan') { } else if (dar == ' Jalan') {
$("#pilihcari").html('<i class="icon-git-branch text-muted text-size-base" style="color: #5A9AFB;"></i>') $("#pilihcari").html('<i class="icon-git-branch text-muted text-size-base" style="color: #5A9AFB;"></i>')
}else if (dar == ' Reset') { } else if (dar == ' Reset') {
$("#pilihcari").html('') $("#pilihcari").html('')
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment