사용자가 새 주제를 생성하면서 태그를 지정할 수 없음 - 태그 목록이 표시되지 않음

I have a regular user that is trust_level_0 and trust_level_1 , and I have these settings:

tag topic allowed groups: admins, moderators, staff, trust_level_0
create topic allowed groups: admins, moderators, trust_level_1
create tag allowed groups: admins, moderators, staff

The user can create the topics, but he can not use tags when he is creating the topic. He can use the tags for search but the tags are not listed when creating a topic.

Is my setting incorrect? Am I missing something? Whit staff or admin user I can do both at once. Thanks for any advice.

It has caught more than a few people out, but admin and mods can skip a lot of the restrictions that apply to everyone else.

Do you have any other restrictions placed on your tags? Like a tag group that only x group can use, or any restrictions you’ve placed on tags in a particular category?

If you go to a tag page and click the tag wrench (:information_source: for non-staff) it should show you some more information that may be able to help track any extra limitations you’ve placed on it. Eg broken here on meta:

could be possible that Discourse is not handling the mix between trust_level_0 and trust_level_1 when creating the topic and tagging it?

Should I add trust_level_1 to this:

and add trust_level_0 in this line :

Anyone that is in trust_level_1 is also in trust_level_0 by default.

You may want to allow TL0 to be able to create topics, depending on your site setup, as people will often sign up to ask a question, etc and could be confused as to why they can’t (possibly giving up before figuring it out).

But I don’t think this would explain the problem you’re having.

Is this issue happening for just this user? Are other people able to successfully tag topics?

Could you give any more detail about how you’ve set your tags up?

As @HAWK said, anyone that is in trust_level_one is by default in trust_level_0, and for that reason it’s confusing for me. There are more than one user with this problem.I checked tags that can be used in the Categories that we need.

@JammyDodger , what could be interesting to check in my tags set up?

Tags are pretty flexible and can be configured in lots of different ways so we may need some more detail on how you’ve set yours up to provide more specific suggestions.

Though a common one is when a category has been set up to have certain tags only allowed to be used in that category and the ‘also allow other tags’ hasn’t been checked. That could limit the category to only the restricted tags and if those ones are staff-only this could prevent anyone else from using any other tags.

Just to follow up (though hopefully you’ve already managed to track it down :crossed_fingers:), but Moin gave a thorough troubleshooting post for a similar thing here:

Hey @JammyDodger. I’ve been tangled with other issues at work but I’m still stuck with this. Z

Ok, I have my Categories, and in the “Tags” settings of the category I hav:

Restrict these tag GROUPS to this category: TAG-GRP1, TAG-GRP2

When I go to “Manage Tag Groups” I have:

TAG-GRP1:

Name: TAG-GRP1
Tags in this group:  A LIST OF MY TAGS FOR TAG-GRP1
Parent tag: -
Limit one tag per topic from this group (unchecked)

TAG-GRP2:

Name: TAG-GRP2
Tags in this group:  A LIST OF MY TAGS FOR TAG-GRP2
Parent tag: -
Limit one tag per topic from this group (unchecked)

Tags are visible only to the following groups: admin, moderators, trust_level_0, trust_level_1

And when I check as Admin the tag that I want to use when creating a topic I can see this:

This tag belongs to these groups: . It can only be used in these categories: TAG-GRP1, TAG-GRP2

I already have TL0 and TL1 in “tag topic allowed groups” and “create topic allowed groups”. But with a regular user TL1 I can not use some tags.

Did you manage to check out the troubleshooting post I linked above yet? It’s pretty thorough and could help point you in the right direction.

I’m not sure you’ve copied that over accurately?

Just as an extra FYI, there’s no need to put both TL0 and TL1 in any settings as all members of TL1 are also TL0 (think of TL0 as ‘all registered users’). Adding only TL0 would suffice. :+1:

추천하신 링크 확인해 볼게요. 감사합니다.

안녕하세요 @JammyDodger, 올려주신 링크에 감사드립니다. 저에게 도움이 될 것 같아서 이미 링크를 확인해 보았는데요, 제 설정은 문제가 없는 것 같고, 해당 게시물에 제시된 권장 사항도 제 생각에 타당하며, 제 설정도 권장 사항대로 되어 있습니다. 또한 카테고리 설정에서 테스트를 위해 Also allow other tags 옵션도 활성화해 보았지만, 불행히도 제 문제는 해결되지 않았습니다.

권한 설정이 변경될 때 무언가를 재시작해야 하는지 궁금합니다.

먼저, 모든 텍스트가 가려진 이미지를 공유하게 되어 죄송합니다. 이해해 주시길 바랍니다.

이것은 태그 이름, 태그 그룹 이름, 그리고 해당 태그가 사용되어야 하는 카테고리입니다. 하지만 일반 사용자로 사용할 수 없습니다. 각 카테고리 이름 옆에 자물쇠 아이콘이 표시되는 것이 정상적인지 알고 싶습니다.

모든 도움과 아이디어에 감사드립니다.

카테고리가 모든 사람에게 공개되지 않은 경우 정상적인 현상입니다.
예를 들어, 제 태그 중 하나입니다. “Test” 옆에 자물쇠가 있는 것을 볼 수 있습니다.


그리고 해당 카테고리의 보안 설정입니다:
image
"모두"에게 “보기” 권한이 없기 때문에 카테고리 배지 옆에 자물쇠 아이콘이 표시됩니다. 이는 해당 카테고리가 공개되어 있지 않음을 의미합니다.

이것이 제가 설명한 문제와 관련이 있을까요?

사용자가 해당 카테고리에 접근할 수 없다면 토픽 생성 시 카테고리를 선택할 수 없게 되며(토픽 생성 시 선택할 수 없다면 ‘허용된 태그’ 구조도 적용되지 않음), 사용자가 해당 카테고리에 접근할 수 있는 그룹에 속해 있습니까?

아직 충돌의 원인이 무엇인지 정확히 파악하지 못했다면, 일부 태그 제한을 제거해 권한 충돌이 정확히 어디서 발생하는지 좁혀 나가는 것이 좋습니다.

데이터 탐색기(Data Explorer) 플러그인을 설치해 두셨나요? 특정 태그에 대한 모든 제한 사항을 보여 주는 쿼리를 하나 만들었습니다. 이거 역시 도움이 될 수 있을 것 같아요. 결과를 공유하고, 출력 결과에서 태그 그룹 이름, 태그 이름, 카테고리 이름을 다른 단어로 대체해 보셔도 좋습니다. 그러면 블랙박스를 비교하는 것보다 조금 더 쉽게 도와드릴 수 있을 거예요.

고맙습니다 @Moin . 네, 맞습니다. Data Explorer 플러그인을 설치해 두었습니다. 또 늦은 답변으로 죄송합니다.

이 쿼리는 제 설정에서 문제를 발견하는 데 도움이 되었습니다. 꽤 오랜 시간 동안 사용하지 않아서 개선할 부분이 있었는지 기억이 나지 않습니다.

태그나 태그 그룹으로 필터링할 수 있습니다

-- [params]
-- null string :tag_name
-- null string :tag_group

WITH allowed_tags AS (
  SELECT ct.category_id, t.id AS tag_id
  FROM category_tags ct
  JOIN tags t ON t.id = ct.tag_id
  UNION
  SELECT ctg.category_id, tgm.tag_id
  FROM category_tag_groups ctg
  JOIN tag_group_memberships tgm ON tgm.tag_group_id = ctg.tag_group_id
),

restricted_categories AS (
  SELECT c.id, c.name
  FROM categories c
  WHERE c.allow_global_tags = FALSE
    AND (
      EXISTS (SELECT 1 FROM category_tags ct WHERE ct.category_id = c.id)
      OR EXISTS (SELECT 1 FROM category_tag_groups ctg WHERE ctg.category_id = c.id)
    )
),

all_tag_category_combinations AS (
  SELECT t.id AS tag_id, t.name AS tag_name, rc.id AS category_id, rc.name AS category_name
  FROM tags t
  CROSS JOIN restricted_categories rc
  WHERE t.target_tag_id IS NULL
),

not_allowed_tags AS (
  SELECT atcc.tag_id, atcc.category_id, atcc.category_name
  FROM all_tag_category_combinations atcc
  LEFT JOIN allowed_tags al
    ON al.tag_id = atcc.tag_id AND al.category_id = atcc.category_id
  WHERE al.tag_id IS NULL
)

SELECT
  main.id AS tag_id,
  main.name AS tag_name,
  COALESCE(STRING_AGG(DISTINCT syn.name, ', '), '') AS synonyms,

  tg.id AS tag_group_id,
  COALESCE(parent_tag.name, '') AS parent_tag_name,  
  CASE WHEN tg.one_per_topic THEN 'true' ELSE '' END AS one_tag_per_topic,

  COALESCE(
    STRING_AGG(
      DISTINCT
      CASE
        WHEN crtg.min_count IS NOT NULL THEN crtg_cat.name || ' (' || crtg.min_count || ')'
        ELSE NULL
      END,
      ', '
    ),
    ''
  ) AS required_in_categories_with_min,

  COALESCE(STRING_AGG(DISTINCT ctg_cat.name, ', '), '') AS tag_group_limited_to_category,
  COALESCE(STRING_AGG(DISTINCT ctags_cat.name, ', '), '') AS tag_limited_to_category,
  COALESCE(STRING_AGG(DISTINCT nat.category_name, ', '), '') AS not_allowed_in_categories,

  CASE 
    WHEN COUNT(DISTINCT g.name) > 0 THEN COALESCE(STRING_AGG(DISTINCT g_use.name, ', '), '')
    ELSE ''
  END AS use_limited_to,
  COALESCE(STRING_AGG(DISTINCT g.name, ', '), '') AS view_only_groups

FROM tags AS main
LEFT JOIN tags AS syn ON syn.target_tag_id = main.id
LEFT JOIN tag_group_memberships AS tgm ON tgm.tag_id = main.id
LEFT JOIN tag_groups AS tg ON tg.id = tgm.tag_group_id
LEFT JOIN tags AS parent_tag ON parent_tag.id = tg.parent_tag_id
LEFT JOIN tag_group_permissions tgp ON tgp.tag_group_id = tg.id AND tgp.permission_type = 3
LEFT JOIN groups g ON g.id = tgp.group_id

LEFT JOIN category_required_tag_groups AS crtg ON crtg.tag_group_id = tg.id
LEFT JOIN categories AS crtg_cat ON crtg.category_id = crtg_cat.id
LEFT JOIN category_tag_groups AS ctg ON ctg.tag_group_id = tg.id
LEFT JOIN categories AS ctg_cat ON ctg.category_id = ctg_cat.id
LEFT JOIN category_tags AS ctags ON ctags.tag_id = main.id
LEFT JOIN categories AS ctags_cat ON ctags.category_id = ctags_cat.id
LEFT JOIN not_allowed_tags AS nat ON nat.tag_id = main.id
LEFT JOIN tag_group_permissions tgp_use ON tgp_use.tag_group_id = tg.id AND tgp_use.permission_type = 1
LEFT JOIN groups g_use ON g_use.id = tgp_use.group_id

WHERE
  main.target_tag_id IS NULL AND
  (
    :tag_name IS NULL OR
    LOWER(main.name) LIKE LOWER('%' || :tag_name || '%') OR
    LOWER(syn.name) LIKE LOWER('%' || :tag_name || '%')
  ) AND
  (
    :tag_group IS NULL OR
    LOWER(tg.name) LIKE LOWER('%' || :tag_group || '%')
  )

GROUP BY
  main.id, main.name, tg.id, tg.name, parent_tag.name, tg.one_per_topic
ORDER BY main.name, tag_group_id

@Moin, 3.5.0.beta8-dev 버전에서 쿼리를 시도해 보았지만 작동하지 않았습니다. 다음과 같은 오류 메시지가 표시되었습니다:

PG::QueryCanceled: ERROR:  canceling statement due to statement timeout

이 오류를 검색해 보니 statement_timeout을 늘려야 한다는 정보를 찾았습니다. 하지만 이 문제는 프로덕션 서버에서 발생하고 있고, 저는 데이터베이스나 PostgreSQL에 대해 잘 알지 못합니다. 서버에 문제를 일으키지 않고 해결할 방법을 찾고 있습니다.

참고로, 호기심에 다른 포럼에서 3.4.0.beta1-dev 버전을 실행 중인 친구에게 같은 쿼리를 시도해 보았더니, 스크립트가 아무 문제 없이 정상적으로 실행되었습니다.

시간 내어 조언해 주셔서 감사합니다.