I have a trigger which create content Distribution Records. Creating content distribution Record using following code:-
ContentDistribution cdist = new ContentDistribution( Name = cv.ContentDocument.Title, ContentVersionId = cv.Id ); Insert cd;
I am getting following error while trying to save a file.
Insert failed. First exception on row 6; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: 
On debugging code I found out that error is coming when we are creating content distribution records.
I was thinking this might be a permission issue so I have given following permission.
I have enabled the permission "Content Deliveries feature can be enabled for users, Public Links can be enabled for users (Requires Content Deliveries), and Content Deliveries and Public Links can be enabled to let communities users share files managed by libraries (Requires Content Deliveries)." with help of this Doc. https://help.salesforce.com/articleView?id=content_delivery_about.htm&type=5
With above permission there is a help icon saying "Allow content deliveries and public links to be enabled for community users to share library managed files inside and outside the community. Users need the Deliver Content library perm enabled in the relevant library. To create public links, users also need the Create Public Links user permission."
I have created a permission set with Create Public links permission. I am not able to find how I can enable "Deliver Content library perm enabled in the relevant library" this permission in library.
Is this error is due to permission or I am missing something else.
The code is running in managed package. It is working for other customers.