Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to search a user in the table "cwd_user" by a "userkey"?

When someone uses the @ to insert a user into a Confluence page, the following string gets inserted into the "body" column of the "bodycontent" table of the Confluence database:

<div class="content-wrapper"><p><ac:link><ri:user ri:userkey="bee05cc37052f5240170e2d6d26b000c" /></ac:link></p></div>

Instead of the username a "userkey" is in the document.

How to search a user in the table "cwd_user" by a "userkey"?

I can not find any "userkey" in the table "cwd_user":

confluencedb=# \d cwd_user
Tabelle »public.cwd_user«
Spalte | Typ | Attribute
---------------------+-----------------------------+-----------
id | bigint | not null
user_name | character varying(255) | not null
lower_user_name | character varying(255) | not null
active | character(1) | not null
created_date | timestamp without time zone | not null
updated_date | timestamp without time zone | not null
first_name | character varying(255) |
lower_first_name | character varying(255) |
last_name | character varying(255) |
lower_last_name | character varying(255) |
display_name | character varying(255) |
lower_display_name | character varying(255) |
email_address | character varying(255) |
lower_email_address | character varying(255) |
external_id | character varying(255) |
directory_id | bigint | not null
credential | character varying(255) |
Indexe:
"cwd_user_pkey" PRIMARY KEY, btree (id)
"cwd_user_name_dir_id" UNIQUE CONSTRAINT, btree (lower_user_name, directory_id)
"idx_user_active" btree (active, directory_id)
"idx_user_external_id" btree (external_id)
"idx_user_lower_display_name" btree (lower_display_name, directory_id)
"idx_user_lower_email_address" btree (lower_email_address, directory_id)
"idx_user_lower_first_name" btree (lower_first_name, directory_id)
"idx_user_lower_last_name" btree (lower_last_name, directory_id)
"idx_user_lower_user_name" btree (lower_user_name)
"idx_user_name_dir_id" btree (directory_id)
Fremdschlüssel-Constraints:
"fk_user_dir_id" FOREIGN KEY (directory_id) REFERENCES cwd_directory(id)
Fremdschlüsselverweise von:
TABLE "cwd_user_credential_record" CONSTRAINT "fk2rfdh2ap00b8mholdsy1b785b" FOREIGN KEY (user_id) REFERENCES cwd_user(id)
TABLE "cwd_membership" CONSTRAINT "fk_child_user" FOREIGN KEY (child_user_id) REFERENCES cwd_user(id)
TABLE "cwd_user_attribute" CONSTRAINT "fk_user_attribute_id_user_id" FOREIGN KEY (user_id) REFERENCES cwd_user(id)

BTW: Why gets the source code format destroyed by the forum?

1 answer

1 accepted

1 vote
Answer accepted
Ivan Lima Community Leader Sep 20, 2020

Hi @Sascha Ziemann, you will find this reference, as well as other references of Confluence tables at Confluence Data Model. In the section Database tables and references, expand the list of tables, and you will find USER_KEY at the USER_MAPPING table.

Therefore, you'll find the user key from users:

SELECT user_key FROM user_mapping WHERE lower_username = '<username>';

The string you mentioned is the resource identifier of the user, in this case, the user key. It is useful, for example, when you work with Confluence Storage Format to dynamically create Confluence resources such as mentions, macros, etc.

I hope it helps.
IL.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

125 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you