* Get the repository password for the user␊ |
*/␊ |
function getMercurialPass($user){␊ |
␉//echo $user->password.Pluf::f('secret_key');␊ |
# return base64_encode(sha1($_POST["password"], true));␊ |
␉#file_put_contents("/tmp/test3", "test");␊ |
//return sha1($_POST["password"], true);␊ |
␉//if (isset($_POST["password"])) return $_POST["password"];␊ |
␉//return $_POST["password"];␊ |
␉//file_put_contents("/tmp/test", $user->password.Pluf::f('secret_key'));␊ |
␉//file_put_contents("/tmp/test", $user->password);␊ |
␉//return substr(sha1($user->password.Pluf::f('secret_key')), 0, 8);␊ |
␉return $user->password;␊ |
␉ return $user->password;␊ |
}␊ |
␊ |
/**␊ |
|
throw new Exception (sprintf(__('%s does not exist or is not writable.'), $passwd_file));␊ |
}␊ |
$ht = new File_Passwd_Authbasic($passwd_file);␊ |
//$ht->setMode(Pluf::f('idf_plugin_syncmercurial_passwd_mode',␊ |
// FILE_PASSWD_SHA)); ␊ |
␉$ht->setMode("plain");␊ |
␉ $ht->setMode("plain");␊ |
$ht->load();␊ |
$mem = $project->getMembershipData();␊ |
$members = array_merge((array)$mem['members'], (array)$mem['owners'], ␊ |
(array)$mem['authorized']);␊ |
foreach($members as $user) {␊ |
␉␉//file_put_contents("/tmp/test", $this->getMercurialPass($user));␊ |
if ($ht->userExists($user->login)) {␊ |
$ht->changePasswd($user->login, "{SHA}" . $this->getMercurialPass($user));␊ |
} else {␊ |
|
$notify_file = Pluf::f('idf_plugin_syncmercurial_private_notify');␊ |
$fcontent = '';␊ |
foreach (Pluf::factory('IDF_Project')->getList() as $project) {␊ |
if ($project->getConf()->getVal('scm') != "mercurial") {␊ |
continue;␊ |
}␊ |
$conf = new IDF_Conf();␊ |
$conf->setProject($project);␊ |
$hide_file = Pluf::f('idf_plugin_syncmercurial_path').sprintf('/%s/.hide', $project->shortname);␊ |