Bug - possible for admin to assign PM to moderator who does not have access to the PM

I have noticed what I think is a bug with the Discourse Assign plugin. It is possible for an admin to assign a PM to a moderator who does not have access to the PM. They are notified, but when they click through to see the PM they cannot see it and get an error.

The answer, it seems to me, should be to add the assignee to the message at the same time, or to display an error to the assigner to let them know the assignee is not in the message and cannot be assigned the message.

This obviously does not affect admins who can see all PMs.

5 лайков

I can repro this. An assign notification is generated despite the user not having access to the PM assigned. Same issue occurs in categories with security that mods can’t access.

5 лайков

Oh yeah interesting edge case what can we do here @sam?

4 лайка

I think a minimum change here is to pop up an error saying moderator has no access to the PM when the admin / mod tries to assign.

This particular edge case will become much less of an edge case when we unlock “assign” to designated groups that are not mods.

4 лайка

Сегодня я снова наткнулся на это — оказывается, я назначил множество сообщений модераторам, у которых нет к ним доступа, поэтому они не занимались ими. Ой.

2 лайка

ЛОЛ, можем ли мы как-то просто защитить от вышеописанного, @sam?

3 лайка

Теперь это произошло, возможно, @Roman сможет взять это на контроль.

5 лайков

Я открыл PR для применения дополнительных правил при попытке назначения темы:

  • Пользователь, которому мы собираемся назначить тему, должен иметь право назначать.
  • Пользователь, которому мы собираемся назначить тему, должен иметь доступ к теме.

Попытка назначить тему одному из таких пользователей вызовет ошибку:

Я считаю, что нам также следует исключить из результатов модального окна назначения пользователей, у которых нет доступа. Для этого мне придется немного расширить API поиска пользователей в ядре.

Вот ссылка на PR:

Перед слиянием я найду кого-нибудь для проверки кода.

6 лайков