本文整理匯總了Python中pritunl.organization.Organization.get_orgs方法的典型用法代碼示例。如果您正苦於以下問題:Python Organization.get_orgs方法的具體用法?Python Organization.get_orgs怎麽用?Python Organization.get_orgs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pritunl.organization.Organization
的用法示例。
在下文中一共展示了Organization.get_orgs方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: status_get
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_orgs [as 別名]
def status_get():
orgs = Organization.get_orgs()
orgs_count = len(orgs)
servers_count = 0
servers_online_count = 0
clients_count = 0
for server in Server.get_servers():
servers_count += 1
if server.status:
servers_online_count += 1
clients_count += len(server.get_clients())
users_count = 0
for org in orgs:
for user in org.get_users():
if user.type != CERT_CLIENT:
continue
users_count += 1
if not app_server.public_ip:
app_server.load_public_ip()
return utils.jsonify({
'orgs_available': orgs_count,
'orgs_total': orgs_count,
'users_online': clients_count,
'users_total': users_count,
'servers_online': servers_online_count,
'servers_total': servers_count,
'server_version': __version__,
'public_ip': app_server.public_ip,
})
示例2: org_get
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_orgs [as 別名]
def org_get():
orgs = []
orgs_dict = {}
orgs_sort = []
for org in Organization.get_orgs():
name_id = '%s_%s' % (org.name, org.id)
orgs_sort.append(name_id)
orgs_dict[name_id] = {
'id': org.id,
'name': org.name,
}
for name_id in sorted(orgs_sort):
orgs.append(orgs_dict[name_id])
return utils.jsonify(orgs)