Forum Discussion

rapalaku's avatar
7 years ago

Navigate users to a custom page other than access denied page

My requirement is to restrict a category content only to be accessible by Administrators and I got it done with roles and permissions.

When a user other than Administrator have a conversation/thread Id from that private category (lets say some 1234) and tries to navigate to that content, obviously the user is shown "Access Denied Page". I want to navigate that user to a "custom page" other than "Access Denied page".

I tried to achive my requirement with page initialisation script like follows, But the user is still navigated to "Access Denied page"

 

<#if coreNode.id = “1234” />

<#if !(coreNode.permissions.hasPermission("update_community"))>

${http.response.setRedirectUrl(webuisupport.urls.page.name.get(“custom-page”).build())}

</#if>

</#if>

Is there any way to achieve my requirement?

5 Replies

  • rapalaku's avatar
    rapalaku
    Guide
    7 years ago

    VikasB I have modified the condition as per your comment. Even It is not redirecting to custom page.

  • VikasB's avatar
    VikasB
    Boss
    7 years ago

    rapalaku

    It would not work. What I think is,  Actually, the user is redirected to Access Denied Page before running the init script. It means your conditional statement would not work because of access denied page the coreNode id would not be the same i.e. 1234. 

    I am not sure it would suit you or not but role-based redirection can be the one option here to achieve this instead of permission setup.   

  • Hi rapalaku,

    To my knowledge, PAGE INITIALIZATION script does not work in Lithium error pages.
    Did you try via JS code (check for Access Denied element) to redirect user to custom page? 

     

    Thanks,

    Srujana.