コード例 #1
0
ファイル: CouchDatabase.cs プロジェクト: kpisman/LoveSeat
        public SecurityDocument getSecurityConfiguration()
        {
            string request = databaseBaseUri + "/_security";

            var docResult = GetRequest(request).Get().Json().GetResponse().GetJObject();

            SecurityDocument sDoc = Newtonsoft.Json.JsonConvert.DeserializeObject <SecurityDocument>(docResult.ToString());

            return(sDoc);
        }
コード例 #2
0
ファイル: CouchDatabase.cs プロジェクト: kpisman/LoveSeat
        /// <summary>
        /// Updates security configuration for the database
        /// </summary>
        /// <param name="sDoc"></param>
        public void UpdateSecurityDocument(SecurityDocument sDoc)
        {
            string request = databaseBaseUri + "/_security";

            // serialize SecurityDocument to json
            string data = Newtonsoft.Json.JsonConvert.SerializeObject(sDoc);

            var result = GetRequest(request).Put().Json().Data(data).GetResponse();

            if (result.StatusCode != HttpStatusCode.OK) //Check if okay
            {
                throw new WebException("An error occurred while trying to update the security document. StatusDescription: " + result.StatusDescription);
            }
        }