{"action":"created","comment":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/28000227","id":28000227,"diff_hunk":"@@ -524,59 +646,72 @@ def self.add_user(user_id, permissions, repo_name)\n     def self.set_bulk_permissions(repo_names, user_id_permissions_map)\n       # Check if configuration is in order\n       if Repository.conf[:IS_REPOSITORY_ADMIN].nil?\n-        raise ConfigurationError.new(\"Required config 'IS_REPOSITORY_ADMIN' not set\")\n+        raise ConfigurationError.new(\n+          \"Required config 'IS_REPOSITORY_ADMIN' not set\")\n       end\n       # If we're not in authoritative mode, bail out\n       if !Repository.conf[:IS_REPOSITORY_ADMIN] # Are we admin?\n-        raise NotAuthorityError.new(\"Unable to set bulk permissions:  Not in authoritative mode!\");\n+        raise NotAuthorityError.new(\n+          'Unable to set bulk permissions: Not in authoritative mode!')\n       end\n \n-      # Check if gitolite admin repo exists, create it if not\n-      if !Gitolite::GitoliteAdmin.is_gitolite_admin_repo?(Repository.conf[:REPOSITORY_STORAGE])\n-        Gitolite::GitoliteAdmin.bootstrap(Repository.conf[:REPOSITORY_STORAGE])\n-      end\n+      ga_repo = Gitolite::GitoliteAdmin.new(\n+        Repository.conf[:REPOSITORY_STORAGE] +\n+          '/gitolite-admin', GITOLITE_SETTINGS)\n \n-      #gitolite admin repo\n-      ga_repo = Gitolite::GitoliteAdmin.new(Repository.conf[:REPOSITORY_STORAGE])\n+      # Sync admin repo\n+      ga_repo.update\n+\n+      # The admin repo is loaded into memory\n       conf = ga_repo.config\n \n       repo_names.each do |repo_name|\n         repo_name = File.basename(repo_name)\n         repo = ga_repo.config.get_repo(repo_name)\n         if repo.nil?\n+          # Generate new repo conf since this repo hasn't been created yet\n           repo = Gitolite::Config::Repo.new(repo_name)\n         end\n+        # Add the permissions for each user\n         user_id_permissions_map.each do |user_id, permissions|\n           perm_string = __translate_to_git_perms(permissions)\n           repo.add_permission(perm_string, \"\", user_id)\n+          repo.add_permission(perm_string, \"\", \"git\") # testing\n         end\n         conf.add_repo(repo)\n       end\n \n-      #update gitolite\n+      # Readd the 'git' public key to the gitolite admin repo after changes\n+      self.class.readd_admin_key\n+\n+      # update Gitolite repo\n       ga_repo.save_and_apply\n     end\n \n     def self.delete_bulk_permissions(repo_names, user_ids)\n-      # Deletes permissions over several repositories. Use remove_user to remove\n-      # permissions of a single repository.\n+      # Deletes permissions over several repositories. Use remove_user to\n+      # remove permissions of a single repository.\n       # There is no user remove support from gitolite ruby library\n       # Work-around:\n       # - copy permissions from repo\n       # - remove repo from config and save and apply\n       # - add again permissions not removed\n \n-      #if @repos_admin # Are we admin?\n-      # Adds a user with given permissions to the repository\n-      ga_repo = Gitolite::GitoliteAdmin.new(Repository.conf[:REPOSITORY_PERMISSION_FILE])\n+      if @repos_admin # Are we admin?\n+        # Adds a user with given permissions to the repository\n+        ga_repo = Gitolite::GitoliteAdmin.new(\n+          Repository.conf[:REPOSITORY_PERMISSION_FILE])\n \n-      repo_names.each do |repo_name|\n-        repo_name = File.basename(repo_name)\n-        repo = ga_repo.config.get_repo(repo_name)\n-        rw_list = []\n-        r_list  = []\n-        found = false\n-        if !repo.nil?\n+        # Sync gitolite admin repo\n+        ga_repo.update\n+\n+        repo_names.each do |repo_name|\n+          repo_name = File.basename(repo_name)\n+          repo = ga_repo.config.get_repo(repo_name)\n+          rw_list = []\n+          r_list  = []","path":"lib/repo/git_repository.rb","position":465,"original_position":465,"commit_id":"17736139285c750a1d5b7a972cabbb7faec57e13","original_commit_id":"17736139285c750a1d5b7a972cabbb7faec57e13","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Unnecessary spacing detected.","created_at":"2015-04-08T18:43:11Z","updated_at":"2015-04-08T18:43:11Z","html_url":"https://github.com/MarkUsProject/Markus/pull/2121#discussion_r28000227","pull_request_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121","_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments/28000227"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/2121#discussion_r28000227"},"pull_request":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121"}}},"pull_request":{"url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121","id":32724487,"html_url":"https://github.com/MarkUsProject/Markus/pull/2121","diff_url":"https://github.com/MarkUsProject/Markus/pull/2121.diff","patch_url":"https://github.com/MarkUsProject/Markus/pull/2121.patch","issue_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/2121","number":2121,"state":"open","locked":false,"title":"Gitolite Backend & Key Pair Upload Functionality Added","user":{"login":"SoftwareDev","id":5432316,"avatar_url":"https://avatars.githubusercontent.com/u/5432316?v=3","gravatar_id":"","url":"https://api.github.com/users/SoftwareDev","html_url":"https://github.com/SoftwareDev","followers_url":"https://api.github.com/users/SoftwareDev/followers","following_url":"https://api.github.com/users/SoftwareDev/following{/other_user}","gists_url":"https://api.github.com/users/SoftwareDev/gists{/gist_id}","starred_url":"https://api.github.com/users/SoftwareDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoftwareDev/subscriptions","organizations_url":"https://api.github.com/users/SoftwareDev/orgs","repos_url":"https://api.github.com/users/SoftwareDev/repos","events_url":"https://api.github.com/users/SoftwareDev/events{/privacy}","received_events_url":"https://api.github.com/users/SoftwareDev/received_events","type":"User","site_admin":false},"body":"Here are the changes to the git branch which integrate MarkUs with the fine-grained access controller and repository hoster which is Gitolite.\r\n\r\nNotable changes:\r\n- A \"Key Pairs\" page has been added which allows all users of MarkUs to upload and manage their public keys which allow SSH authentication with the git repositories and Gitolite.\r\n- Repository creation is now handled by the Gitolite server and no longer by native MarkUs code itself. (MarkUs now clones the repos which are created by Gitolite calls and maintains compatibility with the SVN branch)\r\n- Some additional constants have been added to the environment setup files.\r\n\r\n-------------------------------------------------------------------------------------------------------------\r\nAdditional Gitolite Setup and Instruction material will be added to the Wiki pages soon.\r\n\r\nI plan to do some more visual updates to the Key Pairs pages over this upcoming month.","created_at":"2015-04-07T00:37:11Z","updated_at":"2015-04-08T18:43:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fd212963f5a6740b71c7fb5373d7fdd9a68ec7eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121/commits","review_comments_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121/comments","review_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/2121/comments","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/17736139285c750a1d5b7a972cabbb7faec57e13","head":{"label":"SoftwareDev:gitolite-rugged","ref":"gitolite-rugged","sha":"17736139285c750a1d5b7a972cabbb7faec57e13","user":{"login":"SoftwareDev","id":5432316,"avatar_url":"https://avatars.githubusercontent.com/u/5432316?v=3","gravatar_id":"","url":"https://api.github.com/users/SoftwareDev","html_url":"https://github.com/SoftwareDev","followers_url":"https://api.github.com/users/SoftwareDev/followers","following_url":"https://api.github.com/users/SoftwareDev/following{/other_user}","gists_url":"https://api.github.com/users/SoftwareDev/gists{/gist_id}","starred_url":"https://api.github.com/users/SoftwareDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoftwareDev/subscriptions","organizations_url":"https://api.github.com/users/SoftwareDev/orgs","repos_url":"https://api.github.com/users/SoftwareDev/repos","events_url":"https://api.github.com/users/SoftwareDev/events{/privacy}","received_events_url":"https://api.github.com/users/SoftwareDev/received_events","type":"User","site_admin":false},"repo":{"id":24034862,"name":"Markus","full_name":"SoftwareDev/Markus","owner":{"login":"SoftwareDev","id":5432316,"avatar_url":"https://avatars.githubusercontent.com/u/5432316?v=3","gravatar_id":"","url":"https://api.github.com/users/SoftwareDev","html_url":"https://github.com/SoftwareDev","followers_url":"https://api.github.com/users/SoftwareDev/followers","following_url":"https://api.github.com/users/SoftwareDev/following{/other_user}","gists_url":"https://api.github.com/users/SoftwareDev/gists{/gist_id}","starred_url":"https://api.github.com/users/SoftwareDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SoftwareDev/subscriptions","organizations_url":"https://api.github.com/users/SoftwareDev/orgs","repos_url":"https://api.github.com/users/SoftwareDev/repos","events_url":"https://api.github.com/users/SoftwareDev/events{/privacy}","received_events_url":"https://api.github.com/users/SoftwareDev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SoftwareDev/Markus","description":"Git repository of MarkUs","fork":true,"url":"https://api.github.com/repos/SoftwareDev/Markus","forks_url":"https://api.github.com/repos/SoftwareDev/Markus/forks","keys_url":"https://api.github.com/repos/SoftwareDev/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SoftwareDev/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SoftwareDev/Markus/teams","hooks_url":"https://api.github.com/repos/SoftwareDev/Markus/hooks","issue_events_url":"https://api.github.com/repos/SoftwareDev/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/SoftwareDev/Markus/events","assignees_url":"https://api.github.com/repos/SoftwareDev/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/SoftwareDev/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/SoftwareDev/Markus/tags","blobs_url":"https://api.github.com/repos/SoftwareDev/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SoftwareDev/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SoftwareDev/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/SoftwareDev/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SoftwareDev/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/SoftwareDev/Markus/languages","stargazers_url":"https://api.github.com/repos/SoftwareDev/Markus/stargazers","contributors_url":"https://api.github.com/repos/SoftwareDev/Markus/contributors","subscribers_url":"https://api.github.com/repos/SoftwareDev/Markus/subscribers","subscription_url":"https://api.github.com/repos/SoftwareDev/Markus/subscription","commits_url":"https://api.github.com/repos/SoftwareDev/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/SoftwareDev/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/SoftwareDev/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/SoftwareDev/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/SoftwareDev/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/SoftwareDev/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SoftwareDev/Markus/merges","archive_url":"https://api.github.com/repos/SoftwareDev/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SoftwareDev/Markus/downloads","issues_url":"https://api.github.com/repos/SoftwareDev/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/SoftwareDev/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/SoftwareDev/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/SoftwareDev/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SoftwareDev/Markus/labels{/name}","releases_url":"https://api.github.com/repos/SoftwareDev/Markus/releases{/id}","created_at":"2014-09-14T22:18:29Z","updated_at":"2015-02-12T05:26:34Z","pushed_at":"2015-04-08T18:43:00Z","git_url":"git://github.com/SoftwareDev/Markus.git","ssh_url":"git@github.com:SoftwareDev/Markus.git","clone_url":"https://github.com/SoftwareDev/Markus.git","svn_url":"https://github.com/SoftwareDev/Markus","homepage":"http://www.markusproject.org","size":20717,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MarkUsProject:git","ref":"git","sha":"664fd5c98d026d680f1571c9a30ae3602b22ab0a","user":{"login":"MarkUsProject","id":415874,"avatar_url":"https://avatars.githubusercontent.com/u/415874?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"repo":{"id":940538,"name":"Markus","full_name":"MarkUsProject/Markus","owner":{"login":"MarkUsProject","id":415874,"avatar_url":"https://avatars.githubusercontent.com/u/415874?v=3","gravatar_id":"","url":"https://api.github.com/users/MarkUsProject","html_url":"https://github.com/MarkUsProject","followers_url":"https://api.github.com/users/MarkUsProject/followers","following_url":"https://api.github.com/users/MarkUsProject/following{/other_user}","gists_url":"https://api.github.com/users/MarkUsProject/gists{/gist_id}","starred_url":"https://api.github.com/users/MarkUsProject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarkUsProject/subscriptions","organizations_url":"https://api.github.com/users/MarkUsProject/orgs","repos_url":"https://api.github.com/users/MarkUsProject/repos","events_url":"https://api.github.com/users/MarkUsProject/events{/privacy}","received_events_url":"https://api.github.com/users/MarkUsProject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MarkUsProject/Markus","description":"Git repository of MarkUs","fork":false,"url":"https://api.github.com/repos/MarkUsProject/Markus","forks_url":"https://api.github.com/repos/MarkUsProject/Markus/forks","keys_url":"https://api.github.com/repos/MarkUsProject/Markus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MarkUsProject/Markus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MarkUsProject/Markus/teams","hooks_url":"https://api.github.com/repos/MarkUsProject/Markus/hooks","issue_events_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/events{/number}","events_url":"https://api.github.com/repos/MarkUsProject/Markus/events","assignees_url":"https://api.github.com/repos/MarkUsProject/Markus/assignees{/user}","branches_url":"https://api.github.com/repos/MarkUsProject/Markus/branches{/branch}","tags_url":"https://api.github.com/repos/MarkUsProject/Markus/tags","blobs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MarkUsProject/Markus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MarkUsProject/Markus/git/refs{/sha}","trees_url":"https://api.github.com/repos/MarkUsProject/Markus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MarkUsProject/Markus/statuses/{sha}","languages_url":"https://api.github.com/repos/MarkUsProject/Markus/languages","stargazers_url":"https://api.github.com/repos/MarkUsProject/Markus/stargazers","contributors_url":"https://api.github.com/repos/MarkUsProject/Markus/contributors","subscribers_url":"https://api.github.com/repos/MarkUsProject/Markus/subscribers","subscription_url":"https://api.github.com/repos/MarkUsProject/Markus/subscription","commits_url":"https://api.github.com/repos/MarkUsProject/Markus/commits{/sha}","git_commits_url":"https://api.github.com/repos/MarkUsProject/Markus/git/commits{/sha}","comments_url":"https://api.github.com/repos/MarkUsProject/Markus/comments{/number}","issue_comment_url":"https://api.github.com/repos/MarkUsProject/Markus/issues/comments{/number}","contents_url":"https://api.github.com/repos/MarkUsProject/Markus/contents/{+path}","compare_url":"https://api.github.com/repos/MarkUsProject/Markus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MarkUsProject/Markus/merges","archive_url":"https://api.github.com/repos/MarkUsProject/Markus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MarkUsProject/Markus/downloads","issues_url":"https://api.github.com/repos/MarkUsProject/Markus/issues{/number}","pulls_url":"https://api.github.com/repos/MarkUsProject/Markus/pulls{/number}","milestones_url":"https://api.github.com/repos/MarkUsProject/Markus/milestones{/number}","notifications_url":"https://api.github.com/repos/MarkUsProject/Markus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MarkUsProject/Markus/labels{/name}","releases_url":"https://api.github.com/repos/MarkUsProject/Markus/releases{/id}","created_at":"2010-09-26T16:18:08Z","updated_at":"2015-04-06T00:56:36Z","pushed_at":"2015-04-08T18:43:01Z","git_url":"git://github.com/MarkUsProject/Markus.git","ssh_url":"git@github.com:MarkUsProject/Markus.git","clone_url":"https://github.com/MarkUsProject/Markus.git","svn_url":"https://github.com/MarkUsProject/Markus","homepage":"http://www.markusproject.org","size":47620,"stargazers_count":123,"watchers_count":123,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":150,"mirror_url":null,"open_issues_count":105,"forks":150,"open_issues":105,"watchers":123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121"},"html":{"href":"https://github.com/MarkUsProject/Markus/pull/2121"},"issue":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/2121"},"comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/issues/2121/comments"},"review_comments":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121/comments"},"review_comment":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MarkUsProject/Markus/pulls/2121/commits"},"statuses":{"href":"https://api.github.com/repos/MarkUsProject/Markus/statuses/17736139285c750a1d5b7a972cabbb7faec57e13"}}}}