Project

General

Profile

Patch #14318 » allow_watchers_and_contributers_access_to_issues_v2.patch

patch for 3.2.0.devel.15058 - Go MAEDA, 2016-02-04 14:30

View differences:

app/models/issue.rb (working copy)
when 'own'
user_ids = [user.id] + user.groups.map(&:id).compact
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when "own_watch"
user_ids = [user.id] + user.groups.map(&:id)
"(#{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'))"
when "own_watch_contributed"
user_ids = [user.id] + user.groups.map(&:id)
"(#{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))"
else
'1=0'
end
......
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
when 'own_watch'
self.author == user || user.is_or_belongs_to?(assigned_to) || self.watched_by?(user)
when 'own_watch_contributed'
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
else
false
end
app/models/role.rb (working copy)
ISSUES_VISIBILITY_OPTIONS = [
['all', :label_issues_visibility_all],
['default', :label_issues_visibility_public],
['own', :label_issues_visibility_own]
['own', :label_issues_visibility_own],
['own_watch', :label_issues_visibility_own_watch],
['own_watch_contributed', :label_issues_visibility_own_watch_contributed]
]
TIME_ENTRIES_VISIBILITY_OPTIONS = [
config/locales/en.yml (working copy)
setting_search_results_per_page: Search results per page
setting_attachment_extensions_allowed: Allowed extensions
setting_attachment_extensions_denied: Disallowed extensions
setting_enable_watcher_issue_visibility: Enable watcher issue visibility
permission_add_project: Create project
permission_add_subprojects: Create subprojects
......
label_api: API
label_field_format_enumeration: Key/value list
label_default_values_for_new_users: Default values for new users
label_issues_visibility_own_watch: Issues created by, assigned to, or watched by the user
label_issues_visibility_own_watch_contributed: Issues created by, assigned to, watched by, or contributed to by the user
button_login: Login
button_submit: Submit
(3-3/15)