Module: Teams::Base
Instance Method Summary collapse
- #admin_users ⇒ Object
- #admins ⇒ Object
- #formatted_email_address ⇒ Object
- #invalidate_caches ⇒ Object
- #platform_agent_access_tokens ⇒ Object
- #primary_contact ⇒ Object
- #team ⇒ Object
Instance Method Details
#admin_users ⇒ Object
36 37 38 |
# File 'app/models/concerns/teams/base.rb', line 36 def admin_users admins.map(&:user).compact end |
#admins ⇒ Object
32 33 34 |
# File 'app/models/concerns/teams/base.rb', line 32 def admins memberships.current_and_invited.admins end |
#formatted_email_address ⇒ Object
44 45 46 |
# File 'app/models/concerns/teams/base.rb', line 44 def formatted_email_address primary_contact.email end |
#invalidate_caches ⇒ Object
48 49 50 |
# File 'app/models/concerns/teams/base.rb', line 48 def invalidate_caches users.map(&:invalidate_ability_cache) end |
#platform_agent_access_tokens ⇒ Object
28 29 30 |
# File 'app/models/concerns/teams/base.rb', line 28 def platform_agent_access_tokens Platform::AccessToken.joins(:application).where(resource_owner_id: users.where.not(platform_agent_of_id: nil), application: {team: nil}) end |
#primary_contact ⇒ Object
40 41 42 |
# File 'app/models/concerns/teams/base.rb', line 40 def primary_contact admin_users.min { |user| user.created_at } end |
#team ⇒ Object
52 53 54 55 56 |
# File 'app/models/concerns/teams/base.rb', line 52 def team # some generic features appeal to the `team` method for security or scoping purposes, but sometimes those same # generic functions need to function for a team model as well, so we do this. self end |