Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gnukhata
gkcore
Commits
ac561e24
Commit
ac561e24
authored
Dec 19, 2017
by
Nitesh Laxman Chaughule
Browse files
if condition check old user userrole and if it is godownkeeper then delete it.
parent
cfa5a085
Changes
1
Hide whitespace changes
Inline
Side-by-side
gkcore/views/api_user.py
View file @
ac561e24
...
...
@@ -252,7 +252,7 @@ class api_user(object):
self
.
con
.
close
()
"""
This
function update user in the users table.
Following
function update user in the users table.
It may also have a list of goids for the godowns associated with this user.
This is only true if goflag is True.
The frontend must send the role as Godown In Charge for this.
...
...
@@ -271,13 +271,15 @@ class api_user(object):
self
.
con
=
eng
.
connect
()
userRole
=
getUserRole
(
authDetails
[
"userid"
])
dataset
=
self
.
request
.
json_body
print
dataset
if
userRole
[
"gkresult"
][
"userrole"
]
==
-
1
:
dataset
[
"orgcode"
]
=
authDetails
[
"orgcode"
]
if
int
(
dataset
[
"userrole"
])
==
3
:
#This is give userrole of old user
originalrole
=
getuserrole
(
dataset
[
userid
])
if
int
(
originalrole
==
3
):
result
=
self
.
con
.
execute
(
gkdb
.
usergodown
.
delete
().
where
(
gkdb
.
usergodown
.
c
.
userid
==
dataset
[
"userid"
]))
#this is give userrole of new user
if
int
(
dataset
[
"userrole"
])
==
3
:
golist
=
tuple
(
dataset
.
pop
(
"golist"
))
print
golist
result
=
self
.
con
.
execute
(
gkdb
.
users
.
update
().
where
(
gkdb
.
users
.
c
.
userid
==
dataset
[
"userid"
]).
values
(
dataset
))
lastid
=
dataset
[
"userid"
]
for
goid
in
golist
:
...
...
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