public CreateUser ( string usernameToCreate, string passwordToCreate ) : LoveSeat.CouchResponseObject | ||
usernameToCreate | string | |
passwordToCreate | string | |
return | LoveSeat.CouchResponseObject |
public ActionResult New(string projectName) { var client = new CouchClient("dannylane.iriscouch.com", 6984, "dannylane", "adminpass", true, AuthenticationType.Cookie); var userresult = client.CreateUser(projectName, projectName); //var newUid = userresult.Value<string>("id"); var u = client.GetUser(projectName); u["roles"] = new JArray(projectName + "reader_"); var udb = client.GetDatabase("_users"); udb.SaveDocument(u); var res = client.CreateDatabase(projectName); var db = client.GetDatabase(projectName); var security = db.getSecurityConfiguration(); security.readers.roles.Add(projectName + "reader_"); db.UpdateSecurityDocument(security); var readerClient = new CouchClient("localhost", 5984, projectName, projectName, false, AuthenticationType.Cookie); // var result = CouchBase.GetSession("localhost:5984", projectName, projectName); Response.Cookies.Add(new HttpCookie("auth", readerClient.GetSession().Value)); return View(); }