<p></p>
<h3 dir="auto">URL</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">How to reproduce the issue?</h3>
<p dir="auto">Hey openstreetmap-website's developers, I am trying to change the status of a user using the <code>Managing Users</code> section</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/master/CONFIGURE.md#managing-users">https://github.com/openstreetmap/openstreetmap-website/blob/master/CONFIGURE.md#managing-users</a></p>
<p dir="auto">It is useful when we don't want to send confirmation emails to users and manually enable users to edit on the map.</p>
<p dir="auto">The issue is that we can not change the status of the user manually , it throws the error <g-emoji class="g-emoji" alias="point_right" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f449.png">๐</g-emoji> <code>AASM::NoDirectAssignmentError (direct assignment of AASM column has been disabled (see AASM configuration for this class))</code></p>
<div class="highlight highlight-source-shell"><pre>irb(main):011:<span class="pl-k">0></span> user = User.find_by(:display_name =<span class="pl-k">></span> <span class="pl-s"><span class="pl-pds">"</span>devseed<span class="pl-pds">"</span></span>)
irb(main):012:<span class="pl-k">0></span>
irb(main):013:<span class="pl-k">0></span> user.status = <span class="pl-s"><span class="pl-pds">"</span>active<span class="pl-pds">"</span></span>
Traceback (most recent call last):
1: from (irb):12
AASM::NoDirectAssignmentError (direct assignment of AASM column has been disabled (see AASM configuration <span class="pl-k">for</span> this class))
irb(main):014:<span class="pl-k">0></span>
irb(main):015:<span class="pl-k">0></span> user.save<span class="pl-k">!</span>
</pre></div>
<p dir="auto">Currently the only way to make user active is with email confirmation.</p>
<p dir="auto">So, I solution that I found is editing the line: <a href="https://github.com/openstreetmap/openstreetmap-website/blob/319e54e08a9803c2218ec126bce4ed6eb9965127/app/models/user.rb#L162">https://github.com/openstreetmap/openstreetmap-website/blob/319e54e08a9803c2218ec126bce4ed6eb9965127/app/models/user.rb#L162</a> and changing the <code>no_direct_assignment</code> value from <code>true</code> to <code>false</code> <g-emoji class="g-emoji" alias="point_down" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f447.png">๐</g-emoji></p>
<p dir="auto"><code>aasm :column => :status, :no_direct_assignment => true do</code> -----> <code>aasm :column => :status, :no_direct_assignment => false do</code></p>
<p dir="auto">updating that line, the userโs status changed successfully.</p>
<div class="highlight highlight-source-shell"><pre>irb(main):002:<span class="pl-k">0></span> user = User.find_by(:display_name =<span class="pl-k">></span> <span class="pl-s"><span class="pl-pds">"</span>devseed<span class="pl-pds">"</span></span>)
irb(main):003:<span class="pl-k">0></span> user.status = <span class="pl-s"><span class="pl-pds">"</span>active<span class="pl-pds">"</span></span>
irb(main):004:<span class="pl-k">0></span> user.save<span class="pl-k">!</span>
=<span class="pl-k">></span> <span class="pl-c1">true</span>
irb(main):005:<span class="pl-k">0></span> user
=<span class="pl-k">></span> <span class="pl-c"><span class="pl-c">#</span><User email: "rub2106@gmail.com", id: 2, pass_crypt: "..", creation_time: "2022-02-15 23:01:26.478201000 +0000", display_name: "devseed", data_public: true, description: "", home_lat: nil, home_lon: nil, home_zoom: 3, pass_salt: nil, email_valid: false, new_email: nil, creation_ip: "10.112.0.1", languages: "en-US,en,es", status: "active", terms_agreed: "2022-02-15 23:01:26.171538000 +0000", consider_pd: false, auth_uid: nil, preferred_editor: nil, terms_seen: true, description_format: "markdown", changesets_count: 0, traces_count: 0, diary_entries_count: 0, image_use_gravatar: false, auth_provider: nil, home_tile: nil, tou_agreed: "2022-02-15 23:01:26.171573000 +0000"></span></pre></div>
<p dir="auto">Can this line be updated in core code?</p>
<p dir="auto">cc. <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/users/batpad/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/batpad">@batpad</a></p>
<h3 dir="auto">Screenshot(s) or anything else?</h3>
<p dir="auto"><em>No response</em></p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/3460">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLJCBY3BTFTSKZZUULTU3LS5PANCNFSM5OQBQL4Q">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLIZ5XBXZGFRL4SZ3ITU3LS5PA5CNFSM5OQBQL42YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4Q7I6DPA.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/3460</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/3460",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3460",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>