本文整理汇总了Python中membase.api.rest_client.RestConnection.create_ro_user方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.create_ro_user方法的具体用法?Python RestConnection.create_ro_user怎么用?Python RestConnection.create_ro_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类membase.api.rest_client.RestConnection
的用法示例。
在下文中一共展示了RestConnection.create_ro_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cluster_admin_security_write
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def cluster_admin_security_write(self,username,password,host,port=8091, servers=None,cluster=None,httpCode=None,user_role=None):
_cluster_admin_security_write = {
"change_pass":"/settings/readOnlyUser;PUT",
"create_readonly":"/settings/readOnlyUser;POST",
"delete_readonly":"settings/readOnlyUser;DELETE",
"saslauthd":"/settings/saslauthdAuth;POST",
"audit":"settings/audit;POST",
#"validateCredentails":"validateCredentials;POST",
"regenerateCert":"controller/regenerateCertificate;POST"
}
rest = RestConnection(host)
rest.create_ro_user('ritam1','password')
_cluster_admin_security_write = {"change_pass":"/settings/readOnlyUser;PUT;{'password':'passowrd123'}"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
_cluster_admin_security_write = {"create_readonly":"/settings/readOnlyUser;POST;{'username':'ritam1123','password':'passowrd123'}"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
_cluster_admin_security_write = {"delete_readonly":"settings/readOnlyUser;DELETE"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
_cluster_admin_security_write = {"saslauthd":"/settings/saslauthdAuth;POST;{'enabled':'true','admins':[],'roAdmins':[]}"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
_cluster_admin_security_write = {"audit":"settings/audit;POST;{'auditdEnabled':'true'}"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
#_cluster_admin_security_write = {"validateCredentails":"validateCredentials;POST;{'user':'foo','password':'bar'}"}
#result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
_cluster_admin_security_write = {"regenerateCert":"controller/regenerateCertificate;POST"}
result = self._return_http_code(_cluster_admin_security_write,username,password,host=host,port=port, httpCode=httpCode, user_role=user_role)
示例2: cluster_admin_security_read
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def cluster_admin_security_read(self,username,password,host,port=8091, servers=None,cluster=None,httpCode=None,user_role=None):
rest = RestConnection(host)
rest.create_ro_user('ritam1234','password')
_cluster_admin_security_read ={
"readOnlyAdmin":"/settings/readOnlyAdminName;GET",
"saslauth":"settings/saslauthdAuth;GET",
"audit":"/settings/audit;GET"
}
result = self._return_http_code(_cluster_admin_security_read,username,password,host=host,port=8091, httpCode=httpCode, user_role=user_role)
示例3: create_user_test_bucket_check
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def create_user_test_bucket_check(self):
rest = RestConnection(self.master)
rest.create_ro_user(username=self.username, password=self.password)
self.master.rest_username = self.username
self.master.rest_password = self.password
rest = RestConnection(self.master)
self.log.info("Try to edit bucket")
try:
rest.create_bucket(bucket='bucket0', ramQuotaMB=100,
authType='sasl', saslPassword='sasl')
except BucketCreationException, e:
self.log.info("Unable to create the bucket. Expected")
示例4: test_loginEvents
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def test_loginEvents(self):
ops = self.input.param("ops", None)
role = self.input.param("role", None)
username = self.input.param('username', None)
password = self.input.param('password', None)
source = 'ns_server'
rest = RestConnection(self.master)
user = self.master.rest_username
roles = []
roles.append(role)
if (ops in ['loginRoAdmin', 'deleteuser', 'passwordChange']):
rest.create_ro_user(username, password)
if (ops in ['loginAdmin', 'loginRoAdmin']):
status, content = rest.validateLogin(username, password, True, getContent=True)
sessionID = (((status['set-cookie']).split("="))[1]).split(";")[0]
expectedResults = {'source':source, 'user':username, 'password':password, 'roles':roles, 'ip':self.ipAddress, "port":123456, 'sessionid':sessionID}
elif (ops in ['deleteuser']):
expectedResults = {"role":role, "real_userid:source":source, 'real_userid:user':user,
'ip':self.ipAddress, "port":123456, 'userid':username,'identity:source':'ro_admin','identity:user':'roAdmins'}
rest.delete_ro_user()
elif (ops in ['passwordChange']):
expectedResults = {'real_userid:source':source, 'real_userid:user':user,
'password':password, 'role':role, 'ip':self.ipAddress, "port":123456,
'userid':username,'identity:source':'ro_admin','identity:user':'roAdmins'}
rest.changePass_ro_user(username, password)
elif (ops in ['invalidlogin']):
status, content = rest.validateLogin(username, password, True, getContent=True)
expectedResults = {'real_userid':username, 'password':password,
'ip':self.ipAddress, "port":123456,'source': 'rejected','user':username}
#User must be pre-created in LDAP in advance
elif (ops in ['ldapLogin']):
rest = RestConnection(self.master)
self.set_user_role(rest,username)
status, content = rest.validateLogin(username, password, True, getContent=True)
sessionID = (((status['set-cookie']).split("="))[1]).split(";")[0]
expectedResults = {'source':'external', 'user':username, 'password':password, 'roles':roles, 'ip':self.ipAddress, "port":123456, 'sessionid':sessionID}
self.checkConfig(self.eventID, self.master, expectedResults)
示例5: create_user_test_ddoc_check
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def create_user_test_ddoc_check(self):
rest = RestConnection(self.master)
ddoc = DesignDocument("ddoc_ro_0", [View("ro_view",
"function (doc) {\n emit(doc._id, doc);\n}",
dev_view=False)])
rest.create_design_document(self.buckets[0], ddoc)
rest.create_ro_user(username=self.username, password=self.password)
self.master.rest_username = self.username
self.master.rest_password = self.password
rest = RestConnection(self.master)
self.log.info("Try to delete ddoc")
self.buckets[0].authType = ""
try:
rest.delete_view(self.buckets[0], ddoc.views[0])
except Exception, ex:
self.log.info("Unable to delete ddoc. Expected")
self.buckets[0].authType = "sasl"
示例6: negative_create_user_test
# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import create_ro_user [as 别名]
def negative_create_user_test(self):
self.log.info("try to create user %s, pass %s" % (self.username, self.password))
rest = RestConnection(self.master)
self.assertFalse(rest.create_ro_user(username=self.username, password=self.password),
"No error appeared")
self.log.info("Error appears as expected")