Example #1
0
        public void CreateAdminUser(string aUserName, string aPassword)
        {
            if (String.IsNullOrEmpty(aUserName))
                throw new ArgumentException("aUserName cannot be null nor empty");
            if (String.IsNullOrEmpty(aPassword))
                throw new ArgumentException("aPassword cannot be null nor empty");

            SetConfigValue("admins", aUserName, aPassword, new Result()).Wait();
            BasePlug.WithCredentials(aUserName, aPassword);// Logon(username, password, new Result<bool>()).Wait();
            CouchUser user = new CouchUser {Name = aUserName};

            ObjectSerializer<CouchUser> serializer = new ObjectSerializer<CouchUser>();
            BasePlug.At("_users", HttpUtility.UrlEncode("org.couchdb.user:" + aUserName)).Put(DreamMessage.Ok(MimeType.JSON, serializer.Serialize(user)), new Result<DreamMessage>()).Wait();
        }
Example #2
0
        public void CreateAdminUser(string aUserName, string aPassword)
        {
            if (String.IsNullOrEmpty(aUserName))
            {
                throw new ArgumentException("aUserName cannot be null nor empty");
            }
            if (String.IsNullOrEmpty(aPassword))
            {
                throw new ArgumentException("aPassword cannot be null nor empty");
            }

            SetConfigValue("admins", aUserName, aPassword, new Result()).Wait();
            BasePlug.WithCredentials(aUserName, aPassword);            // Logon(username, password, new Result<bool>()).Wait();
            CouchUser user = new CouchUser {
                Name = aUserName
            };

            ObjectSerializer <CouchUser> serializer = new ObjectSerializer <CouchUser>();

            BasePlug.At("_users", HttpUtility.UrlEncode("org.couchdb.user:" + aUserName)).Put(DreamMessage.Ok(MimeType.JSON, serializer.Serialize(user)), new Result <DreamMessage>()).Wait();
        }