{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/28094026","id":28094026,"diff_hunk":"@@ -189,24 +189,21 @@\n       end\n \n       describe \"when given a set of groups to which to add the user\" do\n+        let(:existing_groups) { ['group2','group3'] }\n+        let(:group_sids) { existing_groups.each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i])} }\n+\n         let(:groups_to_set) { 'group1,group2' }\n+        let(:desired_sids) { groups_to_set.split(',').each_with_index.map{|n,i| stub(:Name => n, :objectSID => [i-1])} }\n \n         before(:each) do\n-          Puppet::Util::Windows::SID.stubs(:octet_string_to_sid_object).returns(sid)\n-          user.expects(:groups).returns ['group2', 'group3']\n+          user.expects(:group_sids).returns(group_sids.map {|s| s.objectSID})\n+          Puppet::Util::Windows::ADSI::User.expects(:name_sid_hash).returns(Hash[ desired_sids.map { |s| [s.objectSID.to_s, s.objectSID] }])\n         end\n \n         describe \"if membership is specified as inclusive\" do\n           it \"should add the user to those groups, and remove it from groups not in the list\" do\n-            group1 = stub 'group1'\n-            group1.expects(:Add).with(\"WinNT://testcomputername/#{username},user\")\n-\n-            group3 = stub 'group1'\n-            group3.expects(:Remove).with(\"WinNT://testcomputername/#{username},user\")\n-\n-            Puppet::Util::Windows::ADSI.expects(:sid_uri).with(sid).returns(\"WinNT://testcomputername/#{username},user\").twice\n-            Puppet::Util::Windows::ADSI.expects(:connect).with('WinNT://./group1,group').returns group1\n-            Puppet::Util::Windows::ADSI.expects(:connect).with('WinNT://./group3,group').returns group3\n+            user.expects(:add_group_sids).with([-1])\n+            user.expects(:remove_group_sids).with([1])","path":"spec/unit/util/windows/adsi_spec.rb","position":29,"original_position":29,"commit_id":"f0e0489a8e3dbd13c48ab5cf6ed7d69f6767f7a0","original_commit_id":"f0e0489a8e3dbd13c48ab5cf6ed7d69f6767f7a0","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"body":"I really simplified this. Instead of trying to work through each of the calls (I had about 20 expects going) and try to get the right combination, I switched over to this.","created_at":"2015-04-09T19:24:50Z","updated_at":"2015-04-09T19:24:50Z","html_url":"https://github.com/puppetlabs/puppet/pull/3788#discussion_r28094026","pull_request_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments/28094026"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/3788#discussion_r28094026"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788","id":32712737,"html_url":"https://github.com/puppetlabs/puppet/pull/3788","diff_url":"https://github.com/puppetlabs/puppet/pull/3788.diff","patch_url":"https://github.com/puppetlabs/puppet/pull/3788.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3788","number":3788,"state":"open","locked":false,"title":"[DO NOT MERGE](PUP-4373) Windows User resource - groups property should use SID instead of names","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"body":"Use SIDS when comparing user resource groups. Implement similar behavior as\r\nGroup members when comparing whether the groups a user is in are in\r\nsync with current. Without this change casing and names must match\r\nexactly and can produce erroneous results.\r\n\r\nWith this change, the comparison will be by SIDs so it will allow for\r\nthe following when a user is a member of Administrators and Users\r\ngroups:\r\n\r\n```puppet\r\nuser { 'tim':\r\n  ensure => present,\r\n  groups => ['BUILTIN\\Administrators','users'],\r\n}\r\n```","created_at":"2015-04-06T21:20:48Z","updated_at":"2015-04-09T19:24:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"89685246bc613a269745beeff9c4e631b37e9aef","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/issues/3788/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/f0e0489a8e3dbd13c48ab5cf6ed7d69f6767f7a0","head":{"label":"ferventcoder:ticket/master/PUP-4373-user-group-sids","ref":"ticket/master/PUP-4373-user-group-sids","sha":"f0e0489a8e3dbd13c48ab5cf6ed7d69f6767f7a0","user":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"repo":{"id":10981679,"name":"puppet","full_name":"ferventcoder/puppet","owner":{"login":"ferventcoder","id":63502,"avatar_url":"https://avatars.githubusercontent.com/u/63502?v=3","gravatar_id":"","url":"https://api.github.com/users/ferventcoder","html_url":"https://github.com/ferventcoder","followers_url":"https://api.github.com/users/ferventcoder/followers","following_url":"https://api.github.com/users/ferventcoder/following{/other_user}","gists_url":"https://api.github.com/users/ferventcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ferventcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferventcoder/subscriptions","organizations_url":"https://api.github.com/users/ferventcoder/orgs","repos_url":"https://api.github.com/users/ferventcoder/repos","events_url":"https://api.github.com/users/ferventcoder/events{/privacy}","received_events_url":"https://api.github.com/users/ferventcoder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ferventcoder/puppet","description":"Server automation framework and application","fork":true,"url":"https://api.github.com/repos/ferventcoder/puppet","forks_url":"https://api.github.com/repos/ferventcoder/puppet/forks","keys_url":"https://api.github.com/repos/ferventcoder/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ferventcoder/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ferventcoder/puppet/teams","hooks_url":"https://api.github.com/repos/ferventcoder/puppet/hooks","issue_events_url":"https://api.github.com/repos/ferventcoder/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/ferventcoder/puppet/events","assignees_url":"https://api.github.com/repos/ferventcoder/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/ferventcoder/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/ferventcoder/puppet/tags","blobs_url":"https://api.github.com/repos/ferventcoder/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ferventcoder/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ferventcoder/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/ferventcoder/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ferventcoder/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/ferventcoder/puppet/languages","stargazers_url":"https://api.github.com/repos/ferventcoder/puppet/stargazers","contributors_url":"https://api.github.com/repos/ferventcoder/puppet/contributors","subscribers_url":"https://api.github.com/repos/ferventcoder/puppet/subscribers","subscription_url":"https://api.github.com/repos/ferventcoder/puppet/subscription","commits_url":"https://api.github.com/repos/ferventcoder/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/ferventcoder/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/ferventcoder/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/ferventcoder/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/ferventcoder/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/ferventcoder/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ferventcoder/puppet/merges","archive_url":"https://api.github.com/repos/ferventcoder/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ferventcoder/puppet/downloads","issues_url":"https://api.github.com/repos/ferventcoder/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/ferventcoder/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/ferventcoder/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/ferventcoder/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ferventcoder/puppet/labels{/name}","releases_url":"https://api.github.com/repos/ferventcoder/puppet/releases{/id}","created_at":"2013-06-26T23:11:03Z","updated_at":"2015-04-06T18:33:14Z","pushed_at":"2015-04-09T19:15:10Z","git_url":"git://github.com/ferventcoder/puppet.git","ssh_url":"git@github.com:ferventcoder/puppet.git","clone_url":"https://github.com/ferventcoder/puppet.git","svn_url":"https://github.com/ferventcoder/puppet","homepage":"http://www.puppetlabs.com/puppet/introduction/","size":48701,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"puppetlabs:master","ref":"master","sha":"d2fdb63ad03513451c7fb4eabc1fd967a5cecd2e","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":910744,"name":"puppet","full_name":"puppetlabs/puppet","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/puppet","description":"Server automation framework and application","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppet","forks_url":"https://api.github.com/repos/puppetlabs/puppet/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppet/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppet/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppet/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppet/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppet/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppet/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppet/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppet/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppet/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppet/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppet/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppet/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/puppet/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppet/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppet/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppet/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppet/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppet/releases{/id}","created_at":"2010-09-14T19:26:44Z","updated_at":"2015-04-09T05:36:54Z","pushed_at":"2015-04-09T19:15:17Z","git_url":"git://github.com/puppetlabs/puppet.git","ssh_url":"git@github.com:puppetlabs/puppet.git","clone_url":"https://github.com/puppetlabs/puppet.git","svn_url":"https://github.com/puppetlabs/puppet","homepage":"http://www.puppetlabs.com/puppet/introduction/","size":111793,"stargazers_count":3154,"watchers_count":3154,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1332,"mirror_url":null,"open_issues_count":32,"forks":1332,"open_issues":32,"watchers":3154,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788"},"html":{"href":"https://github.com/puppetlabs/puppet/pull/3788"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/3788"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/issues/3788/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppet/pulls/3788/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppet/statuses/f0e0489a8e3dbd13c48ab5cf6ed7d69f6767f7a0"}}}}