Commit b8b6515f authored by miks's avatar miks

Renamed project "keys" back to "deploy_keys"

parent 99b8b577
...@@ -12,28 +12,28 @@ class DeployKeysController < ApplicationController ...@@ -12,28 +12,28 @@ class DeployKeysController < ApplicationController
end end
def index def index
@keys = @project.keys.all @keys = @project.deploy_keys.all
end end
def show def show
@key = @project.keys.find(params[:id]) @key = @project.deploy_keys.find(params[:id])
end end
def new def new
@key = @project.keys.new @key = @project.deploy_keys.new
respond_with(@key) respond_with(@key)
end end
def create def create
@key = @project.keys.new(params[:key]) @key = @project.deploy_keys.new(params[:key])
@key.save @key.save
respond_with(@key) respond_with(@key)
end end
def destroy def destroy
@key = @project.keys.find(params[:id]) @key = @project.deploy_keys.find(params[:id])
@key.destroy @key.destroy
respond_to do |format| respond_to do |format|
......
...@@ -14,7 +14,7 @@ class Project < ActiveRecord::Base ...@@ -14,7 +14,7 @@ class Project < ActiveRecord::Base
has_many :users, :through => :users_projects has_many :users, :through => :users_projects
has_many :notes, :dependent => :destroy has_many :notes, :dependent => :destroy
has_many :snippets, :dependent => :destroy has_many :snippets, :dependent => :destroy
has_many :keys, :dependent => :destroy has_many :deploy_keys, :dependent => :destroy, :foreign_key => "project_id", :class_name => "Key"
has_many :web_hooks, :dependent => :destroy has_many :web_hooks, :dependent => :destroy
acts_as_taggable acts_as_taggable
...@@ -189,15 +189,15 @@ class Project < ActiveRecord::Base ...@@ -189,15 +189,15 @@ class Project < ActiveRecord::Base
end end
def repository_readers def repository_readers
read_keys = Key.joins({:user => :users_projects}). keys = Key.joins({:user => :users_projects}).
where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_R) where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_R)
read_keys.map(&:identifier) + keys.map(&:identifier) keys.map(&:identifier) + deploy_keys.map(&:identifier)
end end
def repository_writers def repository_writers
write_keys = Key.joins({:user => :users_projects}). keys = Key.joins({:user => :users_projects}).
where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_RW) where("users_projects.project_id = ? AND users_projects.repo_access = ?", id, Repository::REPO_RW)
write_keys.map(&:identifier) keys.map(&:identifier)
end end
def readers def readers
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment