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

Disable search restriction in certain situation

0 Likes
3,697

Dear Experts,

In normal circumstances one user cant see another user details due to search restriction , is there any way to disable on some special circumstances without disturbing the current restriction ?

Appriciate your inputs on this.

Accepted Solutions (0)

Answers (1)

Answers (1)

sasethia
Explorer

You can use getSearchRestrictionService().disableSearchRestrictions(); to disable restrictions and then re-enable ina finally block getSearchRestrictionService().enableSearchRestrictions();.

Please execute the overall code block in the local view.

Something like below:

return getSessionService().executeInLocalView(new SessionExecutionBody()

{

@Override

public Object execute()

{

try

{

getSearchRestrictionService().disableSearchRestrictions();

<Your custom code>

}finally

{

getSearchRestrictionService().enableSearchRestrictions();

}

}

});

Sidd-Kumar
Newcomer
0 Likes
what is the need to use local view? If disable and enable restriction directly without using local view, is there any issues?