Class: Ogam::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/ogam/group.rb

Overview

Methods relating to groups

Class Method Summary collapse

Class Method Details

.add_group_member_command(user:, group:) ⇒ Object



11
12
13
# File 'lib/ogam/group.rb', line 11

def self.add_group_member_command(user:, group:)
  "gam update group #{group} add member user #{Shellwords.escape(user)}"
end

.add_send_as_command(user_email, group_email, name, signature_html) ⇒ Object



33
34
35
36
37
# File 'lib/ogam/group.rb', line 33

def self.add_send_as_command(user_email, group_email, name, signature_html)
  <<~COMMAND
    gam user #{user_email} sendas #{group_email} #{Shellwords.escape(name)} treatasalias false signature "#{signature_html}"
  COMMAND
end

.create_distribution_list_command(email_address, name, moderated) ⇒ Object



27
28
29
30
31
# File 'lib/ogam/group.rb', line 27

def self.create_distribution_list_command(email_address, name, moderated)
  <<~COMMAND
    gam create group #{email_address} name #{Shellwords.escape(name)} allow_external_members false who_can_join invited_can_join primary_language en-GB who_can_view_membership all_in_domain_can_view include_in_global_address_list true is_archived false members_can_post_as_the_group false allow_web_posting false send_message_deny_notification true reply_to reply_to_sender message_moderation_level #{moderated ? "moderate_all_messages" : "moderate_none"} who_can_contact_owner all_managers_can_contact who_can_leave_group none_can_leave who_can_add none_can_add who_can_post_message all_in_domain_can_post who_can_invite none_can_invite who_can_view_group all_managers_can_view show_in_group_directory true archive_only false spam_moderation_level moderate
  COMMAND
end

.create_exec_mailbox_command(email_address, name) ⇒ Object



21
22
23
24
25
# File 'lib/ogam/group.rb', line 21

def self.create_exec_mailbox_command(email_address, name)
  <<~COMMAND
    gam create group #{email_address} name #{Shellwords.escape(name)} allow_external_members false who_can_join invited_can_join primary_language en-GB who_can_view_membership all_in_domain_can_view include_in_global_address_list true is_archived true members_can_post_as_the_group true allow_web_posting true send_message_deny_notification false reply_to reply_to_ignore message_moderation_level moderate_none who_can_contact_owner all_members_can_contact who_can_leave_group none_can_leave who_can_add all_managers_can_add who_can_post_message anyone_can_post who_can_invite all_managers_can_invite who_can_view_group all_members_can_view show_in_group_directory false archive_only false spam_moderation_level moderate include_in_global_address_list true who_can_discover_group all_members_can_discover enable_collaborative_inbox true who_can_assist_content all_members
  COMMAND
end

.create_shared_mailbox_command(email_address, name) ⇒ Object



15
16
17
18
19
# File 'lib/ogam/group.rb', line 15

def self.create_shared_mailbox_command(email_address, name)
  <<~COMMAND
    gam create group #{email_address} name #{Shellwords.escape(name)} allow_external_members false who_can_join invited_can_join primary_language en-GB who_can_view_membership all_in_domain_can_view include_in_global_address_list true is_archived true members_can_post_as_the_group true allow_web_posting true send_message_deny_notification false reply_to reply_to_ignore message_moderation_level moderate_none who_can_contact_owner all_in_domain_can_contact who_can_leave_group all_members_can_leave who_can_add all_managers_can_add who_can_post_message anyone_can_post who_can_invite all_managers_can_invite who_can_view_group all_members_can_view show_in_group_directory false archive_only false spam_moderation_level moderate enable_collaborative_inbox true who_can_assist_content all_members
  COMMAND
end

.groups_for_domain(domain) ⇒ Object



7
8
9
# File 'lib/ogam/group.rb', line 7

def self.groups_for_domain(domain)
  Ogam::Execute.fetch_csv("gam print groups domain #{domain}", pretend: false).map { |r| r["Email"] }
end