プロジェクト

全般

プロフィール

Vote #75928

完了

Activity Stream Filter missing on right hand side due to permission

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Plugin API_20
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
20
version_id:
80
issue_org_id:
18832
author_id:
37276
assigned_to_id:
1
comments:
3
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
88
ステータス-->[Closed]

説明

When adding a plugins events to the activity stream, the permission is declared as part of the acts_as_activity_provider call. Unfortunately, the Redmine::Activity. Fetcher (lib/redmine/activity/fetcher.rb) method, line 41, requires that permission be called the event type name with "view_" added to the front.

So, if I added the event type :dmsf_file_revision_accesses then there needs to be a permission called :view_dmsf_file_revision_accesses.

If this permission does not exist, the filter on the right hand side of the activity stream will be missing even though the permission works for the stream itself.

This does not seem to be documented anywhere and is not expected behaviour as the permission is declared as part of the acts_as_activity_provider call.

Thanks.

Regards,
Will


journals

Confirmed solely based on a quick code-review. This seems to be a remnant of the days where the use of @acts_as_activity_provider@ with an _implicit :permission_ option (in fact: @"view_#{o}".to_sym@) was prevailing and accepted. This has changed already a long time ago in r5325 (Redmine version#27).

I think that @Redmine::Activity::Fetcher#event_types@ should check @@user.allowed_to?@ for three cases:
# @"view_#{o}".to_sym@ permission [This is currently the only checked case, it seems viable to retain it as a default; in my opinion this does not have to block the actual removal of the long deprecated feature of using @acts_as_activity_provider@ with an implicit :permission option.]
# a specific @:permission@ that is declared as part of the @acts_as_activity_provider@ call
# a @visible@ scope on the @#{self.name}@ model

Are there some other things to consider?

--------------------------------------------------------------------------------
Not that I can think of. This would definitely fix my issue.

Thanks Mischa.
--------------------------------------------------------------------------------
This should be fixed in r13895. If given, the permission option will be checked in order to display the item in the sidebar, instead of the default "view_*" permission.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリPlugin API_20 にセット
  • 対象バージョン3.0.0_80 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0