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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Custom actions hidden

TamasBiro
12-Amethyst

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

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

6 REPLIES 6

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

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.

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

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

Ah, this make sense.

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

regards,

 

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.

Announcements

Top Tags