本文整理匯總了Python中pritunl.organization.Organization.get_user方法的典型用法代碼示例。如果您正苦於以下問題:Python Organization.get_user方法的具體用法?Python Organization.get_user怎麽用?Python Organization.get_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pritunl.organization.Organization
的用法示例。
在下文中一共展示了Organization.get_user方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: user_put
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def user_put(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
name = flask.request.json['name']
name = ''.join(x for x in name if x.isalnum() or x in NAME_SAFE_CHARS)
user.rename(name)
return utils.jsonify({})
示例2: _get_key_inline
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def _get_key_inline(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
archive = user.build_key_inline()
response = flask.Response(response=archive, mimetype='application/octet-stream' )
response.headers.add('Content-Disposition', 'inline; filename="%s.ovpn"' % user.name)
return response
示例3: user_delete
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def user_delete(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
user_id = user.id
user.remove()
for server in org.get_servers():
server_clients = server.get_clients()
if user_id in server_clients:
server.restart()
return utils.jsonify({})
示例4: _get_key_archive
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def _get_key_archive(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
archive_temp_path = user.build_key_archive()
with open(archive_temp_path, "r") as archive_file:
response = flask.Response(response=archive_file.read(), mimetype="application/x-tar")
response.headers.add("Content-Disposition", 'inline; filename="%s.tar"' % user.name)
os.remove(archive_temp_path)
return response
示例5: user_delete
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def user_delete(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
user.remove()
return utils.jsonify({})
示例6: user_otp_secret_delete
# 需要導入模塊: from pritunl.organization import Organization [as 別名]
# 或者: from pritunl.organization.Organization import get_user [as 別名]
def user_otp_secret_delete(org_id, user_id):
org = Organization(org_id)
user = org.get_user(user_id)
user.generate_otp_secret()
return utils.jsonify({})