whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject [whimsy] 01/02: actually add PMC action this time
Date Wed, 18 Jan 2017 15:51:21 GMT
This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git

commit 04c8cc1f52220a33d63c997709eb81844c173c42
Author: Sam Ruby <rubys@intertwingly.net>
AuthorDate: Wed Jan 18 10:50:43 2017 -0500

    actually add PMC action this time
---
 www/roster/views/actions/ppmc.json.rb | 39 +++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/www/roster/views/actions/ppmc.json.rb b/www/roster/views/actions/ppmc.json.rb
new file mode 100644
index 0000000..4824fd2
--- /dev/null
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -0,0 +1,39 @@
+if env.password
+  person = ASF::Person.find(@id)
+  project = ASF::Project.find(@ppmc)
+
+  # update LDAP
+  ASF::LDAP.bind(env.user, env.password) do
+    if @action == 'add'
+      project.add(person)
+    elsif @action == 'remove'
+      project.remove(person)
+    end
+  end
+
+  # compose E-mail
+  action = (@action == 'add' ? 'added to' : 'removed from')
+  details = [person.dn, project.dn]
+  from = ASF::Person.find(env.user)
+  ppmc = ASF::Podling.find(@ppmc)
+
+  mail = Mail.new do
+    from "#{from.public_name} <#{from.id}@apache.org>".untaint
+    to ppmc.private_mail_list.untaint
+    cc 'private@incubator.apache.org'
+    bcc 'root@apache.org'
+    subject "#{person.public_name} #{action} #{ppmc.display_name} PPMC"
+    body "Current roster can be found at:\n\n" +
+      "  https://whimsy.apache.org/roster/ppmc/#{ppmc.id}\n\n" +
+      "LDAP details:\n\n  #{details.join("\n  ")}"
+  end
+
+  # Header for root@'s lovely email filters
+  mail.header['X-For-Root'] = 'yes'
+
+  # deliver email
+  mail.deliver!
+end
+
+# return updated committee info to the client
+PPMC.serialize(@ppmc, env)

-- 
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <commits@whimsical.apache.org>.

Mime
View raw message