# Module Team

- app/roles/team.rb

Methods

A
  - add_user_id_to_team,
  - add_user_to_team,
  - add_users_ids_to_team,
  - add_users_to_team
D
  - delete_users_ids_from_team
T
  - team_member_by_id,
  - team_member_by_name_or_email,
  - truncate_team
U
  - update_users_ids_to_role

Instance Public methods
add_user_id_to_team(user_id, access_role) Link

Add user to project with passed access role by user id

Source: show

    # File app/roles/team.rb, line 26
    def add_user_id_to_team(user_id, access_role)
      users_projects.create(
        user_id: user_id,
        project_access: access_role
      )
    end

add_user_to_team(user, access_role) Link

Add user to project with passed access role

Source: show

    # File app/roles/team.rb, line 14
    def add_user_to_team(user, access_role)
      add_user_id_to_team(user.id, access_role)
    end

add_users_ids_to_team(users_ids, access_role) Link

Add multiple users to project with same access role by user ids

Source: show

    # File app/roles/team.rb, line 35
    def add_users_ids_to_team(users_ids, access_role)
      UsersProject.bulk_import(self, users_ids, access_role)
    end

add_users_to_team(users, access_role) Link

Add multiple users to project with same access role

Source: show

    # File app/roles/team.rb, line 20
    def add_users_to_team(users, access_role)
      add_users_ids_to_team(users.map(&:id), access_role)
    end

delete_users_ids_from_team(users_ids) Link

Delete multiple users from project by user ids

Source: show

    # File app/roles/team.rb, line 46
    def delete_users_ids_from_team(users_ids)
      UsersProject.bulk_delete(self, users_ids)
    end

team_member_by_id(user_id) Link

Get Team Member record by user id

Source: show

    # File app/roles/team.rb, line 8
    def team_member_by_id(user_id)
      users_projects.find_by_user_id(user_id)
    end

team_member_by_name_or_email(name = nil, email = nil) Link

Source: show

    # File app/roles/team.rb, line 2
    def team_member_by_name_or_email(name = nil, email = nil)
      user = users.where("name like ? or email like ?", name, email).first
      users_projects.where(user: user) if user
    end

truncate_team() Link

Remove all users from project team

Source: show

    # File app/roles/team.rb, line 51
    def truncate_team
      UsersProject.truncate_team(self)
    end

update_users_ids_to_role(users_ids, access_role) Link

Update multiple project users to same access role by user ids

Source: show

    # File app/roles/team.rb, line 41
    def update_users_ids_to_role(users_ids, access_role)
      UsersProject.bulk_update(self, users_ids, access_role)
    end