def get_kcd_external_conf_object(master_config=None, path=default_master_file_path): # Get master configuration, if not provided. if not master_config: master_config = get_master_config(path=path) # Initialize object. conf = PropStore() # Fill db options. conf.db_host = master_config.kcd_db_host conf.db_port = master_config.kcd_db_port conf.db_user = master_config.kcd_db_user conf.db_passwd = master_config.kcd_db_pwd # Fill KCD options. conf.kcd_host = master_config.kcd_host conf.kcd_port = master_config.kcd_listen_port conf.kcd_passwd = master_config.kcd_pwd if conf.kcd_passwd == None or conf.kcd_passwd == '': conf.kcd_passwd = master_config.admin_pwd return conf
def get_kws_mgt_kws_info(self, kws_id): ps = PropStore() ps.kws_id = kws_id ps.org_name = "" ps.user_list = [] cur = db_session.execute(("SELECT creation_date, name FROM kcd_kws_list WHERE kws_id = %i") % (kws_id)) row = cur.fetchone() if row == None: raise ErrorMsg("Teambox %i not found" % (kws_id)) ps.creation_date = row["creation_date"] ps.name = ltu(row["name"]) cur.close() cur = db_session.execute(("SELECT file_size, file_quota FROM kcd_kws_kfs_limit WHERE kws_id = %i") % (kws_id)) row = cur.fetchone() if row == None: raise ErrorMsg("Teambox %i not found" % (kws_id)) ps.file_quota = row["file_quota"] ps.file_size = row["file_size"] cur.close() cur = db_session.execute(("SELECT user_id, email, name_admin, name_user, org_name FROM " +\ "kcd_kws_users WHERE kws_id = %i ORDER BY user_id") % (kws_id)) for row in cur.fetchall(): user = PropStore() user.user_id = row["user_id"] user.email = ltu(row["email"]) if row["name_admin"] != "": user.name = ltu(row["name_admin"]) elif row["name_user"] != "": user.name = ltu(row["name_user"]) else: user.name = "" user.org_name = ltu(row["org_name"]) ps.user_list.append(user) db_session.rollback() if len(ps.user_list): ps.org_name = ps.user_list[0].org_name return ps
def state_request_get(c, session, flags, params, version=None, req_id=0): current_version = 1 if not version: version = current_version d = PropStore() d.mode = session['mode'] d.workspace = c.workspace d.is_admin = c.is_admin d.email_id = None if 'email_id' in session: d.email_id = session['email_id'] d.perms = c.perms d.user = session['user'] ### can be null if not logged ### d.email_info = None d.identities = None if d.workspace.public and not d.is_admin: d.email_info = session['email_info'] d.identities = session['identities'] result = {} result["version"] = current_version result["req_id"] = req_id if version < current_version: # Version has changed... send no state. # Versions <1.9: will not reload but won't see any update either. # Versions >=1.9: will notice the version change and reload the page. # TODO if enough time: send bogus chat messages for <1.9? result["state"] = {} else: # Send the state. state_request_object = StateRequest(flags, params) result["state"] = state_request(d, state_request_object) return result
def state_request_get(c, session, flags, params, version=None, req_id=0): current_version = 1 if not version: version = current_version d = PropStore() d.mode = session['mode'] d.workspace = c.workspace d.is_admin = c.is_admin d.email_id = None if 'email_id' in session: d.email_id = session['email_id'] d.perms = c.perms d.user = session['user'] ### can be null if not logged ### d.email_info = None d.identities = None if d.workspace.public and not d.is_admin: d.email_info = session['email_info'] d.identities = session['identities'] result = {} result["version"] = current_version result["req_id"] = req_id if version < current_version: # Version has changed... send no state. # Versions <1.9: will not reload but won't see any update either. # Versions >=1.9: will notice the version change and reload the page. # TODO if enough time: send bogus chat messages for <1.9? result["state"] = { } else: # Send the state. state_request_object = StateRequest(flags, params) result["state"] = state_request(d, state_request_object) return result