Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OKU-GIS
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhamad
OKU-GIS
Commits
9e1c7e61
Commit
9e1c7e61
authored
Dec 15, 2021
by
Manggar Mahardhika
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.khansia.co.id/Nahrowi/oku-gis
parents
3ab7754e
b7af101d
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
56 deletions
+81
-56
Application/views.py
Application/views.py
+1
-1
myauth/views.py
myauth/views.py
+11
-2
static/js/action.js
static/js/action.js
+24
-8
templates/includes/modal.html
templates/includes/modal.html
+45
-45
No files found.
Application/views.py
View file @
9e1c7e61
from
django.http
import
response
from
API.views
import
jalan
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
,
Permission
from
django.shortcuts
import
render
,
redirect
# from django.views.generic import ListView, DetailView, DeleteView, UpdateView, CreateView
from
django.views
import
View
,
generic
...
...
myauth/views.py
View file @
9e1c7e61
...
...
@@ -491,6 +491,8 @@ def loadGroupById(iduser):
# print(resGroup)
return
resGroup
import
json
from
django.contrib.auth.models
import
Permission
@
api_view
((
'POST'
,))
def
addGroup
(
request
):
...
...
@@ -498,7 +500,8 @@ def addGroup(request):
name
=
request
.
POST
.
get
(
'name'
)
idgroup
=
request
.
POST
.
get
(
'id'
)
parent
=
request
.
POST
.
get
(
'parent'
)
print
(
parent
)
all_perm
=
request
.
POST
.
get
(
'all_perm'
)
all_perm
=
json
.
loads
(
all_perm
)
if
parent
!=
''
:
for
s
in
Group
.
objects
.
all
():
...
...
@@ -561,6 +564,12 @@ def addGroup(request):
cursor
.
execute
(
"INSERT INTO auth_group(name, have_parent) VALUES ('"
+
name
+
"', "
+
str
(
userGroup
)
+
")"
)
result
=
cursor
.
rowcount
group
=
Group
.
objects
.
get
(
name
=
name
)
for
i
in
all_perm
:
permiss
=
Permission
.
objects
.
get
(
codename
=
i
)
group
.
permissions
.
add
(
permiss
)
if
result
>
0
:
data
=
{
"code"
:
0
,
...
...
static/js/action.js
View file @
9e1c7e61
...
...
@@ -836,7 +836,7 @@ function loadgroupbyid(id) {
$
(
"
#ingroup
"
).
val
(
grup
.
name
);
var
gays
=
[]
gays
.
push
(
grup
.
parent
)
if
(
grup
.
parent
==
null
){
if
(
grup
.
parent
==
null
)
{
loadparent
()
}
else
{
loadparent
(
gays
)
...
...
@@ -958,6 +958,7 @@ function gas_k_adm_perm() {
document
.
getElementById
(
"
delete_k_adm_perm
"
).
checked
=
false
;
}
}
function
gas_rs_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
rs_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -971,6 +972,7 @@ function gas_rs_perm() {
document
.
getElementById
(
"
delete_rs_perm
"
).
checked
=
false
;
}
}
function
gas_puskes_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
puskes_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -984,6 +986,7 @@ function gas_puskes_perm() {
document
.
getElementById
(
"
delete_puskes_perm
"
).
checked
=
false
;
}
}
function
gas_lakes_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
lakes_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -997,6 +1000,7 @@ function gas_lakes_perm() {
document
.
getElementById
(
"
delete_lakes_perm
"
).
checked
=
false
;
}
}
function
gas_si_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
si_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1010,6 +1014,7 @@ function gas_si_perm() {
document
.
getElementById
(
"
delete_si_perm
"
).
checked
=
false
;
}
}
function
gas_skul_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
skul_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1023,6 +1028,7 @@ function gas_skul_perm() {
document
.
getElementById
(
"
delete_skul_perm
"
).
checked
=
false
;
}
}
function
gas_st_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
st_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1036,6 +1042,7 @@ function gas_st_perm() {
document
.
getElementById
(
"
delete_st_perm
"
).
checked
=
false
;
}
}
function
gas_term_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
term_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1049,6 +1056,7 @@ function gas_term_perm() {
document
.
getElementById
(
"
delete_term_perm
"
).
checked
=
false
;
}
}
function
gas_cb_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
cb_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1062,6 +1070,7 @@ function gas_cb_perm() {
document
.
getElementById
(
"
delete_cb_perm
"
).
checked
=
false
;
}
}
function
gas_gl_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
gl_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1132,6 +1141,7 @@ function gas_teritori_perm() {
document
.
getElementById
(
"
edit_kecamatan_perm
"
).
checked
=
false
;
}
}
function
gas_kelurahan_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
kelurahan_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1140,6 +1150,7 @@ function gas_kelurahan_perm() {
document
.
getElementById
(
"
edit_kelurahan_perm
"
).
checked
=
false
;
}
}
function
gas_kecamatan_perm
()
{
var
checkBox
=
document
.
getElementById
(
"
kecamatan_perm
"
);
if
(
checkBox
.
checked
==
true
)
{
...
...
@@ -1422,6 +1433,10 @@ $("#saveuser").on("click", function() {
})
$
(
"
#savegroup
"
).
on
(
"
click
"
,
function
()
{
var
all_perm
=
[]
$
.
each
(
$
(
"
input[name='chekbox']:checked
"
),
function
()
{
all_perm
.
push
(
$
(
this
).
val
())
});
var
isObject
=
{};
var
ars
=
''
var
idgroup
=
$
(
"
#idgroup
"
).
val
();
...
...
@@ -1433,6 +1448,7 @@ $("#savegroup").on("click", function() {
isObject
[
'
name
'
]
=
$
(
"
#ingroup
"
).
val
();
isObject
[
'
parent
'
]
=
$
(
"
#select_parent
"
).
val
();
isObject
[
'
all_perm
'
]
=
JSON
.
stringify
(
all_perm
)
isObject
.
group
=
group
console
.
log
(
group
)
...
...
templates/includes/modal.html
View file @
9e1c7e61
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment