Skip to main content
1-Visitor
Jul 4, 2017 7:43 AM UTC
Solved

Custom actions hidden

Hi everyone,

 

I have a problem with my custom action validators. I created some custom actions and attached custom validators to them. I extend the DefaultUIComponentValidator class and override the preValidateAction function. The possible results based on the verifications are DENIED or ENABLED. However when I log in with a user that is not added to any organization (Site level user) and added as Member to a product, I don't see the action. Using jcaDebug it tells me that the action is HIDDEN by my validator. How is this possible? I don't set it to HIDDEN in any case.

This is only happening if the user is not added to any organization.

 

Thx in advance for suggestions!

BR,

Tamás

TamasBiroAnswer
1-Visitor
Jul 6, 2017 7:35 AM UTC

Hi olivierfresse,

 

thx for the suggestion, I tried it but it didn't fix the problem. The organization container is the same... getPrincipal will fail without notice. What we found out that if we use SessionServerHelper.manager.setAccessEnforced(false) before getting the principal (WTGroup) and setting it back afterwards, it will work.

 

BR,

Tamás

6 replies

2-Explorer
Jul 5, 2017 11:13 AM UTC

Could you attach the validator class? Are you referring to anything that requires a domain or container reference in your validator?

Translate
TamasBiro1-VisitorAuthor
1-Visitor
Jul 5, 2017 1:45 PM UTC

My validators require container references... after some debugging I figured out that the problem is with this part: 

 

WTContainer container= part.getContainer();

WTOrganization org = container.getOrganization();

WTGroup orgAdminGroup = (WTGroup) org.getAdministrator().getPrincipal();

 

In the last line it fails. Sometimes this code is ran on method server 1 and sometimes on method server 2. On method server 2 it works, on method server 1 at the last line fails without going to the catch clause of the try like if nothing should happen afterwards. Not even logging after this line will appear.

Translate
15-Moonstone
Jul 5, 2017 2:38 PM UTC

Use services to get the containers. 

 

import wt.inf.container.OrgContainer
import wt.inf.container.WTContainer
import wt.inf.container.WTContainerServerHelper

// initialized somewhere...
WTPart p;

WTContainer wtContainer = WTContainerServerHelper.getContainer(p,false);

// The org is the container of the product/library/project...

OrgContainer orgContainer = WTContainerServerHelper.getContainer(wtContainer,false); 

Translate