https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292017-03-08T20:02:26ZRedmineRedmine - Defect #25289: Adding a principal to 2 projects with member inheritance leads to an errorhttps://www.redmine.org/issues/25289?journal_id=771822017-03-08T20:02:26ZFelix Schäfer
<ul><li><strong>File</strong> <a href="/attachments/17879">25289.patch</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/17879/25289.patch">25289.patch</a> added</li></ul><p>The attached patch solves this problem. No test though as this method is currently untested, we can provide tests too if required.</p>
<p>The patch saves each new <code>Member</code> directly in the loop instead of saving all in one go at the end of the loop. Please note that this does not significantly affect performance as <code>principal.members << members</code> still saves each <code>Member</code> one at a time. This allows the loop to recognise if a previous iteration already created a <code>Member</code> we are trying to instantiate and avoids the clash described above.</p>
<p>Please note that roles are added to the <code>Member</code> instead of destructively replacing already present roles. This would also allow changing the "Add project" modal of groups/users from being able to only add the group/user to projects it is not already a member of to adding the user/group with the selected role to any project in addition to already existing role/project combinations for that user/group.</p> Redmine - Defect #25289: Adding a principal to 2 projects with member inheritance leads to an errorhttps://www.redmine.org/issues/25289?journal_id=771842017-03-08T20:37:29ZJean-Philippe Langjp_lang@yahoo.fr
<ul><li><strong>Category</strong> set to <i>Administration</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li><li><strong>Assignee</strong> set to <i>Jean-Philippe Lang</i></li><li><strong>Target version</strong> set to <i>3.4.0</i></li><li><strong>Resolution</strong> set to <i>Fixed</i></li></ul><p>Patch committed, thanks for catching this issue. I've added a test for this.</p> Redmine - Defect #25289: Adding a principal to 2 projects with member inheritance leads to an errorhttps://www.redmine.org/issues/25289?journal_id=771902017-03-08T20:52:50ZFelix Schäfer
<ul></ul><p>Looks great, thanks!</p>