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
7d2550e5
Commit
7d2550e5
authored
Dec 17, 2021
by
Muhamad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit group permission
parent
588f190e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
14 deletions
+19
-14
Application/views.py
Application/views.py
+7
-2
myauth/views.py
myauth/views.py
+8
-1
static/js/action.js
static/js/action.js
+4
-3
templates/includes/modal.html
templates/includes/modal.html
+0
-8
No files found.
Application/views.py
View file @
7d2550e5
from
django.http
import
response
from
django.http
import
response
from
API.views
import
jalan
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.shortcuts
import
render
,
redirect
# from django.views.generic import ListView, DetailView, DeleteView, UpdateView, CreateView
# from django.views.generic import ListView, DetailView, DeleteView, UpdateView, CreateView
from
django.views
import
View
,
generic
from
django.views
import
View
,
generic
...
@@ -502,10 +502,14 @@ class Dashboard(generic.TemplateView):
...
@@ -502,10 +502,14 @@ class Dashboard(generic.TemplateView):
}
}
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
:
...
@@ -618,6 +622,7 @@ class Dashboard(generic.TemplateView):
...
@@ -618,6 +622,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
)
...
...
myauth/views.py
View file @
7d2550e5
...
@@ -470,10 +470,17 @@ def load_group_edit(request):
...
@@ -470,10 +470,17 @@ def load_group_edit(request):
}
}
resgroup
.
append
(
datas
)
resgroup
.
append
(
datas
)
print
(
datas
)
print
(
datas
)
group
=
Group
.
objects
.
get
(
name
=
datas
[
'name'
])
group_perm
=
[]
for
group_p
in
group
.
permissions
.
all
():
g
=
str
(
group_p
)
.
split
(
"| Can "
)[
1
]
.
replace
(
" "
,
"_"
)
group_perm
.
append
(
g
)
data
=
{
data
=
{
"info"
:
"success"
,
"info"
:
"success"
,
"code"
:
0
,
"code"
:
0
,
"data"
:
datas
,
"data"
:
datas
,
"perm_group"
:
group_perm
}
}
return
Response
(
data
)
return
Response
(
data
)
...
...
static/js/action.js
View file @
7d2550e5
...
@@ -816,6 +816,7 @@ function loadgroupbyid(id) {
...
@@ -816,6 +816,7 @@ function loadgroupbyid(id) {
isObject
.
id
=
id
;
isObject
.
id
=
id
;
$
(
"
#idgroup
"
).
val
(
id
)
$
(
"
#idgroup
"
).
val
(
id
)
$
(
"
input[name='chekbox'][name='chekbox']
"
).
attr
(
'
checked
'
,
false
)
$
.
ajax
({
$
.
ajax
({
url
:
"
/loadgroup/
"
,
url
:
"
/loadgroup/
"
,
...
@@ -831,10 +832,10 @@ function loadgroupbyid(id) {
...
@@ -831,10 +832,10 @@ function loadgroupbyid(id) {
let
response
=
data
;
let
response
=
data
;
if
(
response
.
code
==
0
)
{
if
(
response
.
code
==
0
)
{
for
(
i
in
list_perm
)
{
for
(
i
in
data
.
perm_group
)
{
console
.
log
()
$
(
"
input[name='chekbox'][value=
"
+
data
.
perm_group
[
i
]
+
"
]
"
).
prop
(
'
checked
'
,
'
checked
'
)
$
(
"
input[name='chekbox'][value=
"
+
list_perm
[
i
]
+
"
]
"
).
prop
(
'
checked
'
,
'
checked
'
)
}
}
var
grup
=
response
.
data
;
var
grup
=
response
.
data
;
$
(
"
#ingroup
"
).
val
(
grup
.
name
);
$
(
"
#ingroup
"
).
val
(
grup
.
name
);
...
...
templates/includes/modal.html
View file @
7d2550e5
...
@@ -1094,14 +1094,6 @@
...
@@ -1094,14 +1094,6 @@
<div
class=
"tab-pane"
id=
"grouproleuser"
>
<div
class=
"tab-pane"
id=
"grouproleuser"
>
<table
class=
"table table-responsive datatable-show-all table-sm list_group"
id=
"list_group"
style=
"font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;"
>
<table
class=
"table table-responsive datatable-show-all table-sm list_group"
id=
"list_group"
style=
"font-size : 8pt;padding:0px;border-top:0.5pt solid #EFEFEF;border-bottom:0.5pt solid #EFEFEF;margin-bottom: 10px;"
>
<div
style=
"position: absolute;right: 30px;font-size: 10pt;"
>
<a
class=
"btn side-bar-but"
id=
"download_perbaikan"
onclick=
"download_user_list('xlsx')"
style=
"z-index:9;"
>
<div>
<i
class=
"icon-download4"
></i><span>
Download
</span>
</div>
</a>
</div>
<div
style=
"position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;"
>
<div
style=
"position: absolute;left: 292px;font-size: 10pt;background: #2196F3;border-radius: 10px;"
>
<a
class=
"btn side-bar-but"
id=
"add_group"
style=
"z-index:9;color:white;"
>
<a
class=
"btn side-bar-but"
id=
"add_group"
style=
"z-index:9;color:white;"
>
<div>
<div>
...
...
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