本文整理汇总了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)