rstudio / pins-r

Pin, Discover and Share Resources
https://pins.rstudio.com
Other
301 stars 62 forks source link

Setting Posit Connect Sharing settings #791

Closed craigcerto closed 8 months ago

craigcerto commented 9 months ago

Hi,

I am wondering if it's possible when using pin_upload to set by default the sharing settings for a Pin to be "Anyone - no login required" or "All users - login required"?

I have a process that uploads some log files to a Posit Connect pin board and would like everyone within the server to have download access to the log files without having to manually change the sharing settings for each pin.

Thank you!

juliasilge commented 9 months ago

Yes! If your Posit Connect instance allows it, you can share a pin publicly by setting access_type = "all" when you write or upload:

library(pins)

board <- board_connect()
#> Connecting to Posit Connect 2023.07.0 at <https://colorado.posit.co/rsc>
board |> pin_write(
    1:10, 
    "snazzy-numbers", 
    type = "json", 
    access_type = "all"
)
#> Writing to pin 'julia.silge/snazzy-numbers'

path <- fs::path_temp("some-letters.txt")
readr::write_lines(sample(LETTERS, size = 20), path)
pin_upload(
    board, 
    paths = path, 
    name = "snazzy-letters", 
    access_type = "all"
)

Created on 2023-09-27 with reprex v2.0.2

These are now available publicly on our demo server, and I did not have to change the access through the UI:

The options here for access_type are one of c("acl", "logged_in", "all"), and you can read more in the docs.

juliasilge commented 8 months ago

Let us know if you have further questions! 🙌

github-actions[bot] commented 8 months ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.