Example #1
0
	def __init__(self, query):
		self.query = query
		self.where = None
		self.orders = None
		self.limit = None
		self.filter = []
		self.fixedFilter = None
		self.conn = Service.getDbConn()
Example #2
0
	def authenticate(self, login, password):
		pwd = md5(str(password)).hexdigest()
		
		user = False
		conn = Service.getDbConn()
		try:
			user = {}
			cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
			cursor.execute("SELECT * FROM pim.users WHERE login = %s AND password = %s AND active = true", (login, pwd))
			
			for row in cursor.fetchall():
				user['user_id'] = row['user_id']
				user['role'] = row['role']
				
			
		finally:
			Service.putDbConn(conn)
		
		self.loggedUser = user
		return user