Scenario

Using Redirection, it's possible to direct a user to a specific space or page depending on their user group.

In this recipe, users are directed to either the Marketing space or the Operations space, depending on which group they belong to.

(This recipe assumes the user is assigned to only one group.)

See this in action on our demo site!

Result

Not applicable.

Recipe

Apps


Redirection, Visibility for Confluence


Platform

Server

Level

Easy

Estimated time

5 minutes ⏱

Macros

Redirect

Storage format

You can copy and paste this code into the Confluence Source Editor:

<p class="auto-cursor-target">
  <br />
</p>
<ac:structured-macro ac:macro-id="f06cd1a9-aafb-4d8d-9b8d-17ac5704375b" ac:name="show-if" ac:schema-version="1">
  <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
  <ac:parameter ac:name="group">operations</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="61884cd6-6d4d-42da-a303-ea86b284d781" ac:name="redirect" ac:schema-version="1">
        <ac:parameter ac:name="location">
          <ac:link>
            <ri:page ri:content-title="Operations Home" ri:space-key="OPS" />
          </ac:link>
        </ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
  <br />
</p>
<ac:structured-macro ac:macro-id="ef057b26-d32d-4041-bbf0-8611c9a8ca3b" ac:name="show-if" ac:schema-version="1">
  <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
  <ac:parameter ac:name="group">marketing</ac:parameter>
  <ac:rich-text-body>
    <p>
      <ac:structured-macro ac:macro-id="900a0e65-8772-43e5-9d3e-18e21d9582e4" ac:name="redirect" ac:schema-version="1">
        <ac:parameter ac:name="location">
          <ac:link>
            <ri:page ri:content-title="Marketing" ri:space-key="MAR" />
          </ac:link>
        </ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p class="auto-cursor-target">
  <br />
</p>

Macro structure

You can recreate the example in the editor view:

Steps

  1. Create a Show If macro.
    Set the User Groups parameter to the "operations" group.

  2. Within the Show If macro, create a Redirect macro and set the following parameters:

    • Location to the space URL for the Operations space.

    • Delay to "0"

  3. Create another Show If macro.
    Set the User Groups parameter to the "marketing" group.

  4. Within the Show If macro, create a Redirect macro and set the following parameters:

    • Location to the space URL for the Marketing space.

    • Delay to "0"

Line-by-Line Explanation

Not applicable.