Commit d0efe2c07cdbd13698bfb70f9be7157ec4f7245b

Authored by Dmitriy Zaporozhets
1 parent b1dbabde

Since masters_projects does not cover most of cases now we use authorized_projec…

…ts for DeployKey read access
Showing 1 changed file with 1 additions and 3 deletions   Show diff stats
app/models/user.rb
@@ -91,8 +91,6 @@ class User < ActiveRecord::Base @@ -91,8 +91,6 @@ class User < ActiveRecord::Base
91 has_many :groups_projects, through: :groups, source: :projects 91 has_many :groups_projects, through: :groups, source: :projects
92 has_many :personal_projects, through: :namespace, source: :projects 92 has_many :personal_projects, through: :namespace, source: :projects
93 has_many :projects, through: :users_projects 93 has_many :projects, through: :users_projects
94 - has_many :master_projects, through: :users_projects, source: :project,  
95 - conditions: { users_projects: { project_access: UsersProject::MASTER } }  
96 has_many :own_projects, foreign_key: :creator_id, class_name: 'Project' 94 has_many :own_projects, foreign_key: :creator_id, class_name: 'Project'
97 has_many :owned_projects, through: :namespaces, source: :projects 95 has_many :owned_projects, through: :namespaces, source: :projects
98 96
@@ -355,7 +353,7 @@ class User < ActiveRecord::Base @@ -355,7 +353,7 @@ class User < ActiveRecord::Base
355 end 353 end
356 354
357 def accessible_deploy_keys 355 def accessible_deploy_keys
358 - DeployKey.in_projects(self.master_projects).uniq 356 + DeployKey.in_projects(self.authorized_projects).uniq
359 end 357 end
360 358
361 def created_by 359 def created_by