fix filters & seeds
This commit is contained in:
parent
03e51c3058
commit
8f4a0bd174
4 changed files with 21 additions and 20 deletions
|
@ -8,7 +8,7 @@ class ProjectsController < ApplicationController
|
||||||
before_filter :add_project_abilities
|
before_filter :add_project_abilities
|
||||||
before_filter :authorize_read_project!, :except => [:index, :new, :create]
|
before_filter :authorize_read_project!, :except => [:index, :new, :create]
|
||||||
before_filter :authorize_admin_project!, :only => [:edit, :update, :destroy]
|
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
|
before_filter :load_refs, :only => :tree # load @branch, @tag & @ref
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
class RefsController < ApplicationController
|
class RefsController < ApplicationController
|
||||||
before_filter :project
|
before_filter :project
|
||||||
before_filter :ref
|
|
||||||
before_filter :define_tree_vars, :only => [:tree, :blob]
|
|
||||||
layout "project"
|
|
||||||
|
|
||||||
# Authorize
|
# Authorize
|
||||||
before_filter :add_project_abilities
|
before_filter :add_project_abilities
|
||||||
before_filter :authorize_read_project!
|
before_filter :authorize_read_project!
|
||||||
before_filter :require_non_empty_project
|
before_filter :require_non_empty_project
|
||||||
|
|
||||||
|
before_filter :ref
|
||||||
|
before_filter :define_tree_vars, :only => [:tree, :blob]
|
||||||
|
layout "project"
|
||||||
|
|
||||||
def switch
|
def switch
|
||||||
new_path = if params[:destination] == "tree"
|
new_path = if params[:destination] == "tree"
|
||||||
tree_project_ref_path(@project, params[:ref])
|
tree_project_ref_path(@project, params[:ref])
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Project < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def repo_name
|
def repo_name
|
||||||
if path == "gitosis-admin"
|
if path == "gitosis-admin" && path == "gitolite-admin"
|
||||||
errors.add(:path, " like 'gitosis-admin' is not allowed")
|
errors.add(:path, " like 'gitosis-admin' is not allowed")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
UsersProject.seed(:id, [
|
UsersProject.seed(:id, [
|
||||||
{ :id => 1, :project_id => 1, :user_id => 1},
|
{ :id => 1, :project_id => 1, :user_id => 1, :read => true, :write => true, :admin => true },
|
||||||
{ :id => 2, :project_id => 1, :user_id => 2},
|
{ :id => 2, :project_id => 1, :user_id => 2, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 3, :project_id => 1, :user_id => 3},
|
{ :id => 3, :project_id => 1, :user_id => 3, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 4, :project_id => 1, :user_id => 4},
|
{ :id => 4, :project_id => 1, :user_id => 4, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 5, :project_id => 1, :user_id => 5},
|
{ :id => 5, :project_id => 1, :user_id => 5, :read => true, :write => false, :admin => false },
|
||||||
|
|
||||||
{ :id => 6, :project_id => 2, :user_id => 1},
|
{ :id => 6, :project_id => 2, :user_id => 1, :read => true, :write => true, :admin => true },
|
||||||
{ :id => 7, :project_id => 2, :user_id => 2},
|
{ :id => 7, :project_id => 2, :user_id => 2, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 8, :project_id => 2, :user_id => 3},
|
{ :id => 8, :project_id => 2, :user_id => 3, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 9, :project_id => 2, :user_id => 4},
|
{ :id => 9, :project_id => 2, :user_id => 4, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 11, :project_id => 2, :user_id => 5},
|
{ :id => 11, :project_id => 2, :user_id => 5, :read => true, :write => false, :admin => false },
|
||||||
|
|
||||||
{ :id => 12, :project_id => 3, :user_id => 1},
|
{ :id => 12, :project_id => 3, :user_id => 1, :read => true, :write => true, :admin => true },
|
||||||
{ :id => 13, :project_id => 3, :user_id => 2},
|
{ :id => 13, :project_id => 3, :user_id => 2, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 14, :project_id => 3, :user_id => 3},
|
{ :id => 14, :project_id => 3, :user_id => 3, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 15, :project_id => 3, :user_id => 4},
|
{ :id => 15, :project_id => 3, :user_id => 4, :read => true, :write => false, :admin => false },
|
||||||
{ :id => 16, :project_id => 3, :user_id => 5}
|
{ :id => 16, :project_id => 3, :user_id => 5, :read => true, :write => false, :admin => false }
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue