bokos
10월 5, 2018, 6:33오후
1
I noticed my moderators don’t have access to the Staff category. I just installed a fresh discourse locally to test it and it still happens.
I think it’s because my Discourse got installed in German and my Staff group is actually called Team.
So I ran this in console:
staff = Category.find_by(id: SiteSetting.staff_category_id)
staff.group_names = [Group[:staff].name]
staff.save
I hope this doesn’t break anything?
Hmm, no, permissions aren’t set based on the text name of the category.
bokos
10월 5, 2018, 9:41오후
3
I just noticed I have the same issue with the Lounge category.
I think the group_names=(names) method of the Category model should find the correct name of the group? Or change the fixtures?
david
(David Taylor)
10월 5, 2018, 10:14오후
4
Yes, it looks like we localise the group names here:
group.id = id
group.save!
end
# don't allow shoddy localization to break this
localized_name = I18n.t("groups.default_names.#{name}").downcase
validator = UsernameValidator.new(localized_name)
if !Group.where("LOWER(name) = ?", localized_name).exists? && validator.valid_format?
group.name = localized_name
end
# the everyone group is special, it can include non-users so there is no
# way to have the membership in a table
case name
when :everyone
group.visibility_level = Group.visibility_levels[:owners]
group.save!
return group
when :moderators
But then set category permissions using the unlocalised group name here:
unless Rails.env.test?
staff = Category.find_by(id: SiteSetting.staff_category_id)
if staff && !staff.group_ids.include?(Group[:staff].id)
# Add permissions and a description to the Staff category.
Category.transaction do
staff.group_names = ['staff']
unless staff.save
puts staff.errors.full_messages
raise "Failed to set permissions on the Staff category!"
end
if staff.topic_id.nil?
creator = PostCreator.new(Discourse.system_user,
raw: I18n.t('staff_category_description'),
title: I18n.t('category.topic_prefix', category: staff.name),
category: staff.name,
I think this could do with some improvement
Oh dear, I didn’t realize we were using the string names rather than the numeric codes. I wonder why we haven’t seen more complaints about this for Discourse instances in other languages?
zoul
(Tomáš Znamenáček)
10월 6, 2018, 6:46오전
6
I’ve seen the same (or similar?) bug running Discourse in Czech and thought it was a random glitch related just to a single user. It went away after I temporarily turned the moderator into an admin and back IIRC, so I did not bother reporting it.
ErlendMS
(Erlend Markussen Saltnes)
1월 20, 2024, 10:42오전
8
저도 여기서 비슷한 문제가 있는 것 같아요..
노르웨이어로 설치한 환경인데요 - 관리자 계정으로 로그인하면 스태프 카테고리에 접근할 수 없습니다. “모든 카테고리” 목록에서는 보이지만, 클릭하면 계속 로딩만 됩니다.
테스트 유저를 만들고 그 사용자를 모더레이터로 지정했는데, 그 유저는 접근할 수 있었습니다.