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

Custom actions hidden

SOLVED
Highlighted
Marble

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

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Custom actions hidden

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 6

Re: Custom actions hidden

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

Re: Custom actions hidden

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.

Re: Custom actions hidden

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

Re: Custom actions hidden

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

Re: Custom actions hidden

Ah, this make sense.

The logged user may not have access to org objects... so bypassing the access control is needed.

regards,

 

Re: Custom actions hidden

The strange thing is that, this behaviour is present only if we have 2 method servers. When MS2 takes the session, it works correctly, but when MS1 takes the session it fails... this is what leaves me with big questionmarks in my head.