gitlabhq/app/models/group.rb

38 lines
851 B
Ruby
Raw Normal View History

2012-11-19 19:24:05 +01:00
# == Schema Information
#
2012-11-24 21:16:51 +01:00
# Table name: namespaces
2012-11-19 19:24:05 +01:00
#
2013-02-07 11:42:52 +01:00
# id :integer not null, primary key
# name :string(255) not null
# description :string(255) not null
# path :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255)
2012-11-19 19:24:05 +01:00
#
class Group < Namespace
def add_users_to_project_teams(user_ids, project_access)
UsersProject.add_users_into_projects(
projects.map(&:id),
user_ids,
project_access
)
end
2012-10-03 13:26:37 +02:00
def users
users = User.joins(:users_projects).where(users_projects: {project_id: project_ids})
users = users << owner
users.uniq
2012-10-03 13:26:37 +02:00
end
def human_name
name
end
2012-12-30 13:26:19 +01:00
def truncate_teams
UsersProject.truncate_teams(project_ids)
end
2012-10-02 17:17:12 +02:00
end