Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: To hide or securely encrypt your Confluence data, we recommend using Visibility or Security & Encryption apps.

Result

...

Recipe

Apps

Reporting for Confluence Server & Data Center

Level

Easy

Estimated time

15 Minutes

Macros

Report Block, User Group Reporter, Text Filter, Report Body, Report Empty

Suppliers

Global Supplier, User-group Supplier

Storage format

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

Code Block
<ac:structured-macro ac:macro-id="85c01b60-2227-4412-847e-8c6149bedba2" ac:name="report-block" ac:schema-version="1">
  <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="72c0d06e-cc6d-451a-a864-4614cbecc11f" ac:name="user-group-reporter" ac:schema-version="1">
      <ac:rich-text-body>
        <p>
          <ac:structured-macro ac:macro-id="b04e2ab2-9da9-42ea-8073-91cd94bfaea2" ac:name="text-filter" ac:schema-version="1">
            <ac:parameter ac:name="contains">%global:current user%</ac:parameter>
            <ac:parameter ac:name="required">true</ac:parameter>
            <ac:parameter ac:name="">user-group:members</ac:parameter>
          </ac:structured-macro>
        </p>
        <p>
          <ac:structured-macro ac:macro-id="db1a30c9-98b4-4e88-bade-4aa09f36f4a9" ac:name="text-filter" ac:schema-version="1">
            <ac:parameter ac:name="contains">confluence-users</ac:parameter>
            <ac:parameter ac:name="required">true</ac:parameter>
            <ac:parameter ac:name="">user-group:name</ac:parameter>
          </ac:structured-macro>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="17d5efff-61f7-44cd-a44b-6e5af0cd5efc" ac:name="report-body" ac:schema-version="1">
      <ac:rich-text-body>
        <ac:structured-macro ac:macro-id="9489ef71-25af-4100-ae33-f83e054a1e1a" ac:name="info" ac:schema-version="1">
          <ac:rich-text-body>
            <p>Testing if me, a confluence-users member, can see this</p>
          </ac:rich-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:macro-id="df1a62db-41a9-4838-a84e-42aedd368014" ac:name="report-empty" ac:schema-version="1">
      <ac:rich-text-body>
        <ac:structured-macro ac:macro-id="a4204713-a921-4cff-a7e8-19bc9f5f7172" ac:name="info" ac:schema-version="1">
          <ac:rich-text-body>
            <p>Nothing to see here, move along</p>
          </ac:rich-text-body>
        </ac:structured-macro>
      </ac:rich-text-body>
    </ac:structured-macro>
  </ac:rich-text-body>
</ac:structured-macro>

...

You can recreate the example in the editor view:

Image Added

Steps

  1. Add a Report Block Macro

  2. Inside the macro, add the User Group Reporter, Report Body, and Report Empty macro.

  3. In the User Group Reporter macro, add two Text Filter macro and set the following:

    1. First Text Filter macro

      1. Key = user-group:members

      2. Required = Enabled

      3. Contains Value = %global:current user%

    2. Second Text Filter macro

      1. Key = user-group:name

      2. Required = Enabled

      3. Contains Value = confluence-users
        Set the group(s) that are allowed to view the content in this field.

  4. For the Report Body macro, insert the content you want to show to the group(s).

  5. In the Report Empty macro, add content you want the non-members of the group to view. This is optional.

...