Sindbad~EG File Manager

Current Path : /home/numerotech/imagepoll.numerotech.com/common_imagepoll_v1/core/library/
Upload File :
Current File : //home/numerotech/imagepoll.numerotech.com/common_imagepoll_v1/core/library/auth.py

from core import app
from flask import session
from core.model.ImagePollModel import ImagePollModel

class Auth:

	def check(society_id):
		if session.get('login_'+str(society_id),None):
			return True
		else:
			return False
	
	def open_status(society_id):
		return True

	def logout(society_id):
		session.pop('login_'+str(society_id), None)
		return True		

	def login(society_id,data1):
		session['login_'+str(society_id)] = data1 
		return session.get('login_'+str(society_id),None)

	def getlogin(society_id):
		# print(session.get('login_'+str(conf_id),None))
		return session.get('login_'+str(society_id),None)


	def getSession(session_id,session_key):
		if session.get('session',None):
			return session.get('session',None)
		else:
			conf = ImagePollModel().GetImagePolldata(session_id,session_key)
			session['session'] = session
			return session.get('session',None)


	def getSociety(society_id,society_key):
		society = session.get('society_'+str(society_id),None)
		# print(society)
		if society:
			if society['society_id'] == int(society_id) and  society['society_key'] == society_key :
				return session.get('society_'+str(society_id),None) # if conf session and match conf id then return data.
		#if conf is none or not match conf id then called bellow code 
		else:
			# print(society_id)
			# print(society_key)
			society = ImagePollModel().getSocietyImagePolldata(society_id,society_key)
			session['society_'+str(society_id)] = society
			return session.get('society_'+str(society_id),None)	
	
	def checkSession(session_id,session_key):
		session_data = session.get('session',None)
		if session_data:
			if session_data['session_id'] == session_id and  session_data['session_key'] == session_key :
				return session.get('session',None) # if conf session and match conf id then return data.

		session_data = ImagePollModel().GetSessionImagePoll(session_id,session_key)
		print(session_data)
		session['session'] = session_data
		return session.get('session',None)
	
	def success(success):
		session['success'] = success
		return session.get('success',None)	

	def getsucess():
		if session.get('success',None):
			return True
		else:
			return False

	def get_user(society_id):
		return session.get('login_'+str(society_id),None)


	def Img_id(img_poll_ids):
		# print("auth>>>>",img_poll_ids)
		session["img_id"]=img_poll_ids
		# print("img_id>>>>",session.get('img_id',None))
		return session.get('img_id',None)

	def get_img_id():
		# print("get_img_id",session.get('img_id',None))
		return session.get('img_id',None)

	def checkImgId():
		if session.get('img_id',None):
			return True
		else:
			return False

	def img_poll_key_value(img_poll_data):
		session["key_value"]=img_poll_data
		# print("Authentication>>>",session.get('key_value',None))
		return session.get('key_value',None)

	def get_key_value_of_img_poll():
		return session.get('key_value',None)


	# def logout(society_id):
	# 	session.pop('login_'+str(society_id), None)
	# 	return True
	
	# def bocheck(society_id):
	# 	user = session.get('bo_login_'+str(society_id),None)
	# 	if user:
	# 		return True
	# 	else:
	# 		return False		

	# def bologin(loginbodata,society_id):
	# 	session['bo_login_'+str(society_id)] = loginbodata 
	# 	return session.get('bo_login_'+str(society_id),None)

	# # def bouser():
	# # 	return session.get('login',None)



	# def bologout(society_id):
	# 	session.pop('bo_login_'+str(society_id), None)
	# 	return True

	
app.jinja_env.globals.update(Auth=Auth)	

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists