Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
5d8ca6e6
Commit
5d8ca6e6
authored
11 years ago
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated models
parent
3b0d7a30
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
198 deletions
+0
-198
app/models/deprecated/user_team.rb
app/models/deprecated/user_team.rb
+0
-118
app/models/deprecated/user_team_project_relationship.rb
app/models/deprecated/user_team_project_relationship.rb
+0
-46
app/models/deprecated/user_team_user_relationship.rb
app/models/deprecated/user_team_user_relationship.rb
+0
-34
No files found.
app/models/deprecated/user_team.rb
deleted
100644 → 0
View file @
3b0d7a30
# Will be removed in 6.1 with tables
#
# == Schema Information
#
# Table name: user_teams
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# owner_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# description :string(255) default(""), not null
#
class
UserTeam
<
ActiveRecord
::
Base
attr_accessible
:name
,
:description
,
:owner_id
,
:path
belongs_to
:owner
,
class_name:
User
has_many
:user_team_project_relationships
,
dependent: :destroy
has_many
:user_team_user_relationships
,
dependent: :destroy
has_many
:projects
,
through: :user_team_project_relationships
has_many
:members
,
through: :user_team_user_relationships
,
source: :user
validates
:owner
,
presence:
true
validates
:name
,
presence:
true
,
uniqueness:
true
,
length:
{
within:
0
..
255
},
format:
{
with:
Gitlab
::
Regex
.
name_regex
,
message:
"only letters, digits, spaces & '_' '-' '.' allowed."
}
validates
:description
,
length:
{
within:
0
..
255
}
validates
:path
,
uniqueness:
true
,
presence:
true
,
length:
{
within:
1
..
255
},
format:
{
with:
Gitlab
::
Regex
.
path_regex
,
message:
"only letters, digits & '_' '-' '.' allowed. Letter should be first"
}
scope
:with_member
,
->
(
user
){
joins
(
:user_team_user_relationships
).
where
(
user_team_user_relationships:
{
user_id:
user
.
id
})
}
scope
:with_project
,
->
(
project
){
joins
(
:user_team_project_relationships
).
where
(
user_team_project_relationships:
{
project_id:
project
})}
scope
:without_project
,
->
(
project
){
where
(
"user_teams.id NOT IN (:ids)"
,
ids:
(
a
=
with_project
(
project
);
a
.
blank?
?
0
:
a
))}
scope
:created_by
,
->
(
user
){
where
(
owner_id:
user
)
}
class
<<
self
def
search
query
where
(
"name LIKE :query OR path LIKE :query"
,
query:
"%
#{
query
}
%"
)
end
def
global_id
'GLN'
end
def
access_roles
UsersProject
.
access_roles
end
end
def
to_param
path
end
def
assign_to_projects
(
projects
,
access
)
projects
.
each
do
|
project
|
assign_to_project
(
project
,
access
)
end
end
def
assign_to_project
(
project
,
access
)
Gitlab
::
UserTeamManager
.
assign
(
self
,
project
,
access
)
end
def
resign_from_project
(
project
)
Gitlab
::
UserTeamManager
.
resign
(
self
,
project
)
end
def
add_members
(
users
,
access
,
group_admin
)
# reject existing users
users
.
reject!
{
|
id
|
member_ids
.
include?
(
id
.
to_i
)
}
users
.
each
do
|
user
|
add_member
(
user
,
access
,
group_admin
)
end
end
def
add_member
(
user
,
access
,
group_admin
)
Gitlab
::
UserTeamManager
.
add_member_into_team
(
self
,
user
,
access
,
group_admin
)
end
def
remove_member
(
user
)
Gitlab
::
UserTeamManager
.
remove_member_from_team
(
self
,
user
)
end
def
update_membership
(
user
,
options
)
Gitlab
::
UserTeamManager
.
update_team_user_membership
(
self
,
user
,
options
)
end
def
update_project_access
(
project
,
permission
)
Gitlab
::
UserTeamManager
.
update_project_greates_access
(
self
,
project
,
permission
)
end
def
max_project_access
(
project
)
user_team_project_relationships
.
find_by_project_id
(
project
).
greatest_access
end
def
human_max_project_access
(
project
)
self
.
class
.
access_roles
.
invert
[
max_project_access
(
project
)]
end
def
default_projects_access
(
member
)
user_team_user_relationships
.
find_by_user_id
(
member
).
permission
end
def
human_default_projects_access
(
member
)
self
.
class
.
access_roles
.
invert
[
default_projects_access
(
member
)]
end
def
admin?
(
member
)
user_team_user_relationships
.
with_user
(
member
).
first
.
try
(
:group_admin?
)
end
end
This diff is collapsed.
Click to expand it.
app/models/deprecated/user_team_project_relationship.rb
deleted
100644 → 0
View file @
3b0d7a30
# Will be removed in 6.1 with tables
#
# == Schema Information
#
# Table name: user_team_project_relationships
#
# id :integer not null, primary key
# project_id :integer
# user_team_id :integer
# greatest_access :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class
UserTeamProjectRelationship
<
ActiveRecord
::
Base
attr_accessible
:greatest_access
,
:project_id
,
:user_team_id
belongs_to
:user_team
belongs_to
:project
validates
:project
,
presence:
true
validates
:user_team
,
presence:
true
validate
:check_greatest_access
scope
:with_project
,
->
(
project
){
where
(
project_id:
project
.
id
)
}
def
team_name
user_team
.
name
end
def
human_max_access
UserTeam
.
access_roles
.
key
(
greatest_access
)
end
private
def
check_greatest_access
errors
.
add
(
:base
,
:incorrect_access_code
)
unless
correct_access?
end
def
correct_access?
return
false
if
greatest_access
.
blank?
return
true
if
UsersProject
.
access_roles
.
has_value?
(
greatest_access
)
false
end
end
This diff is collapsed.
Click to expand it.
app/models/deprecated/user_team_user_relationship.rb
deleted
100644 → 0
View file @
3b0d7a30
# Will be removed in 6.1 with tables
#
# == Schema Information
#
# Table name: user_team_user_relationships
#
# id :integer not null, primary key
# user_id :integer
# user_team_id :integer
# group_admin :boolean
# permission :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class
UserTeamUserRelationship
<
ActiveRecord
::
Base
attr_accessible
:group_admin
,
:permission
,
:user_id
,
:user_team_id
belongs_to
:user_team
belongs_to
:user
validates
:user_team
,
presence:
true
validates
:user
,
presence:
true
scope
:with_user
,
->
(
user
)
{
where
(
user_id:
user
.
id
)
}
def
user_name
user
.
name
end
def
access_human
UsersProject
.
access_roles
.
invert
[
permission
]
end
end
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment