{"action":"created","comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/38739433","id":38739433,"diff_hunk":"@@ -0,0 +1,91 @@\n+# coding: UTF-8\n+\n+require_dependency 'google_plus_api'\n+\n+module CartoDB\n+  class UserAccountCreator\n+\n+    PARAM_USERNAME = :username\n+    PARAM_EMAIL = :email\n+    PARAM_PASSWORD = :password\n+\n+    def initialize\n+      @built = false\n+      @organization = nil\n+      @google_user_data = nil\n+      @user = ::User.new\n+      @user_params = {}\n+      @custom_errors = {}\n+    end\n+\n+    def with_param(key, value)\n+      @user_params[key] = value\n+    end\n+\n+    def with_organization(organization)\n+      @organization = organization\n+      @user = ::User.new_with_organization(organization)\n+      self\n+    end\n+\n+    def user\n+      @user\n+    end\n+\n+    def with_google_token(google_access_token)\n+      # get_user_data can return nil\n+      @google_user_data = GooglePlusAPI.new.get_user_data(google_access_token)\n+      self\n+    end\n+\n+    def valid?\n+      build\n+\n+      if @organization && @organization.owner.nil? && !promote_to_organization_owner?\n+        @custom_errors[:organization] = [\"owner is not set. In order to activate this organization the administrator must login first\"]\n+      end\n+\n+      @user.valid? && @user.validate_credentials_not_taken_in_central && @custom_errors.keys.length == 0\n+    end\n+\n+    def validation_errors\n+      @user.errors.merge!(@custom_errors)\n+    end\n+\n+    def enqueue_creation(current_controller)","path":"lib/user_account_creator.rb","position":55,"original_position":55,"commit_id":"b44de978ccb02ee61052cf1f42e2bff9e039a57f","original_commit_id":"b44de978ccb02ee61052cf1f42e2bff9e039a57f","user":{"login":"Kartones","id":2085449,"avatar_url":"https://avatars.githubusercontent.com/u/2085449?v=3","gravatar_id":"","url":"https://api.github.com/users/Kartones","html_url":"https://github.com/Kartones","followers_url":"https://api.github.com/users/Kartones/followers","following_url":"https://api.github.com/users/Kartones/following{/other_user}","gists_url":"https://api.github.com/users/Kartones/gists{/gist_id}","starred_url":"https://api.github.com/users/Kartones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kartones/subscriptions","organizations_url":"https://api.github.com/users/Kartones/orgs","repos_url":"https://api.github.com/users/Kartones/repos","events_url":"https://api.github.com/users/Kartones/events{/privacy}","received_events_url":"https://api.github.com/users/Kartones/received_events","type":"User","site_admin":false},"body":"yep :(","created_at":"2015-09-04T10:31:54Z","updated_at":"2015-09-04T10:31:54Z","html_url":"https://github.com/CartoDB/cartodb/pull/4777#discussion_r38739433","pull_request_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777","_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments/38739433"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/4777#discussion_r38739433"},"pull_request":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777"}}},"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777","id":41143053,"html_url":"https://github.com/CartoDB/cartodb/pull/4777","diff_url":"https://github.com/CartoDB/cartodb/pull/4777.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/4777.patch","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4777","number":4777,"state":"open","locked":false,"title":"4759 LDAP authentication","user":{"login":"juanignaciosl","id":932968,"avatar_url":"https://avatars.githubusercontent.com/u/932968?v=3","gravatar_id":"","url":"https://api.github.com/users/juanignaciosl","html_url":"https://github.com/juanignaciosl","followers_url":"https://api.github.com/users/juanignaciosl/followers","following_url":"https://api.github.com/users/juanignaciosl/following{/other_user}","gists_url":"https://api.github.com/users/juanignaciosl/gists{/gist_id}","starred_url":"https://api.github.com/users/juanignaciosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juanignaciosl/subscriptions","organizations_url":"https://api.github.com/users/juanignaciosl/orgs","repos_url":"https://api.github.com/users/juanignaciosl/repos","events_url":"https://api.github.com/users/juanignaciosl/events{/privacy}","received_events_url":"https://api.github.com/users/juanignaciosl/received_events","type":"User","site_admin":false},"body":"This closes #4759.\r\n\r\n@lbosque take a look at this, please. I still have to test SSL connection, for the moment I've mimicked Net::LDAP configuration options.\r\n\r\n@Kartones CR this, please.\r\n\r\ncc @javisantana : this is the basic LDAP wrapper for connection and search. I've also prepared authentication method because it's another connection, but it's not integrated in Carto authentication yet.","created_at":"2015-07-29T16:22:41Z","updated_at":"2015-09-04T10:31:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7dfbc8784e2510a8f1ba89fba18b52125b9e0681","assignee":{"login":"Kartones","id":2085449,"avatar_url":"https://avatars.githubusercontent.com/u/2085449?v=3","gravatar_id":"","url":"https://api.github.com/users/Kartones","html_url":"https://github.com/Kartones","followers_url":"https://api.github.com/users/Kartones/followers","following_url":"https://api.github.com/users/Kartones/following{/other_user}","gists_url":"https://api.github.com/users/Kartones/gists{/gist_id}","starred_url":"https://api.github.com/users/Kartones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kartones/subscriptions","organizations_url":"https://api.github.com/users/Kartones/orgs","repos_url":"https://api.github.com/users/Kartones/repos","events_url":"https://api.github.com/users/Kartones/events{/privacy}","received_events_url":"https://api.github.com/users/Kartones/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/CartoDB/cartodb/milestones/47","html_url":"https://github.com/CartoDB/cartodb/milestones/Torrelodones","labels_url":"https://api.github.com/repos/CartoDB/cartodb/milestones/47/labels","id":1258206,"number":47,"title":"Torrelodones","description":"- [ ] TIS (@luisico)\r\n- [ ] Groups (@juanignaciosl)\r\n- [ ] LDAP (@kartones & @antonio)\r\n- [ ] Test optimization (@jesusvazquez)\r\n- [ ] Explore Pages (@javier)\r\n- [ ] New public profile page (@javier)\r\n- [ ] Ogr2ogr new version (@rtorre)\r\n- [ ] Data Services Revamp - WIP (@iriberri)\r\n- [ ] Ruby 2.2 (@kartones)\r\n- [ ] Advanced Map creation on Import (@rtorre)\r\n- [ ] Explore API v1.1 (@ethervoid)\r\n- [ ] New embed WIP (@pabloalonso)\r\n- [ ] Wizards refactor (@pabloalonso)","creator":{"login":"saleiva","id":132149,"avatar_url":"https://avatars.githubusercontent.com/u/132149?v=3","gravatar_id":"","url":"https://api.github.com/users/saleiva","html_url":"https://github.com/saleiva","followers_url":"https://api.github.com/users/saleiva/followers","following_url":"https://api.github.com/users/saleiva/following{/other_user}","gists_url":"https://api.github.com/users/saleiva/gists{/gist_id}","starred_url":"https://api.github.com/users/saleiva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saleiva/subscriptions","organizations_url":"https://api.github.com/users/saleiva/orgs","repos_url":"https://api.github.com/users/saleiva/repos","events_url":"https://api.github.com/users/saleiva/events{/privacy}","received_events_url":"https://api.github.com/users/saleiva/received_events","type":"User","site_admin":false},"open_issues":135,"closed_issues":4,"state":"open","created_at":"2015-08-17T13:11:56Z","updated_at":"2015-09-04T10:25:21Z","due_on":"2015-09-15T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777/commits","review_comments_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777/comments","review_comment_url":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4777/comments","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/b44de978ccb02ee61052cf1f42e2bff9e039a57f","head":{"label":"CartoDB:4759-LDAP_configuration","ref":"4759-LDAP_configuration","sha":"b44de978ccb02ee61052cf1f42e2bff9e039a57f","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","created_at":"2012-07-05T15:23:45Z","updated_at":"2015-09-03T15:25:44Z","pushed_at":"2015-09-04T10:25:25Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":505551,"stargazers_count":913,"watchers_count":913,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":213,"mirror_url":null,"open_issues_count":828,"forks":213,"open_issues":828,"watchers":913,"default_branch":"master"}},"base":{"label":"CartoDB:master","ref":"master","sha":"639ffab7aa29154b4c02f624cb32a0fa765bf2f6","user":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"repo":{"id":4909355,"name":"cartodb","full_name":"CartoDB/cartodb","owner":{"login":"CartoDB","id":1799254,"avatar_url":"https://avatars.githubusercontent.com/u/1799254?v=3","gravatar_id":"","url":"https://api.github.com/users/CartoDB","html_url":"https://github.com/CartoDB","followers_url":"https://api.github.com/users/CartoDB/followers","following_url":"https://api.github.com/users/CartoDB/following{/other_user}","gists_url":"https://api.github.com/users/CartoDB/gists{/gist_id}","starred_url":"https://api.github.com/users/CartoDB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CartoDB/subscriptions","organizations_url":"https://api.github.com/users/CartoDB/orgs","repos_url":"https://api.github.com/users/CartoDB/repos","events_url":"https://api.github.com/users/CartoDB/events{/privacy}","received_events_url":"https://api.github.com/users/CartoDB/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CartoDB/cartodb","description":"Location Intelligence & Data Visualization tool","fork":false,"url":"https://api.github.com/repos/CartoDB/cartodb","forks_url":"https://api.github.com/repos/CartoDB/cartodb/forks","keys_url":"https://api.github.com/repos/CartoDB/cartodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CartoDB/cartodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CartoDB/cartodb/teams","hooks_url":"https://api.github.com/repos/CartoDB/cartodb/hooks","issue_events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/events{/number}","events_url":"https://api.github.com/repos/CartoDB/cartodb/events","assignees_url":"https://api.github.com/repos/CartoDB/cartodb/assignees{/user}","branches_url":"https://api.github.com/repos/CartoDB/cartodb/branches{/branch}","tags_url":"https://api.github.com/repos/CartoDB/cartodb/tags","blobs_url":"https://api.github.com/repos/CartoDB/cartodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CartoDB/cartodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CartoDB/cartodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/CartoDB/cartodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CartoDB/cartodb/statuses/{sha}","languages_url":"https://api.github.com/repos/CartoDB/cartodb/languages","stargazers_url":"https://api.github.com/repos/CartoDB/cartodb/stargazers","contributors_url":"https://api.github.com/repos/CartoDB/cartodb/contributors","subscribers_url":"https://api.github.com/repos/CartoDB/cartodb/subscribers","subscription_url":"https://api.github.com/repos/CartoDB/cartodb/subscription","commits_url":"https://api.github.com/repos/CartoDB/cartodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/CartoDB/cartodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/CartoDB/cartodb/contents/{+path}","compare_url":"https://api.github.com/repos/CartoDB/cartodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CartoDB/cartodb/merges","archive_url":"https://api.github.com/repos/CartoDB/cartodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CartoDB/cartodb/downloads","issues_url":"https://api.github.com/repos/CartoDB/cartodb/issues{/number}","pulls_url":"https://api.github.com/repos/CartoDB/cartodb/pulls{/number}","milestones_url":"https://api.github.com/repos/CartoDB/cartodb/milestones{/number}","notifications_url":"https://api.github.com/repos/CartoDB/cartodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CartoDB/cartodb/labels{/name}","releases_url":"https://api.github.com/repos/CartoDB/cartodb/releases{/id}","created_at":"2012-07-05T15:23:45Z","updated_at":"2015-09-03T15:25:44Z","pushed_at":"2015-09-04T10:25:25Z","git_url":"git://github.com/CartoDB/cartodb.git","ssh_url":"git@github.com:CartoDB/cartodb.git","clone_url":"https://github.com/CartoDB/cartodb.git","svn_url":"https://github.com/CartoDB/cartodb","homepage":"http://cartodb.com","size":505551,"stargazers_count":913,"watchers_count":913,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":213,"mirror_url":null,"open_issues_count":828,"forks":213,"open_issues":828,"watchers":913,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777"},"html":{"href":"https://github.com/CartoDB/cartodb/pull/4777"},"issue":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/4777"},"comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/issues/4777/comments"},"review_comments":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777/comments"},"review_comment":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CartoDB/cartodb/pulls/4777/commits"},"statuses":{"href":"https://api.github.com/repos/CartoDB/cartodb/statuses/b44de978ccb02ee61052cf1f42e2bff9e039a57f"}}}}