0

This question is an extension of: ContentWorkspace Permission And Migrating

I have Portal Users that are creating FeedItems that are related to a custom-object record they have access too. Previously this record had a relationship to a ContentVersion but we no longer want to sort the records in libraries (ContentDocumentWorkspace)

TO migrate files out of the libraries I'm doing the following

ContentVersion cv = [SELECT Id,PathOnClient,VersionData,Evidence_Record__c FROM ContentVersion WHERE ContentDocumentId ='...'];

FeedItem item = new FeedItem(ParentId = cv.Evidence_Record__c,
                                ContentData = cv.VersionData,
                                ContentFileName = cv.PathOnClient,
                                Visibility = 'AllUsers');

insert item;

After the FeedItem is inserted, I get 3 ContentDocumentLink records (for these "Sharing Settings", each with "Visibility: All Users")

Sharing Permissions

However, other Portal Users cannot see the ContentVersion record, only the user whom created it. Even though they all have access to the Parent Record?

1

After creating a feed item, you say there are 3 ContentDocumentLinks. What entities do they point to? I would only expect 2 CDLs, one to the file owner, and one to the Evidence Record. Is there a trigger or something creating a 3rd CDL?

As a portal user who can't access the ContentVersion, what happens if they view the Evidence Record which had a feed created? The expected behavior is that you see the feed item, which has a thumbnail of the file, the file name, etc. Do you see the feed item but not the file? If you confirm that the CDL visibility to the record is AllUser visibility, and the user can see the record, I would expect they can see the file. If the feeditem visibilty is AllUsers and the CDL visibility is Internal, that would explain why the user can't access the file, but that doesn't sound like the case.

One alternative which you could compare is to insert a new ContentVersion directly (which will be private to the owner initially), and then insert a CDL point to the Evidence Record (AllUser visibility) and see if the portal user has access.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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