@@ -118,6 +118,11 class Project < ActiveRecord::Base | |||||
118 | visible(user).find(:all, :limit => count, :order => "created_on DESC") |
|
118 | visible(user).find(:all, :limit => count, :order => "created_on DESC") | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
|
121 | # Returns true if the project is visible to +user+ or to the current user. | |||
|
122 | def visible?(user=User.current) | |||
|
123 | user.allowed_to?(:view_project, self) | |||
|
124 | end | |||
|
125 | ||||
121 | def self.visible_by(user=nil) |
|
126 | def self.visible_by(user=nil) | |
122 | ActiveSupport::Deprecation.warn "Project.visible_by is deprecated and will be removed in Redmine 1.3.0. Use Project.visible_condition instead." |
|
127 | ActiveSupport::Deprecation.warn "Project.visible_by is deprecated and will be removed in Redmine 1.3.0. Use Project.visible_condition instead." | |
123 | visible_condition(user || User.current) |
|
128 | visible_condition(user || User.current) |
@@ -5,7 +5,7 api.array :projects, api_meta(:total_count => @project_count, :offset => @offset | |||||
5 | api.name project.name |
|
5 | api.name project.name | |
6 | api.identifier project.identifier |
|
6 | api.identifier project.identifier | |
7 | api.description project.description |
|
7 | api.description project.description | |
8 |
api.parent(:id => project.parent |
|
8 | api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible? | |
9 |
|
9 | |||
10 | render_api_custom_values project.visible_custom_field_values, api |
|
10 | render_api_custom_values project.visible_custom_field_values, api | |
11 |
|
11 |
@@ -4,6 +4,7 api.project do | |||||
4 | api.identifier @project.identifier |
|
4 | api.identifier @project.identifier | |
5 | api.description @project.description |
|
5 | api.description @project.description | |
6 | api.homepage @project.homepage |
|
6 | api.homepage @project.homepage | |
|
7 | api.parent(:id => @project.parent.id, :name => @project.parent.name) if @project.parent && @project.parent.visible? | |||
7 |
|
8 | |||
8 | render_api_custom_values @project.visible_custom_field_values, api |
|
9 | render_api_custom_values @project.visible_custom_field_values, api | |
9 |
|
10 |
General Comments 0
You need to be logged in to leave comments.
Login now