The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Hello,
Has anyone tried to figure out the way to be able to only download secondary content from WTDocument and prohibit download of primary content at the same time?
Assuming we have this table "Primary Content" and "Attachments" - I would like to be setup ACLs in a way to be able to download Attachments, but not Primary Content.
Obviously I setup already the ACLs in a way that "download" is prohibited for this type of WTDocument. But the goal is to be able to do it without changing Java code of related data utility.
Any ideas?
Best regards,
Mateusz Walendziuk
Solved! Go to Solution.
In my opinion this is not possible OOTB, because the Download ACL is defined for both type of content. Primary and Secondary.
I can not see a way how to achieve what you need without customization .
PetrH
In my opinion this is not possible OOTB, because the Download ACL is defined for both type of content. Primary and Secondary.
I can not see a way how to achieve what you need without customization .
PetrH
Hi @CZ_9645217
You need to create own custom filter (validator) that allows you to use download button on your own rules.
For example, only person in specific group can do the download or can not download atc.
Then you need to add that filter to download action
Unfortunately without coding and wch customization knowledge it is tough to explain step by step.
how to create validator Adding Validation Logic for Actions
action customization Defining Menus
PetrH
Hi @HelesicPetr
I have written a custom filter to disable download primary file for specific conditions, but users can still click on the Primary Content link in the attribute to download, as shown in Figure 2, how to disable the link in the attribute to download together? Thanks for your help.
Figure 2:
Hi @CZ_9645217
You need to modify DataUtility for the Primary Content (primaryAttachmentProperties)
In your code you need to catch the link and remove the link from the datautility result.
service configuration
<Service context="default" name="com.ptc.core.components.descriptor.DataUtility"
targetFile="codebase/com/ptc/windchill/enterprise/enterpriseui.dataUtilities.properties">
<Option cardinality="duplicate" order="0" overridable="true"
requestor="java.lang.Object"
selector="primaryAttachmentProperties"
serviceClass="cz.aveng.HELTest1.MultiComponentDataUtility"/>
</Service>
java example
public class MultiComponentDataUtility extends PrimaryAttachmentPropertiesDataUtility //AssignmentsTableNmActionsDataUtility
{
public Object getDataValue(String component_id, Object obj, ModelContext modelContext) throws WTException
{
// create original Component
GUIComponentArray retObject = (GUIComponentArray) super.getDataValue(component_id, obj, modelContext);
//example of menuaction from Workflow table so generate own nmAction used in the wf table
AssignmentsTableNmActionsDataUtility actionDataUtility = new AssignmentsTableNmActionsDataUtility();
NmAction nmAction = (NmAction) actionDataUtility.getDataValue(component_id, obj, modelContext);
// crate new NmActionGuiComponent from nmAction that allows to add it to the GUIComponentArray
NmActionGuiComponent nmActionGuiComponent = new NmActionGuiComponent(nmAction);
// adding own custom NmActionGuiComponent to the finall array
retObject.addGUIComponent(nmActionGuiComponent);
IconComponent urlDisplay = new IconComponent();
urlDisplay.setUrl("http://www.google.com");
urlDisplay.setLabel("google");
urlDisplay.setName("google");
urlDisplay.setSrc("https://serverName.cz/Windchill/netmarkets/images/file_url.gif");
urlDisplay.setComponentType("https://serverName.cz/Windchill/netmarkets/images/file_url.gif");
urlDisplay.addJsAction("onclick","window.open('http://www.google.com'); return false;"); // open new subTab window
retObject.addGUIComponent(urlDisplay);
Label label = new Label("I was here <Fantomas>");
retObject.addGUIComponent(label);
return retObject;
}
}
PetrH
Hi @HelesicPetr ,
Thank you very much for your quick reply, as with the previous question, the primary can also be downloaded from the Content tab, does that mean I have to re-customize this tabale as well? Thank you.