<h2 dir="auto">[SIP-83] Proposal for copying virtual datasets</h2>
<h3 dir="auto">Motivation</h3>
<p dir="auto">There is currently no way for users to copy datasets in superset. Even though they can copy the SQL of a dataset, any changes we make to the field types (e.g. in cases where we turn long, complex types into JSON, or advanced types as described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1086937692" data-permission-text="Title is private" data-url="https://github.com/apache/superset/issues/17852" data-hovercard-type="issue" data-hovercard-url="/apache/superset/issues/17852/hovercard" href="https://github.com/apache/superset/issues/17852">#17852</a>), to column labels, etc. cannot be easily copied.</p>
<h3 dir="auto">Proposed Change</h3>
<p dir="auto">Add a duplicate action to virtual datasets within the dataset list:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/10563996/171485930-09554974-8c77-4509-a18b-c6b6f03d7473.png"><img src="https://user-images.githubusercontent.com/10563996/171485930-09554974-8c77-4509-a18b-c6b6f03d7473.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">When clicked, it will open a modal which will allow the user to choose a name for the new dataset:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/10563996/171486469-2cbe0a42-ca7c-4823-8f81-b0c605f9e805.png"><img src="https://user-images.githubusercontent.com/10563996/171486469-2cbe0a42-ca7c-4823-8f81-b0c605f9e805.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">When OK is clicked, a duplicate of the dataset is created with the chosen name.</p>
<p dir="auto">Here it is in action:</p>
<details open="" class="details-reset border rounded-2">
  <summary class="px-3 py-2">
    <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-device-camera-video">
    <path d="M16 3.75v8.5a.75.75 0 0 1-1.136.643L11 10.575v.675A1.75 1.75 0 0 1 9.25 13h-7.5A1.75 1.75 0 0 1 0 11.25v-6.5C0 3.784.784 3 1.75 3h7.5c.966 0 1.75.784 1.75 1.75v.675l3.864-2.318A.75.75 0 0 1 16 3.75Zm-6.5 1a.25.25 0 0 0-.25-.25h-7.5a.25.25 0 0 0-.25.25v6.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-6.5ZM11 8.825l3.5 2.1v-5.85l-3.5 2.1Z"></path>
</svg>
    <span aria-label="Video description 2022-06-01.15-40-22.mp4" class="m-1">2022-06-01.15-40-22.mp4</span>
    <span class="dropdown-caret"></span>
  </summary>

  <video src="https://user-images.githubusercontent.com/10563996/171488107-d5377bee-4981-464b-b2f7-446a01ac4d54.mp4" data-canonical-src="https://user-images.githubusercontent.com/10563996/171488107-d5377bee-4981-464b-b2f7-446a01ac4d54.mp4" controls="controls" muted="muted" class="d-block rounded-bottom-2 border-top width-fit" style="max-height:640px; min-height: 200px">

  </video>
</details>

<p dir="auto">See <a href="https://github.com/apache/superset/pull/20309" data-hovercard-type="pull_request" data-hovercard-url="/apache/superset/pull/20309/hovercard">this pull request</a> for a working demo.</p>
<h3 dir="auto">New dependencies</h3>
<p dir="auto">None.</p>
<h3 dir="auto">Migration Plan and Compatibility</h3>
<p dir="auto">No migration needed.</p>
<h3 dir="auto">Rejected Alternatives</h3>
<p dir="auto">No alternatives have been considered at this time.</p>
<p dir="auto">A clear and concise description of what the bug is.</p>
<h3 dir="auto">Expected results</h3>
<p dir="auto">User able to access/view dashboard</p>
<h3 dir="auto">Actual results</h3>
<p dir="auto">Keep having error with "You don't have access to this dashboard."</p>
<h4 dir="auto">Screenshots</h4>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/38716433/122561383-5ec9cf80-d074-11eb-80b0-d1f34ba2e5d9.png"><img src="https://user-images.githubusercontent.com/38716433/122561383-5ec9cf80-d074-11eb-80b0-d1f34ba2e5d9.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Tried duplicate admin role and assigned to user but still facing the same error.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/38716433/122561454-743ef980-d074-11eb-9a4d-07f19f0723e1.png"><img src="https://user-images.githubusercontent.com/38716433/122561454-743ef980-d074-11eb-9a4d-07f19f0723e1.png" alt="image" style="max-width: 100%;"></a></p>
<h4 dir="auto">How to reproduce the bug</h4>
<ol dir="auto">
<li>Go to 'Role' then 'Admin' and copy As 'Admin copy'</li>
<li>Assigned user to 'Admin copy'</li>
<li>Log in using user's credential</li>
<li>Try to click on dashboard</li>
<li>Keep having error message: "You don't have access to this dashboard"</li>
<li>Repeat assigned user with different role but result still same</li>
</ol>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>superset version: v1.1.0</li>
<li>python version: Python 3.8.9</li>
<li>node.js version: v14.17.1</li>
<li></li>
</ul>
<h3 dir="auto">Checklist</h3>
<ul dir="auto">
<li>[ x] I have checked the superset logs for python stacktraces and included it here as text if there are any.</li>
<li>[ x] I have reproduced the issue with at least the latest released version of superset.</li>
<li>[ x] I have checked the issue tracker for the same issue and I haven't found one similar.</li>
</ul>