2012-11-19 13:24:05 -05:00
|
|
|
# == Schema Information
|
|
|
|
#
|
2012-11-24 15:16:51 -05:00
|
|
|
# Table name: namespaces
|
2012-11-19 13:24:05 -05:00
|
|
|
#
|
2013-02-07 05:42:52 -05:00
|
|
|
# id :integer not null, primary key
|
|
|
|
# name :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)
|
2013-03-15 09:16:02 -04:00
|
|
|
# description :string(255) default(""), not null
|
2012-11-19 13:24:05 -05:00
|
|
|
#
|
|
|
|
|
2012-11-22 13:34:16 -05:00
|
|
|
class Group < Namespace
|
2013-04-02 18:28:12 -04:00
|
|
|
|
2012-12-26 11:30:11 -05:00
|
|
|
def add_users_to_project_teams(user_ids, project_access)
|
2012-12-30 06:37:33 -05:00
|
|
|
UsersProject.add_users_into_projects(
|
|
|
|
projects.map(&:id),
|
|
|
|
user_ids,
|
|
|
|
project_access
|
|
|
|
)
|
2012-12-26 11:30:11 -05:00
|
|
|
end
|
|
|
|
|
2012-10-03 07:26:37 -04:00
|
|
|
def users
|
2012-11-28 23:29:11 -05:00
|
|
|
users = User.joins(:users_projects).where(users_projects: {project_id: project_ids})
|
|
|
|
users = users << owner
|
|
|
|
users.uniq
|
2012-10-03 07:26:37 -04:00
|
|
|
end
|
2012-11-22 23:11:09 -05:00
|
|
|
|
|
|
|
def human_name
|
|
|
|
name
|
|
|
|
end
|
2012-12-30 07:26:19 -05:00
|
|
|
|
|
|
|
def truncate_teams
|
|
|
|
UsersProject.truncate_teams(project_ids)
|
|
|
|
end
|
2012-10-02 11:17:12 -04:00
|
|
|
end
|