[refs #2249] Some ACL changes
This commit is contained in:
parent
e45ba6692a
commit
6d8e4f98b9
2
Gemfile
2
Gemfile
|
@ -32,6 +32,8 @@ gem 'delayed_job'
|
||||||
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
|
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
|
||||||
gem "rails-xmlrpc", '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git'
|
gem "rails-xmlrpc", '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git'
|
||||||
|
|
||||||
|
gem 'rails3-jquery-autocomplete'
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
gem "airbrake", '~> 3.0.5'
|
gem "airbrake", '~> 3.0.5'
|
||||||
# gem 'newrelic_rpm', '~> 3.1.1'
|
# gem 'newrelic_rpm', '~> 3.1.1'
|
||||||
|
|
|
@ -145,6 +145,8 @@ GEM
|
||||||
rails-xmlrpc (0.3.6)
|
rails-xmlrpc (0.3.6)
|
||||||
rails3-generators (0.17.4)
|
rails3-generators (0.17.4)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
|
rails3-jquery-autocomplete (1.0.4)
|
||||||
|
rails (~> 3.0)
|
||||||
railties (3.0.11)
|
railties (3.0.11)
|
||||||
actionpack (= 3.0.11)
|
actionpack (= 3.0.11)
|
||||||
activesupport (= 3.0.11)
|
activesupport (= 3.0.11)
|
||||||
|
@ -225,6 +227,7 @@ DEPENDENCIES
|
||||||
rails (= 3.0.11)
|
rails (= 3.0.11)
|
||||||
rails-xmlrpc (~> 0.3.6)
|
rails-xmlrpc (~> 0.3.6)
|
||||||
rails3-generators
|
rails3-generators
|
||||||
|
rails3-jquery-autocomplete
|
||||||
rr
|
rr
|
||||||
rspec-rails (~> 2.7.0)
|
rspec-rails (~> 2.7.0)
|
||||||
ruby-debug
|
ruby-debug
|
||||||
|
|
|
@ -5,6 +5,7 @@ class PlatformsController < ApplicationController
|
||||||
before_filter :get_paths, :only => [:new, :create, :clone]
|
before_filter :get_paths, :only => [:new, :create, :clone]
|
||||||
|
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
autocomplete :user, :uname
|
||||||
|
|
||||||
def build_all
|
def build_all
|
||||||
@platform.repositories.each do |repository|
|
@platform.repositories.each do |repository|
|
||||||
|
|
|
@ -6,6 +6,7 @@ class Product < ActiveRecord::Base
|
||||||
|
|
||||||
after_validation :merge_tar_errors
|
after_validation :merge_tar_errors
|
||||||
before_save :destroy_tar?
|
before_save :destroy_tar?
|
||||||
|
after_create :add_admin_relations
|
||||||
|
|
||||||
has_attached_file :tar
|
has_attached_file :tar
|
||||||
|
|
||||||
|
@ -76,4 +77,11 @@ class Product < ActiveRecord::Base
|
||||||
errors[:tar_content_type] = []
|
errors[:tar_content_type] = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_admin_relations
|
||||||
|
repository.relations.where(:role => 'admin').each do |rel|
|
||||||
|
r = relations.build(:role => 'admin', :object_id => rel.object_id, :object_type => rel.object_type)
|
||||||
|
r.save
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,7 @@ class Repository < ActiveRecord::Base
|
||||||
|
|
||||||
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
|
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
|
||||||
before_destroy :xml_rpc_destroy
|
before_destroy :xml_rpc_destroy
|
||||||
|
after_create :add_admin_relation
|
||||||
|
|
||||||
attr_accessible :description, :name #, :platform_id
|
attr_accessible :description, :name #, :platform_id
|
||||||
|
|
||||||
|
@ -50,4 +51,11 @@ class Repository < ActiveRecord::Base
|
||||||
raise "Failed to delete repository #{name} inside platform #{platform.name}."
|
raise "Failed to delete repository #{name} inside platform #{platform.name}."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_admin_relations
|
||||||
|
platform.relations.where(:role => 'admin').each do |rel|
|
||||||
|
r = relations.build(:role => 'admin', :object_id => rel.object_id, :object_type => rel.object_type)
|
||||||
|
r.save
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,10 @@
|
||||||
= f.label :released, :class => :label
|
= f.label :released, :class => :label
|
||||||
= f.check_box :released, :class => 'check_box'
|
= f.check_box :released, :class => 'check_box'
|
||||||
|
|
||||||
|
.group
|
||||||
|
= label_tag "ID Хозяина", :class => :label
|
||||||
|
= autocomplete_field_tag 'admin_id', '', user_name_autocomplete_path, :class => 'text_field'
|
||||||
|
|
||||||
.group.navform.wat-cf
|
.group.navform.wat-cf
|
||||||
%button.button{:type => "submit"}
|
%button.button{:type => "submit"}
|
||||||
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.save"))
|
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.save"))
|
||||||
|
|
|
@ -48,6 +48,7 @@ Rosa::Application.routes.draw do
|
||||||
|
|
||||||
collection do
|
collection do
|
||||||
get 'easy_urpmi'
|
get 'easy_urpmi'
|
||||||
|
get :autocomplete_user_uname
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :products do
|
resources :products do
|
||||||
|
|
Loading…
Reference in New Issue