本文整理汇总了Python中SOAPpy.SOAPProxy.set_cloud_admin_status方法的典型用法代码示例。如果您正苦于以下问题:Python SOAPProxy.set_cloud_admin_status方法的具体用法?Python SOAPProxy.set_cloud_admin_status怎么用?Python SOAPProxy.set_cloud_admin_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SOAPpy.SOAPProxy
的用法示例。
在下文中一共展示了SOAPProxy.set_cloud_admin_status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: UAClient
# 需要导入模块: from SOAPpy import SOAPProxy [as 别名]
# 或者: from SOAPpy.SOAPProxy import set_cloud_admin_status [as 别名]
#.........这里部分代码省略.........
def delete_user(self, email):
""" Deletes a user.
Args:
email: A string specifying the user's email address.
Raises:
UAException if the deletion was not successful.
"""
response = self.server.delete_user(email, self.secret)
if response.lower() != 'true':
raise UAException(response)
def disable_user(self, email):
""" Disables a user.
Args:
email: A string specifying the user's email address.
Raises:
UAException if the operation was not successful.
"""
response = self.server.disable_user(email, self.secret)
if response.lower() != 'true':
raise UAException(response)
def does_user_exist(self, email):
""" Checks if a user exists.
Args:
email: A string specifying an email address.
Returns:
A boolean indicating whether or not the user exists.
Raises:
UAException when unable to determine if user exist.
"""
response = self.server.does_user_exist(email, self.secret)
if response.lower() not in ['true', 'false']:
raise UAException(response)
return response.lower() == 'true'
def get_all_users(self):
""" Retrieves a list of all users.
Returns:
A list of string containing user email addresses.
Raises:
UAException if unable to retrieve list of users.
"""
response = self.server.get_all_users(self.secret)
if response.startswith('Error'):
raise UAException(response)
# Strip opening prefix that the UAServer adds.
if response.startswith('____'):
response = response[4:]
return response.split(':')
def get_user_data(self, email):
""" Retrieves user metadata.
Args:
email: A string specifying an email address.
Returns:
A string containing user metadata.
"""
return self.server.get_user_data(email, self.secret)
def is_user_cloud_admin(self, email):
""" Checks if a user has cloud admin privliges.
Args:
email: A string specifying an email address.
Returns:
A boolean indicating whether or not the user has admin privileges.
Raises:
UAException when unable to determine the status.
"""
response = self.server.is_user_cloud_admin(email, self.secret)
if response.lower() not in ['true', 'false']:
raise UAException(response)
return response.lower() == 'true'
def set_cloud_admin_status(self, email, is_admin):
""" Grants or revokes cloud admin privileges.
Args:
email: A string specifying an email address.
is_admin: A boolean specifying if the user should be admin or not.
Raises:
UAException if the operation was not successful.
"""
response = self.server.set_cloud_admin_status(email, str(is_admin).lower(),
self.secret)
if response.lower() != 'true':
raise UAException(response)