ogam 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01aa2307589a72f9316e069ea9d7980dccc74c52c2cc8deb87d5eea2a71da94f
4
- data.tar.gz: fa83f2d5035bceae5b3f9d389f6b4ec9ccc65eb5d40316a0ee13d3b97dea3e94
3
+ metadata.gz: 6b7938c9753be6b692a5b32f28d3fba6d33825f427ed5e412dc1bd9fc20de3f1
4
+ data.tar.gz: 0e9a64326906cde7110356c3bb22d748f65649045583c018a935f76dae77017d
5
5
  SHA512:
6
- metadata.gz: 8e55ca322c7c97c468a810ead4bd530d034a29151cb0a02b15923fcf658173f331124b26cae58e0271709bae70c6ef6f69e0b35385365e60abb2a87c62aaefdc
7
- data.tar.gz: 3e8a1f8844d692da9093da34ac1a28c4bf82182df32ba8406ddcbd381c203490aa07d98ddb10055fef3148072fe1982453d73e08be3f15c4271dceeb8f987cf3
6
+ metadata.gz: 863fc06fadbf53763d787931b6366ea76d026251559df94a8fb2aea3e6fcab7b16c7725bff8b5d3112be8e7a366f14df337302a7e8d209f30be7b696a3de6357
7
+ data.tar.gz: 686786fd8ad253e01246ab3746ac9054f3197acc7362f5a332a76f30e7d67feb36c282248acde8d81490ea0fcc6fd32067c99794f68eec79869c4242e759a393
data/bin/ogam CHANGED
@@ -85,6 +85,15 @@ class CLI < Thor
85
85
  set_title_and_org_and_make_changes(email, title, org, pretend: options[:pretend])
86
86
  end
87
87
 
88
+ desc(
89
+ 'add_send_as USER GROUP NAME TITLE ORG_NAME',
90
+ 'Adds a sendas address to USER to be able to send as GROUP, and sets the NAME, and signature for sending'
91
+ )
92
+ def add_send_as(user, group, name, title, org_name)
93
+ signature_html = Ogam::Signature.signature_html(name, title, org_name)
94
+ Ogam::Execute.single(Ogam::Group.add_send_as_command(user, group, name, signature_html), pretend: options[:pretend])
95
+ end
96
+
88
97
  desc('set_signature user/domain EMAIL/DOMAIN', 'Set email signatures for users/domains based on user attributes')
89
98
  subcommand 'set_signature', SignatureCLI
90
99
 
data/lib/ogam/execute.rb CHANGED
@@ -11,14 +11,14 @@ module Ogam
11
11
  puts "#{pretend ? '[PRETEND] ' : nil}Executing #{command}"
12
12
  return if pretend
13
13
 
14
- system("~/bin/gam/#{command}", exception: true)
14
+ system("~/bin/gam/#{command.strip}", exception: true)
15
15
  end
16
16
 
17
17
  def self.fetch(command, pretend: true)
18
18
  puts "#{pretend ? '[PRETEND] ' : nil}Fetching results from #{command}"
19
19
  return if pretend
20
20
 
21
- `~/bin/gam/#{command}`
21
+ `~/bin/gam/#{command.strip}`
22
22
  end
23
23
 
24
24
  def self.fetch_csv(command, pretend: true)
@@ -29,7 +29,7 @@ module Ogam
29
29
  end
30
30
 
31
31
  def self.csv_command(csv_path, command, pretend: true)
32
- single("gam csv #{Shellwords.escape(csv_path)} #{command}", pretend: pretend)
32
+ single("gam csv #{Shellwords.escape(csv_path)} #{command.strip}", pretend: pretend)
33
33
  end
34
34
 
35
35
  def self.multiple(commands, pretend: true)
@@ -42,7 +42,7 @@ module Ogam
42
42
  return if pretend
43
43
 
44
44
  Tempfile.create do |f|
45
- commands.each { |command| f.puts command }
45
+ commands.each { |command| f.puts command.strip }
46
46
  single("gam batch #{f.path}", pretend: pretend)
47
47
  end
48
48
  end
data/lib/ogam/group.rb CHANGED
@@ -29,5 +29,11 @@ module Ogam
29
29
  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
30
30
  COMMAND
31
31
  end
32
+
33
+ def self.add_send_as_command(user_email, group_email, name, signature_html)
34
+ <<~COMMAND
35
+ gam user #{user_email} sendas #{group_email} #{Shellwords.escape(name)} treatasalias false signature "#{signature_html}"
36
+ COMMAND
37
+ end
32
38
  end
33
39
  end
data/lib/ogam/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ogam
4
- VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ogam
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elliot Bowes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport