def register_login(class_, username, session, request): user = db.query(AdminUser).filter(AdminUser.username==username).first() if user: now = datetime.now() user.last_login = now user.session_id = session.id user.remote_addr = request.environ["HTTP_REMOTE_EU"] db.commit() db.flush() db.remove()
def register_login(class_, username, session, request): user = db.query(AdminUser).filter( AdminUser.username == username).first() if user: now = datetime.now() user.last_login = now user.session_id = session.id user.remote_addr = request.environ["HTTP_REMOTE_EU"] db.commit() db.flush() db.remove()
def get_email_account(self): email = db.query(EmailAccount).filter(EmailAccount.user_id==self.id).first() if email: return email
def get_customer_name(class_, customer_id): customer = db.query(Customer).filter(Customer.id==customer_id).first() if customer: return customer.name
def get_groups(self): return db.query(Group.name).join(UserGroup).filter(UserGroup.user_id==self.id).all()
def get_context(self): co = db.query(Customer).filter(Customer.id==self.customer_id).first() return co.context
def has_call_center(self): co = db.query(Customer).filter(Customer.id==self.customer_id).first() return co.has_call_center
def get_gateway(self): gw = db.query(PbxContext.gateway).join(Customer).join(User).filter( User.customer_id == Customer.id).first() return 0 if not gw else gw[0]
def get_gateways(self): return Session.query(PbxGateway).filter_by(pbx_profile_id=self.id)
def get_email_account(self): email = db.query(EmailAccount).filter( EmailAccount.user_id == self.id).first() if email: return email
def get_customer_name(class_, customer_id): customer = db.query(Customer).filter( Customer.id == customer_id).first() if customer: return customer.name
def get_groups(self): return db.query(Group.name).join(UserGroup).filter( UserGroup.user_id == self.id).all()
def get_context(self): co = db.query(Customer).filter(Customer.id == self.customer_id).first() return co.context
def has_call_center(self): co = db.query(Customer).filter(Customer.id == self.customer_id).first() return co.has_call_center
def by_domain(self, domain=None): return Session.query(PbxContext).filter_by(domain=domain).first()
def index(self, category): return db.query(Help)
def get_gateway(self): gw = db.query(PbxContext.gateway).join(Customer).join(User).filter(User.customer_id==Customer.id).first() return 0 if not gw else gw[0]