v1.1.0
This commit is contained in:
parent
6b030fd41d
commit
ba8048d710
15 changed files with 141 additions and 147 deletions
|
@ -35,7 +35,8 @@ class Project < ActiveRecord::Base
|
|||
:presence => true
|
||||
|
||||
validate :check_limit
|
||||
|
||||
validate :repo_name
|
||||
|
||||
after_destroy :destroy_gitosis_project
|
||||
after_save :update_gitosis_project
|
||||
|
||||
|
@ -168,6 +169,12 @@ class Project < ActiveRecord::Base
|
|||
errors[:base] << ("Cant check your ability to create project")
|
||||
end
|
||||
|
||||
def repo_name
|
||||
if path == "gitosis-admin"
|
||||
errors.add(:path, " like 'gitosis-admin' is not allowed")
|
||||
end
|
||||
end
|
||||
|
||||
def valid_repo?
|
||||
repo
|
||||
rescue
|
||||
|
|
|
@ -9,7 +9,8 @@ class UsersProject < ActiveRecord::Base
|
|||
validates_uniqueness_of :user_id, :scope => [:project_id]
|
||||
validates_presence_of :user_id
|
||||
validates_presence_of :project_id
|
||||
|
||||
validate :user_has_a_role_selected
|
||||
|
||||
delegate :name, :email, :to => :user, :prefix => true
|
||||
|
||||
def update_gitosis_project
|
||||
|
@ -18,6 +19,10 @@ class UsersProject < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def user_has_a_role_selected
|
||||
errors.add(:base, "Please choose at least one Role in the Access list") unless read || write || admin
|
||||
end
|
||||
|
||||
end
|
||||
# == Schema Information
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue