bokos
2018 年 10 月 5 日午後 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?
「いいね!」 2
Hmm, no, permissions aren’t set based on the text name of the category.
bokos
2018 年 10 月 5 日午後 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?
「いいね!」 1
david
(David Taylor)
2018 年 10 月 5 日午後 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
「いいね!」 8
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?
「いいね!」 4
zoul
(Tomáš Znamenáček)
2018 年 10 月 6 日午前 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.
「いいね!」 3
ErlendMS
(Erlend Markussen Saltnes)
2024 年 1 月 20 日午前 10:42
8
ここでも同じ問題が発生しているようです。
Norwegian のインストールがあり、管理者アカウントにログインしている場合、スタッフ カテゴリにアクセスできません。「すべてのカテゴリ」には表示されますが、クリックすると読み込みが続きます。
テスト ユーザーを作成し、モデレーターにしました。すると、そのユーザーはアクセスできるようになりました。
「いいね!」 1