fix filters & seeds

This commit is contained in:
Dmitriy Zaporozhets 2011-12-04 22:34:39 +02:00
parent 03e51c3058
commit 8f4a0bd174
4 changed files with 21 additions and 20 deletions

View file

@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
before_filter :add_project_abilities
before_filter :authorize_read_project!, :except => [:index, :new, :create]
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
before_filter :require_non_empty_project, :only => [:blob, :tree]
before_filter :require_non_empty_project, :only => [:blob, :tree, :graph]
before_filter :load_refs, :only => :tree # load @branch, @tag & @ref
def index

View file

@ -1,14 +1,15 @@
class RefsController < ApplicationController
before_filter :project
before_filter :ref
before_filter :define_tree_vars, :only => [:tree, :blob]
layout "project"
# Authorize
before_filter :add_project_abilities
before_filter :authorize_read_project!
before_filter :require_non_empty_project
before_filter :ref
before_filter :define_tree_vars, :only => [:tree, :blob]
layout "project"
def switch
new_path = if params[:destination] == "tree"
tree_project_ref_path(@project, params[:ref])

View file

@ -180,7 +180,7 @@ class Project < ActiveRecord::Base
end
def repo_name
if path == "gitosis-admin"
if path == "gitosis-admin" && path == "gitolite-admin"
errors.add(:path, " like 'gitosis-admin' is not allowed")
end
end

View file

@ -1,21 +1,21 @@
UsersProject.seed(:id, [
{ :id => 1, :project_id => 1, :user_id => 1},
{ :id => 2, :project_id => 1, :user_id => 2},
{ :id => 3, :project_id => 1, :user_id => 3},
{ :id => 4, :project_id => 1, :user_id => 4},
{ :id => 5, :project_id => 1, :user_id => 5},
{ :id => 1, :project_id => 1, :user_id => 1, :read => true, :write => true, :admin => true },
{ :id => 2, :project_id => 1, :user_id => 2, :read => true, :write => false, :admin => false },
{ :id => 3, :project_id => 1, :user_id => 3, :read => true, :write => false, :admin => false },
{ :id => 4, :project_id => 1, :user_id => 4, :read => true, :write => false, :admin => false },
{ :id => 5, :project_id => 1, :user_id => 5, :read => true, :write => false, :admin => false },
{ :id => 6, :project_id => 2, :user_id => 1},
{ :id => 7, :project_id => 2, :user_id => 2},
{ :id => 8, :project_id => 2, :user_id => 3},
{ :id => 9, :project_id => 2, :user_id => 4},
{ :id => 11, :project_id => 2, :user_id => 5},
{ :id => 6, :project_id => 2, :user_id => 1, :read => true, :write => true, :admin => true },
{ :id => 7, :project_id => 2, :user_id => 2, :read => true, :write => false, :admin => false },
{ :id => 8, :project_id => 2, :user_id => 3, :read => true, :write => false, :admin => false },
{ :id => 9, :project_id => 2, :user_id => 4, :read => true, :write => false, :admin => false },
{ :id => 11, :project_id => 2, :user_id => 5, :read => true, :write => false, :admin => false },
{ :id => 12, :project_id => 3, :user_id => 1},
{ :id => 13, :project_id => 3, :user_id => 2},
{ :id => 14, :project_id => 3, :user_id => 3},
{ :id => 15, :project_id => 3, :user_id => 4},
{ :id => 16, :project_id => 3, :user_id => 5}
{ :id => 12, :project_id => 3, :user_id => 1, :read => true, :write => true, :admin => true },
{ :id => 13, :project_id => 3, :user_id => 2, :read => true, :write => false, :admin => false },
{ :id => 14, :project_id => 3, :user_id => 3, :read => true, :write => false, :admin => false },
{ :id => 15, :project_id => 3, :user_id => 4, :read => true, :write => false, :admin => false },
{ :id => 16, :project_id => 3, :user_id => 5, :read => true, :write => false, :admin => false }
])