Patch #14318 » allow_watchers_and_contributers_access_to_issues_v2.patch
| app/models/issue.rb (working copy) | ||
|---|---|---|
| 130 | 130 |
when 'own' |
| 131 | 131 |
user_ids = [user.id] + user.groups.map(&:id).compact |
| 132 | 132 |
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
|
| 133 |
when "own_watch" |
|
| 134 |
user_ids = [user.id] + user.groups.map(&:id) |
|
| 135 |
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}) OR #{table_name}.id IN (SELECT watchable_id FROM watchers WHERE user_id=#{user.id} AND watchable_type = 'Issue'))"
|
|
| 136 |
when "own_watch_contributed" |
|
| 137 |
user_ids = [user.id] + user.groups.map(&:id) |
|
| 138 |
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}) OR #{table_name}.id IN (SELECT watchable_id FROM watchers WHERE user_id=#{user.id} AND watchable_type = 'Issue') OR #{table_name}.id IN (SELECT journalized_id FROM journals where journalized_type = 'Issue' AND user_id=#{user.id} GROUP BY journalized_id))"
|
|
| 133 | 139 |
else |
| 134 | 140 |
'1=0' |
| 135 | 141 |
end |
| ... | ... | |
| 150 | 156 |
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to)) |
| 151 | 157 |
when 'own' |
| 152 | 158 |
self.author == user || user.is_or_belongs_to?(assigned_to) |
| 159 |
when 'own_watch' |
|
| 160 |
self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user) |
|
| 161 |
when 'own_watch_contributed' |
|
| 162 |
self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user) || self.journals.where('journalized_id = ?', self.id).where('user_id = ?', user).count > 0
|
|
| 153 | 163 |
else |
| 154 | 164 |
false |
| 155 | 165 |
end |
| app/models/role.rb (working copy) | ||
|---|---|---|
| 36 | 36 |
ISSUES_VISIBILITY_OPTIONS = [ |
| 37 | 37 |
['all', :label_issues_visibility_all], |
| 38 | 38 |
['default', :label_issues_visibility_public], |
| 39 |
['own', :label_issues_visibility_own] |
|
| 39 |
['own', :label_issues_visibility_own], |
|
| 40 |
['own_watch', :label_issues_visibility_own_watch], |
|
| 41 |
['own_watch_contributed', :label_issues_visibility_own_watch_contributed] |
|
| 40 | 42 |
] |
| 41 | 43 | |
| 42 | 44 |
TIME_ENTRIES_VISIBILITY_OPTIONS = [ |
| config/locales/en.yml (working copy) | ||
|---|---|---|
| 430 | 430 |
setting_search_results_per_page: Search results per page |
| 431 | 431 |
setting_attachment_extensions_allowed: Allowed extensions |
| 432 | 432 |
setting_attachment_extensions_denied: Disallowed extensions |
| 433 |
setting_enable_watcher_issue_visibility: Enable watcher issue visibility |
|
| 433 | 434 | |
| 434 | 435 |
permission_add_project: Create project |
| 435 | 436 |
permission_add_subprojects: Create subprojects |
| ... | ... | |
| 976 | 977 |
label_api: API |
| 977 | 978 |
label_field_format_enumeration: Key/value list |
| 978 | 979 |
label_default_values_for_new_users: Default values for new users |
| 980 |
label_issues_visibility_own_watch: Issues created by, assigned to, or watched by the user |
|
| 981 |
label_issues_visibility_own_watch_contributed: Issues created by, assigned to, watched by, or contributed to by the user |
|
| 979 | 982 | |
| 980 | 983 |
button_login: Login |
| 981 | 984 |
button_submit: Submit |