Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample Type and download permissions #2085

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

stuzart
Copy link
Member

@stuzart stuzart commented Dec 2, 2024

Override methods to prevent sample types being treated as a downloadable asset. This means it behaves more like Samples, Investigation, Studies and Assays, and the permission options don't include a Download option (however, the ACCESSIBLE access type is applied).

Also updated the upgrade task to apply ACCESSIBLE instead of VIEWABLE, and a new task to update the previously applied permissions.

Although unlikely to be the case, the Download template option isn't shown if viewable but not accessible.

@stuzart stuzart requested a review from kdp-cloud December 2, 2024 16:18
@stuzart stuzart added this to the 1.16.0 milestone Dec 2, 2024
def self.supports_extended_metadata?
false
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question. Does it support Extended Metadata now? Or is it not necessary anymore because it's an asset now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SampleTypes don't support EM. I didn't add this by the way, but just moved up the class out of the private area so I could group these overrides together

SampleType.includes(:policy).where.not(policy_id: nil).each do |sample_type|
policy = sample_type.policy
if policy.access_type == Policy::VISIBLE
policy.update_column(:access_type, Policy::ACCESSIBLE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again a question. Does a sample type need to be accessible in order to be able to download the template?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because it goes throught the content blob controller it checks the permissions on the associated asset. There is an example here: https://testing.sysmo-db.org/sample_types/97

@stuzart stuzart merged commit ad3eb18 into seek-1.16 Dec 3, 2024
19 checks passed
@stuzart stuzart deleted the sample-type-download-permissions-2084 branch December 3, 2024 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants