{"action":"created","issue":{"url":"https://api.github.com/repos/Adldap2/Adldap2/issues/550","repository_url":"https://api.github.com/repos/Adldap2/Adldap2","labels_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/550/labels{/name}","comments_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/550/comments","events_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/550/events","html_url":"https://github.com/Adldap2/Adldap2/issues/550","id":332160860,"node_id":"MDU6SXNzdWUzMzIxNjA4NjA=","number":550,"title":"Calling move before saving user causes save to fail","user":{"login":"TJonesy","id":1951223,"node_id":"MDQ6VXNlcjE5NTEyMjM=","avatar_url":"https://avatars2.githubusercontent.com/u/1951223?v=4","gravatar_id":"","url":"https://api.github.com/users/TJonesy","html_url":"https://github.com/TJonesy","followers_url":"https://api.github.com/users/TJonesy/followers","following_url":"https://api.github.com/users/TJonesy/following{/other_user}","gists_url":"https://api.github.com/users/TJonesy/gists{/gist_id}","starred_url":"https://api.github.com/users/TJonesy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TJonesy/subscriptions","organizations_url":"https://api.github.com/users/TJonesy/orgs","repos_url":"https://api.github.com/users/TJonesy/repos","events_url":"https://api.github.com/users/TJonesy/events{/privacy}","received_events_url":"https://api.github.com/users/TJonesy/received_events","type":"User","site_admin":false},"labels":[{"id":547369710,"node_id":"MDU6TGFiZWw1NDczNjk3MTA=","url":"https://api.github.com/repos/Adldap2/Adldap2/labels/ActiveDirectory","name":"ActiveDirectory","color":"1d76db","default":false},{"id":259287166,"node_id":"MDU6TGFiZWwyNTkyODcxNjY=","url":"https://api.github.com/repos/Adldap2/Adldap2/labels/possible%20bug","name":"possible bug","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-13T20:55:57Z","updated_at":"2018-09-17T21:31:41Z","closed_at":null,"author_association":"NONE","body":"- Adldap2 Version: 7.0.15\r\n- LDAP Type: Active Directory\r\n- PHP Version: PHP 7.0.30-0ubuntu0.16.04.1\r\n\r\n### Description:\r\nIf move is called on a user before saving the user the save fails.\r\n\r\n### Steps To Reproduce:\r\n`$ad = new \\Adldap\\Adldap();`\r\n`$ad->addProvider($adldapconfig);`\r\n`$provider = $ad->connect();`\r\n`$user = $provider->search()->findBy('samaccountname',$samaccountname);`\r\n`$user->move(\"CN=\".$user->getCommonName(),$dn,true));`\r\n`$user->setFirstName($FirstName);`\r\n`$user->save();`\r\n\r\n\r\nThis does work but is less preferable due to the way our framework actually works\r\n`$ad = new \\Adldap\\Adldap();`\r\n`$ad->addProvider($adldapconfig);`\r\n`$provider = $ad->connect();`\r\n`$user = $provider->search()->findBy('samaccountname',$samaccountname);`\r\n`$user->setFirstName($FirstName);`\r\n`$user->save();`\r\n`$user->move(\"CN=\".$user->getCommonName(),$dn,true));`\r\n\r\nThis also works but is not preferable\r\n`$ad = new \\Adldap\\Adldap();`\r\n`$ad->addProvider($adldapconfig);`\r\n`$provider = $ad->connect();`\r\n`$user = $provider->search()->findBy('samaccountname',$samaccountname);`\r\n`$user->move(\"CN=\".$user->getCommonName(),$dn,true));`\r\n`$user = $provider->search()->findBy('samaccountname',$samaccountname);`\r\n`$user->setFirstName($FirstName);`\r\n`$user->save();`"},"comment":{"url":"https://api.github.com/repos/Adldap2/Adldap2/issues/comments/422178786","html_url":"https://github.com/Adldap2/Adldap2/issues/550#issuecomment-422178786","issue_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/550","id":422178786,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjE3ODc4Ng==","user":{"login":"stevebauman","id":6421846,"node_id":"MDQ6VXNlcjY0MjE4NDY=","avatar_url":"https://avatars3.githubusercontent.com/u/6421846?v=4","gravatar_id":"","url":"https://api.github.com/users/stevebauman","html_url":"https://github.com/stevebauman","followers_url":"https://api.github.com/users/stevebauman/followers","following_url":"https://api.github.com/users/stevebauman/following{/other_user}","gists_url":"https://api.github.com/users/stevebauman/gists{/gist_id}","starred_url":"https://api.github.com/users/stevebauman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevebauman/subscriptions","organizations_url":"https://api.github.com/users/stevebauman/orgs","repos_url":"https://api.github.com/users/stevebauman/repos","events_url":"https://api.github.com/users/stevebauman/events{/privacy}","received_events_url":"https://api.github.com/users/stevebauman/received_events","type":"User","site_admin":false},"created_at":"2018-09-17T21:31:41Z","updated_at":"2018-09-17T21:31:41Z","author_association":"MEMBER","body":"@noname007 A `syncRaw()` is already called on successfully moved users which should populate the models `distinguishedName` with its new one:\r\n\r\nhttps://github.com/Adldap2/Adldap2/blob/be07d4585a9ae55deb15c7c16d6f5e7d8928d7ae/src/Models/Model.php#L988-L1012\r\n\r\n@TJonesy Thanks, no problem. I'll start debugging this."}}
{"actor":{"display_login":"stevebauman"}}