0

We have private nodes. Nodes that are just visible for logged in users. These nodes are setup to use a private filesystem. These "private" nodes can also become public if an article is moved to the front page for example - or when an editor decides, that the content is not just for members any longer.

I assume all images uploaded before via the private file system setup now will not work any longer.

I guess I could check every single file via hook (if there is one) and check the access settings for the parent entity (node). But I am pretty sure I am not the first person, that needs to switch content from private to public. There must be a more solid way.

I could not find any information regarding this in the documentation.

Whats Drupals way to deal with dynamic (public / private) states and its media?

Thanks

5
  • I once needed to make all public files private drupal.stackexchange.com/questions/264496/…
    – leymannx
    Commented Oct 2, 2020 at 20:11
  • And I'm not sure, isn't it that private files only are private as long as the host entity also is private? So that when you switch the nodes the private files also become accessible? I'd definitely check that first, just to be sure to make no false assumptions.
    – leymannx
    Commented Oct 2, 2020 at 20:12
  • Thanks for the reply. May I ask how you would define if the node (entity) is private?
    – mogio
    Commented Oct 2, 2020 at 20:25
  • Access protected. You used that term in the first sentence of your post. ;)
    – leymannx
    Commented Oct 2, 2020 at 21:30
  • With private nodes I mean nodes that are role specific not visible to NOT logged in users. Is Drupal able to set files of a unpublished or not publicly accessible node to "private" (private filesystem)? fyi: we use symfony for via event to throw a "\Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException();" to prevent users from accessing a specific node when he/she has not the correct role. I guess this is wrong?! Should I use a module, that also handles the file privacy ? Thanks for any input.
    – mogio
    Commented Oct 2, 2020 at 21:57

1 Answer 1

0

wombatbuddy made a sandbox project that does this, allowing the file on a given node to be changed from private to public and vice versa: Switch private public

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.