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

We are happy to announce the new Windchill Customization board! Learn more.

How to Disable download

Luar
1-Newbie

How to Disable download

Hi everyone,

Can download function in documents can be disable even if you are in "viewer" group? Because most of our customer has a confidential document that they dont want to be downloaded, or print.

How to Disable Download Primary File menu?

Untitled.jpg

thanks!,

Luar

9 REPLIES 9
rmk
1-Newbie
1-Newbie
(To:Luar)

Hi Luar,

Write a validator for the ACTION and disable the menu from all the place of windchill.

Br

MKR

Luar
1-Newbie
(To:rmk)

Hi Ramanathan,

Can you teach me where/how to do that?

Thanks,

Luar

rmk
1-Newbie
1-Newbie
(To:Luar)

Hi Luar,

Hava a look on UI Validation @customization guide. Lot of OOTB Java validator class is responsible for hiding/enabling/disabling an action. Explore it.

Creating a Validator

Creating a validator class should be fairly simple. All you need to do is create a

class that extends com.ptc.core.ui.validation.DefaultUIComponentValidator.

The class below represents a skeleton for a simple validator class.

package com.ptc.windchill.enterprise.myPackage.validators;

import com.ptc.core.ui.validation.DefaultUIComponentValidator;

public class MyValidator extends DefaultUIComponentValidator{

//override one or more validation methods from

DefaultUIComponentValidator

}

Implementing Pre-Validation Methods

Once you’ve created a validator class skeleton, if you’re adding pre-validation

logic for an attribute, you’ll want to implement the performLimitedPreValidation()

method. If you’re adding pre-validation logic for an action, you’ll want to

implement both the performFullPreValidation() and performLimitedPreValidation()

methods. As mentioned in the previous sections regarding limited pre-validation

and full pre-validation, the implementations of these two methods may be

identical, or they may differ. The class on the next page contains some skeleton

implementations of these methods.

public class MyValidator extends DefaultUIComponentValidator{

@Override

public UIValidationResultSet performFullPreValidation()

(UIValidationKey validationKey,

UIValidationCriteria validationCriteria, Locale

locale) throws WTException {

UIValidationResultSet resultSet =

UIValidationResult.newInstance();

// perform your business logic here

// if you want to enable the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

// UIValidationStatus.ENABLED));

// if you want to disable the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

// UIValidationStatus.DISABLED));

// if you want to hide the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

UIValidationStatus.HIDDEN));

return resultSet;

}

@Override

public UIValidationResultSet performLimitedPreValidation()

(UIValidationKey validationKey,

UIValidationCriteria validationCriteria, Locale

locale) throws WTException {

UIValidationResultSet resultSet =

UIValidationResultSet.newInstance();

// perform your business logic here

// if you want to enable the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

// UIValidationStatus.ENABLED));

// if you want to disable the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

// UIValidationStatus.DISABLED));

// if you want to hide the action/component, do this:

//

resultSet.addResult(UIValidationResult.newInstance(validationKey,

UIValidationStatus.HIDDEN));

return resultSet;

}

}

Basic Validator Registration

To register your validator (using only the action name for an action), you need to

add an entry to *service.properties.xconf like this:

<Service context="default"

name="com.ptc.core.ui.validation.UIComponentValidator">

<Option requestor="null" serviceClass="[your fully-qualified

Validator class]"

selector="[action name/attribute descriptor ID]" />

</Service>

Once propagated to *service.properties, it should produce an entry like this:

wt.services/svc/default/com.ptc.core.ui.vali

dation.UIComponentValidator/[action name/attribute descriptor ID]/null/0=[your fullyqualified

Validator class]/duplicate

• Note that in this case, the requestor attribute is null, meaning the action’s object

type is not used in the lookup.

BR

Ramanathan

LoriSood
22-Sapphire II
(To:Luar)

Do you want to deny everyone but the owner the ability to download?

If so, you deny Download permission on WTDocuments to all principals except owner?

Or you can deny Download to a group/user/role.

If the logic of determining who should have download permission and who should not is more complicated then you will need to create a custom validator per MKR's suggestion.

Luar
1-Newbie
(To:LoriSood)

Hi Lori,

Yes, I want to deny everyone except the owner, how can I deny download per user/group/role?

Thanks,

Luar

mrane
1-Newbie
(To:Luar)

Hi,

I think you can create an ACL where you can deny download permissions to whatever users you wish. ACL's are created via Site-->Utilities --> Policy Administration.

-Malavika

Luar,

Be aware that read access will still allow download of viewable if you publish.

Darren

LoriSood
22-Sapphire II
(To:Luar)

Luar,

were you able to figure out the ACL?

jtang
5-Regular Member
(To:LoriSood)

Lori 

Do you have any sample on how that can be done?

Thanks

Top Tags