Fixed bug with user registration and changed hardcoded 'mandriva2011'
This commit is contained in:
parent
afc1d492a8
commit
5fb704d3c5
|
@ -10,7 +10,7 @@ class PlatformsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def easy_urpmi
|
def easy_urpmi
|
||||||
@platforms = Platform.where(:distrib_type => 'mandriva2011', :visibility => 'open', :platform_type => 'main')
|
@platforms = Platform.where(:distrib_type => APP_CONFIG['distr_type'].first, :visibility => 'open', :platform_type => 'main')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
render :json => {
|
render :json => {
|
||||||
|
|
|
@ -12,7 +12,7 @@ module PersonalRepository
|
||||||
pl.name = "#{self.uname}_personal"
|
pl.name = "#{self.uname}_personal"
|
||||||
pl.unixname = "#{self.uname}_personal"
|
pl.unixname = "#{self.uname}_personal"
|
||||||
pl.platform_type = 'personal'
|
pl.platform_type = 'personal'
|
||||||
pl.distrib_type = 'mandriva2011'
|
pl.distrib_type = APP_CONFIG['distr_types'].first
|
||||||
pl.visibility = 'open'
|
pl.visibility = 'open'
|
||||||
pl.save!
|
pl.save!
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ class Platform < ActiveRecord::Base
|
||||||
|
|
||||||
#attr_accessible :visibility
|
#attr_accessible :visibility
|
||||||
|
|
||||||
|
|
||||||
def path
|
def path
|
||||||
build_path(unixname)
|
build_path(unixname)
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,6 +20,7 @@ class Repository < ActiveRecord::Base
|
||||||
after_create :make_owner_rel
|
after_create :make_owner_rel
|
||||||
before_save :check_owner_rel
|
before_save :check_owner_rel
|
||||||
#before_save :create_directory
|
#before_save :create_directory
|
||||||
|
#before_save :add_owner_rel
|
||||||
#after_destroy :remove_directory
|
#after_destroy :remove_directory
|
||||||
before_create :xml_rpc_create
|
before_create :xml_rpc_create
|
||||||
before_destroy :xml_rpc_destroy
|
before_destroy :xml_rpc_destroy
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Role < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_owner_default
|
def check_owner_default
|
||||||
self[:use_default_for_owner] = false if use_default_for_owner and (to.nil? || to == '')
|
self[:use_default_for_owner] = false if use_default_for_owner and (on.nil? || on == '')
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class User < ActiveRecord::Base
|
||||||
attr_readonly :uname
|
attr_readonly :uname
|
||||||
attr_accessor :login
|
attr_accessor :login
|
||||||
|
|
||||||
after_create :add_default_role
|
before_create :add_default_role
|
||||||
|
|
||||||
before_update {
|
before_update {
|
||||||
if ssh_key_was.blank? and ssh_key.present?
|
if ssh_key_was.blank? and ssh_key.present?
|
||||||
|
|
|
@ -106,14 +106,16 @@ class ActiveRecord::Base
|
||||||
def add_owner owner
|
def add_owner owner
|
||||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||||
return false unless ActiveRecord::Base.relation_target? self.class
|
return false unless ActiveRecord::Base.relation_target? self.class
|
||||||
roles = Role.by_acter(owner.class).by_target(self.class).owner_default
|
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||||
|
Role.by_acter(:all).by_target(self.class).owner_default
|
||||||
add_roles_to owner, roles
|
add_roles_to owner, roles
|
||||||
end
|
end
|
||||||
|
|
||||||
def remove_owner owner
|
def remove_owner owner
|
||||||
return false unless ActiveRecord::Base.relation_acter? owner.class
|
return false unless ActiveRecord::Base.relation_acter? owner.class
|
||||||
return false unless ActiveRecord::Base.relation_target? self.class
|
return false unless ActiveRecord::Base.relation_target? self.class
|
||||||
roles = Role.by_acter(owner.class).by_target(self.class).owner_default
|
roles = Role.by_acter(owner.class).by_target(self.class).owner_default +
|
||||||
|
Role.by_acter(:all).by_target(self.class).owner_default
|
||||||
remove_roles_form_acter owner, roles
|
remove_roles_form_acter owner, roles
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue