Here is a method for LoveSeat Api which will create a database admin used for Couch DB
Copy this method to CouchClient.cs in loveseat api and it is ready to use....
make sure to create couch DB connection with admin privileges to use this method
public JObject CreateDatabaseAdminUser(string username, string database)
{
var security = @"{""admins"":{""names"":[""%name%""],""roles"":[]},""readers"":{""names"":[""%name%""],""roles"":[]}}".Replace("%name%", username).Replace("\r\n", "");
var docResult = GetRequest(baseUri + "/" + database + "/_security")
.Put().Json().Data(security).GetResponse().GetJObject();
return docResult;
}
No comments:
Post a Comment