Exemple #1
0
        // TODO: Rename to AddGlobalUser(string username, string password)
        public void AddUserToAllRepositories(string username, string password)
        {
            User newuser = new User(username, password);

            foreach(Repository repository in this.Repositories())
            {
                repository.AddUser(newuser);
            }
        }
Exemple #2
0
        public void AddUser(User user)
        {
            string userdb = Path.Combine(this.SVNRoot, this.Name, "conf", "passwd");
            string tmpdb = userdb + ".tmp";

            List<string> newconf = new List<string>();
            using (var input = new StreamReader(userdb))
            {
                using (var output = new StreamWriter(tmpdb))
                {
                    string line = input.ReadLine();
                    while (line != null)
                    {
                        output.WriteLine(line);

                        if (line.StartsWith("[users]"))
                            output.WriteLine(string.Format("{0} = {1}", user.Name, user.Password));

                        line = input.ReadLine();
                    }
                }
            }

            File.Delete(userdb);
            File.Copy(tmpdb, userdb);
            File.Delete(tmpdb);
        }