diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-06-23 13:49:29 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-06-23 13:49:29 +0000 |
commit | 1c44600c62dc1063583d9e2015ab815d9dd22fa5 (patch) | |
tree | dee0938476cc4525b60679905896b7af7a6bd4a7 /app/models/query.rb | |
parent | 5332c4362cdf7c98a281d88409a07b24767dc2d2 (diff) | |
download | redmine-1c44600c62dc1063583d9e2015ab815d9dd22fa5.tar.gz redmine-1c44600c62dc1063583d9e2015ab815d9dd22fa5.zip |
Added per user custom queries.
Any logged in user can now save queries (they are not visible to the other users).
Only users with explicit permission can manage queries that are visible to anyone.
The queries list is removed from the "Reports" view. It can now be accessed from the issues list.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@566 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/query.rb')
-rw-r--r-- | app/models/query.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 081721ca2..b64143674 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -57,7 +57,6 @@ class Query < ActiveRecord::Base def initialize(attributes = nil) super attributes self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } - self.is_public = true end def executed_by=(user) @@ -75,6 +74,12 @@ class Query < ActiveRecord::Base end if filters end + def editable_by?(user) + return false unless user + return true if !is_public && self.user_id == user.id + is_public && user.authorized_to(project, "projects/add_query") + end + def available_filters return @available_filters if @available_filters @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all, :order => 'position').collect{|s| [s.name, s.id.to_s] } }, |