Commit 490a1b0a authored by Prajkta Patkar's avatar Prajkta Patkar Committed by Nitesh Laxman Chaughule
Browse files

Specified userrole by numbers in database

parent 0c106d03
...@@ -206,7 +206,17 @@ class api_user(object): ...@@ -206,7 +206,17 @@ class api_user(object):
result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userid,gkdb.users.c.userrole]).where(gkdb.users.c.orgcode==authDetails["orgcode"]).order_by(gkdb.users.c.username)) result = self.con.execute(select([gkdb.users.c.username,gkdb.users.c.userid,gkdb.users.c.userrole]).where(gkdb.users.c.orgcode==authDetails["orgcode"]).order_by(gkdb.users.c.username))
users = [] users = []
for row in result: for row in result:
users.append({"userid":row["userid"], "username":row["username"], "userrole":row["userrole"]}) if(row["userrole"] == -1):
userroleName = "Admin"
elif(row["userrole"] == 0):
userroleName = "Manager"
elif(row["userrole"] == 1):
userroleName = "Operator"
elif(row["userrole"] == 2):
userroleName = "Internal Auditor"
elif(row["userrole"] == 3):
userroleName = "Godown In Charge"
users.append({"userid":row["userid"], "username":row["username"], "userrole":row["userrole"],"userrolename": userroleName})
return {"gkstatus": gkcore.enumdict["Success"], "gkresult":users } return {"gkstatus": gkcore.enumdict["Success"], "gkresult":users }
except: except:
return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } return {"gkstatus":gkcore.enumdict["ConnectionFailed"] }
...@@ -428,7 +438,6 @@ class api_user(object): ...@@ -428,7 +438,6 @@ class api_user(object):
userData["userroleName"] = "Internal Auditor" userData["userroleName"] = "Internal Auditor"
elif(row["userrole"] == 3): elif(row["userrole"] == 3):
userData["userroleName"] = "Godown In Charge" userData["userroleName"] = "Godown In Charge"
return {"gkstatus": gkcore.enumdict["Success"], "gkresult":userData } return {"gkstatus": gkcore.enumdict["Success"], "gkresult":userData }
except: except:
return {"gkstatus":gkcore.enumdict["ConnectionFailed"] } return {"gkstatus":gkcore.enumdict["ConnectionFailed"] }
......
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