Commit 193a5624b2daf4d638c382b88001d06535f57f2d
1 parent
563c55eb
Exists in
master
and in
4 other branches
add path and path_with_namespace to api project entity
Showing
17 changed files
with
134 additions
and
5 deletions
Show diff stats
app/models/project.rb
| @@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
| 8 | # description :text | 8 | # description :text |
| 9 | # created_at :datetime not null | 9 | # created_at :datetime not null |
| 10 | # updated_at :datetime not null | 10 | # updated_at :datetime not null |
| 11 | -# private_flag :boolean default(TRUE), not null | ||
| 12 | # creator_id :integer | 11 | # creator_id :integer |
| 13 | # default_branch :string(255) | 12 | # default_branch :string(255) |
| 14 | # issues_enabled :boolean default(TRUE), not null | 13 | # issues_enabled :boolean default(TRUE), not null |
| @@ -16,6 +15,7 @@ | @@ -16,6 +15,7 @@ | ||
| 16 | # merge_requests_enabled :boolean default(TRUE), not null | 15 | # merge_requests_enabled :boolean default(TRUE), not null |
| 17 | # wiki_enabled :boolean default(TRUE), not null | 16 | # wiki_enabled :boolean default(TRUE), not null |
| 18 | # namespace_id :integer | 17 | # namespace_id :integer |
| 18 | +# public :boolean default(FALSE), not null | ||
| 19 | # | 19 | # |
| 20 | 20 | ||
| 21 | require "grit" | 21 | require "grit" |
app/models/user.rb
| @@ -31,6 +31,8 @@ | @@ -31,6 +31,8 @@ | ||
| 31 | # extern_uid :string(255) | 31 | # extern_uid :string(255) |
| 32 | # provider :string(255) | 32 | # provider :string(255) |
| 33 | # username :string(255) | 33 | # username :string(255) |
| 34 | +# can_create_group :boolean default(TRUE), not null | ||
| 35 | +# can_create_team :boolean default(TRUE), not null | ||
| 34 | # | 36 | # |
| 35 | 37 | ||
| 36 | class User < ActiveRecord::Base | 38 | class User < ActiveRecord::Base |
app/models/user_team.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_teams | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# name :string(255) | ||
| 7 | +# path :string(255) | ||
| 8 | +# owner_id :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | class UserTeam < ActiveRecord::Base | 13 | class UserTeam < ActiveRecord::Base |
| 2 | attr_accessible :name, :owner_id, :path | 14 | attr_accessible :name, :owner_id, :path |
| 3 | 15 |
app/models/user_team_project_relationship.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_project_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# project_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# greatest_access :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | class UserTeamProjectRelationship < ActiveRecord::Base | 13 | class UserTeamProjectRelationship < ActiveRecord::Base |
| 2 | attr_accessible :greatest_access, :project_id, :user_team_id | 14 | attr_accessible :greatest_access, :project_id, :user_team_id |
| 3 | 15 |
app/models/user_team_user_relationship.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_user_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# user_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# group_admin :boolean | ||
| 9 | +# permission :integer | ||
| 10 | +# created_at :datetime not null | ||
| 11 | +# updated_at :datetime not null | ||
| 12 | +# | ||
| 13 | + | ||
| 1 | class UserTeamUserRelationship < ActiveRecord::Base | 14 | class UserTeamUserRelationship < ActiveRecord::Base |
| 2 | attr_accessible :group_admin, :permission, :user_id, :user_team_id | 15 | attr_accessible :group_admin, :permission, :user_id, :user_team_id |
| 3 | 16 |
db/migrate/20130131070232_remove_private_flag_from_project.rb
0 → 100644
db/schema.rb
| @@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
| 11 | # | 11 | # |
| 12 | # It's strongly recommended to check this file into your version control system. | 12 | # It's strongly recommended to check this file into your version control system. |
| 13 | 13 | ||
| 14 | -ActiveRecord::Schema.define(:version => 20130125090214) do | 14 | +ActiveRecord::Schema.define(:version => 20130131070232) do |
| 15 | 15 | ||
| 16 | create_table "events", :force => true do |t| | 16 | create_table "events", :force => true do |t| |
| 17 | t.string "target_type" | 17 | t.string "target_type" |
| @@ -147,7 +147,6 @@ ActiveRecord::Schema.define(:version => 20130125090214) do | @@ -147,7 +147,6 @@ ActiveRecord::Schema.define(:version => 20130125090214) do | ||
| 147 | t.text "description" | 147 | t.text "description" |
| 148 | t.datetime "created_at", :null => false | 148 | t.datetime "created_at", :null => false |
| 149 | t.datetime "updated_at", :null => false | 149 | t.datetime "updated_at", :null => false |
| 150 | - t.boolean "private_flag", :default => true, :null => false | ||
| 151 | t.integer "creator_id" | 150 | t.integer "creator_id" |
| 152 | t.string "default_branch" | 151 | t.string "default_branch" |
| 153 | t.boolean "issues_enabled", :default => true, :null => false | 152 | t.boolean "issues_enabled", :default => true, :null => false |
doc/api/projects.md
| @@ -22,6 +22,8 @@ GET /projects | @@ -22,6 +22,8 @@ GET /projects | ||
| 22 | "created_at": "2012-05-23T08:00:58Z" | 22 | "created_at": "2012-05-23T08:00:58Z" |
| 23 | }, | 23 | }, |
| 24 | "private": true, | 24 | "private": true, |
| 25 | + "path": "rails", | ||
| 26 | + "path_with_namespace": "rails/rails", | ||
| 25 | "issues_enabled": false, | 27 | "issues_enabled": false, |
| 26 | "merge_requests_enabled": false, | 28 | "merge_requests_enabled": false, |
| 27 | "wall_enabled": true, | 29 | "wall_enabled": true, |
| @@ -42,6 +44,8 @@ GET /projects | @@ -42,6 +44,8 @@ GET /projects | ||
| 42 | "created_at": "2012-05-23T08:00:58Z" | 44 | "created_at": "2012-05-23T08:00:58Z" |
| 43 | }, | 45 | }, |
| 44 | "private": true, | 46 | "private": true, |
| 47 | + "path": "gitlab", | ||
| 48 | + "path_with_namespace": "randx/gitlab", | ||
| 45 | "issues_enabled": true, | 49 | "issues_enabled": true, |
| 46 | "merge_requests_enabled": true, | 50 | "merge_requests_enabled": true, |
| 47 | "wall_enabled": true, | 51 | "wall_enabled": true, |
| @@ -78,6 +82,8 @@ Parameters: | @@ -78,6 +82,8 @@ Parameters: | ||
| 78 | "created_at": "2012-05-23T08:00:58Z" | 82 | "created_at": "2012-05-23T08:00:58Z" |
| 79 | }, | 83 | }, |
| 80 | "private": true, | 84 | "private": true, |
| 85 | + "path": "gitlab", | ||
| 86 | + "path_with_namespace": "randx/gitlab", | ||
| 81 | "issues_enabled": true, | 87 | "issues_enabled": true, |
| 82 | "merge_requests_enabled": true, | 88 | "merge_requests_enabled": true, |
| 83 | "wall_enabled": true, | 89 | "wall_enabled": true, |
lib/api/entities.rb
| @@ -21,6 +21,7 @@ module Gitlab | @@ -21,6 +21,7 @@ module Gitlab | ||
| 21 | expose :id, :name, :description, :default_branch | 21 | expose :id, :name, :description, :default_branch |
| 22 | expose :owner, using: Entities::UserBasic | 22 | expose :owner, using: Entities::UserBasic |
| 23 | expose :private_flag, as: :private | 23 | expose :private_flag, as: :private |
| 24 | + expose :path, :path_with_namespace | ||
| 24 | expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at | 25 | expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at |
| 25 | expose :namespace | 26 | expose :namespace |
| 26 | end | 27 | end |
spec/factories/user_team_project_relationships.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_project_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# project_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# greatest_access :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | # Read about factories at https://github.com/thoughtbot/factory_girl | 13 | # Read about factories at https://github.com/thoughtbot/factory_girl |
| 2 | 14 | ||
| 3 | FactoryGirl.define do | 15 | FactoryGirl.define do |
spec/factories/user_team_user_relationships.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_user_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# user_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# group_admin :boolean | ||
| 9 | +# permission :integer | ||
| 10 | +# created_at :datetime not null | ||
| 11 | +# updated_at :datetime not null | ||
| 12 | +# | ||
| 13 | + | ||
| 1 | # Read about factories at https://github.com/thoughtbot/factory_girl | 14 | # Read about factories at https://github.com/thoughtbot/factory_girl |
| 2 | 15 | ||
| 3 | FactoryGirl.define do | 16 | FactoryGirl.define do |
spec/factories/user_teams.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_teams | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# name :string(255) | ||
| 7 | +# path :string(255) | ||
| 8 | +# owner_id :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | # Read about factories at https://github.com/thoughtbot/factory_girl | 13 | # Read about factories at https://github.com/thoughtbot/factory_girl |
| 2 | 14 | ||
| 3 | FactoryGirl.define do | 15 | FactoryGirl.define do |
spec/models/project_spec.rb
| @@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
| 8 | # description :text | 8 | # description :text |
| 9 | # created_at :datetime not null | 9 | # created_at :datetime not null |
| 10 | # updated_at :datetime not null | 10 | # updated_at :datetime not null |
| 11 | -# private_flag :boolean default(TRUE), not null | ||
| 12 | # creator_id :integer | 11 | # creator_id :integer |
| 13 | # default_branch :string(255) | 12 | # default_branch :string(255) |
| 14 | # issues_enabled :boolean default(TRUE), not null | 13 | # issues_enabled :boolean default(TRUE), not null |
| @@ -16,6 +15,7 @@ | @@ -16,6 +15,7 @@ | ||
| 16 | # merge_requests_enabled :boolean default(TRUE), not null | 15 | # merge_requests_enabled :boolean default(TRUE), not null |
| 17 | # wiki_enabled :boolean default(TRUE), not null | 16 | # wiki_enabled :boolean default(TRUE), not null |
| 18 | # namespace_id :integer | 17 | # namespace_id :integer |
| 18 | +# public :boolean default(FALSE), not null | ||
| 19 | # | 19 | # |
| 20 | 20 | ||
| 21 | require 'spec_helper' | 21 | require 'spec_helper' |
| @@ -42,7 +42,6 @@ describe Project do | @@ -42,7 +42,6 @@ describe Project do | ||
| 42 | describe "Mass assignment" do | 42 | describe "Mass assignment" do |
| 43 | it { should_not allow_mass_assignment_of(:namespace_id) } | 43 | it { should_not allow_mass_assignment_of(:namespace_id) } |
| 44 | it { should_not allow_mass_assignment_of(:creator_id) } | 44 | it { should_not allow_mass_assignment_of(:creator_id) } |
| 45 | - it { should_not allow_mass_assignment_of(:private_flag) } | ||
| 46 | end | 45 | end |
| 47 | 46 | ||
| 48 | describe "Validation" do | 47 | describe "Validation" do |
spec/models/user_spec.rb
| @@ -31,6 +31,8 @@ | @@ -31,6 +31,8 @@ | ||
| 31 | # extern_uid :string(255) | 31 | # extern_uid :string(255) |
| 32 | # provider :string(255) | 32 | # provider :string(255) |
| 33 | # username :string(255) | 33 | # username :string(255) |
| 34 | +# can_create_group :boolean default(TRUE), not null | ||
| 35 | +# can_create_team :boolean default(TRUE), not null | ||
| 34 | # | 36 | # |
| 35 | 37 | ||
| 36 | require 'spec_helper' | 38 | require 'spec_helper' |
spec/models/user_team_project_relationship_spec.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_project_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# project_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# greatest_access :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | require 'spec_helper' | 13 | require 'spec_helper' |
| 2 | 14 | ||
| 3 | describe UserTeamProjectRelationship do | 15 | describe UserTeamProjectRelationship do |
spec/models/user_team_spec.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_teams | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# name :string(255) | ||
| 7 | +# path :string(255) | ||
| 8 | +# owner_id :integer | ||
| 9 | +# created_at :datetime not null | ||
| 10 | +# updated_at :datetime not null | ||
| 11 | +# | ||
| 12 | + | ||
| 1 | require 'spec_helper' | 13 | require 'spec_helper' |
| 2 | 14 | ||
| 3 | describe UserTeam do | 15 | describe UserTeam do |
spec/models/user_team_user_relationship_spec.rb
| 1 | +# == Schema Information | ||
| 2 | +# | ||
| 3 | +# Table name: user_team_user_relationships | ||
| 4 | +# | ||
| 5 | +# id :integer not null, primary key | ||
| 6 | +# user_id :integer | ||
| 7 | +# user_team_id :integer | ||
| 8 | +# group_admin :boolean | ||
| 9 | +# permission :integer | ||
| 10 | +# created_at :datetime not null | ||
| 11 | +# updated_at :datetime not null | ||
| 12 | +# | ||
| 13 | + | ||
| 1 | require 'spec_helper' | 14 | require 'spec_helper' |
| 2 | 15 | ||
| 3 | describe UserTeamUserRelationship do | 16 | describe UserTeamUserRelationship do |