cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Policy Rules vs. Primary Content / Secondary Content Download

m_walendziuk
10-Marble

Policy Rules vs. Primary Content / Secondary Content Download

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.

m_walendziuk_0-1690380516568.png

 

Any ideas?

 

Best regards,

Mateusz Walendziuk

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @m_walendziuk 

 

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

View solution in original post

7 REPLIES 7

Hi @m_walendziuk 

 

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

CZ_9645217
14-Alexandrite
(To:m_walendziuk)

Hi @m_walendziuk ,

 

I have the same requirements, may I ask how you finally realized it, thanks!

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

CZ_9645217
14-Alexandrite
(To:HelesicPetr)

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.

 

CZ_9645217_0-1695124953269.png

Figure 2:

CZ_9645217_1-1695124976597.png

 

 

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;
}
}

 

HelesicPetr_0-1695126462531.png

PetrH

CZ_9645217
14-Alexandrite
(To:HelesicPetr)

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.

 

CZ_9645217_0-1695130763723.png

 

@CZ_9645217 

Unfortunately yes...

 

PetrH

Top Tags