You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2016/08/04 12:59:58 UTC
[whimsy] branch master updated (3c81844 -> 74a1a6a)
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a change to branch master
in repository https://git-dual.apache.org/repos/asf/whimsy.git.
from 3c81844 defensive programming: validate podling name
new 3d3e1cc original version of submit-account-request.rb
new ee5099f convert cgi-bin to wunderbar
new 14aadfa introduce whimsy/asf
new 4a9ccc7 start to take advantage of Whimsy library methods
new cab7d70 take advantage of Wunderbar and Ruby 1.9+
new dcd93cb rely on cron jobs to keep svn up to date
new c1e5276 more wunderbar syntax and delete dead code
new f102c46 more reliance on pre-existing cron jobs
new 48d5cc2 authentication; cleanup
new a696660 only active podlings
new 74a1a6a use the latest libs
The 11 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Summary of changes:
www/officers/acreq.cgi | 377 +++++++++++++++++++++
.../public => officers}/assets/jquery-min.js | 0
2 files changed, 377 insertions(+)
create mode 100755 www/officers/acreq.cgi
copy www/{board/agenda/public => officers}/assets/jquery-min.js (100%)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
[whimsy] 11/11: use the latest libs
Posted by ru...@apache.org.
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 74a1a6a8b48095d9b1c33a1f82b43c7ac376dcd9
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Thu Aug 4 08:59:39 2016 -0400
use the latest libs
---
www/officers/acreq.cgi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index 986dbab..3c94ce1 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -13,6 +13,8 @@
# a copy of the email that was sent.
#
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
+
require 'wunderbar/jquery'
require 'whimsy/asf'
require 'mail'
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 05/11: take advantage of Wunderbar and Ruby 1.9+
Posted by ru...@apache.org.
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 cab7d70130c1241d4705f6a0004c53d56fa27f5a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 17:07:42 2016 -0400
take advantage of Wunderbar and Ruby 1.9+
---
www/officers/acreq.cgi | 104 +++++++++++++++++---------------------
www/officers/assets/jquery-min.js | 4 ++
2 files changed, 50 insertions(+), 58 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index bb9aa30..ea4c4f1 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -13,7 +13,7 @@
# a copy of the email that was sent.
#
-require 'wunderbar'
+require 'wunderbar/jquery'
require 'whimsy/asf'
require 'mail'
require 'date'
@@ -93,7 +93,6 @@ pending.each {|email| iclas.delete email}
# HTML output
_html do
_head do
- _meta :charset => 'utf-8'
_title 'Submit ASF Account Request'
_style! <<-'EOF'
@@ -119,17 +118,7 @@ _html do
dr = $1
dr.untaint
- if (Pathname(sf).dirname + 'jquery.min.js').exist?
- src = 'jquery.min.js'
- elsif (Pathname(dr) + 'jquery.min.js').exist?
- src = '/jquery.min.js'
- else
- src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'
- end
-
- _script '', :src => src
-
- scriptSrc = <<-EOF
+ _script %{
$(function() {
// if name changes, change email to match
@@ -177,99 +166,98 @@ _html do
if (#{@votelink.to_s.inspect} != '')
$('#votelink').val(#{@votelink.to_s.inspect});
});
- EOF
- _script scriptSrc, :type => "text/javascript"
+ }
end
_body do
- _form :method=>'post' do
+ _form method: 'post' do
_fieldset do
_legend 'ASF New Account Request'
_div do
- _label 'User ID', :for=>"user"
- _input :name=>"user", :id=>"user", :autofocus => "autofocus",
- :type=>"text", :required => "required",
- :pattern => '^[a-z][-a-z0-9_]+$' # useridvalidationpattern dup
+ _label 'User ID', for: "user"
+ _input name: "user", id: "user", autofocus: true,
+ type: "text", required: true,
+ pattern: '^[a-z][-a-z0-9_]+$' # useridvalidationpattern dup
end
_div do
- _label 'Name', :for=>"name"
- _select :name=>"name", :id=>"name", :required => "required" do
- _option '', :value => ''
+ _label 'Name', for: "name"
+ _select name: "name", id: "name", required: true do
+ _option value: ''
iclas.invert.to_a.sort.each do |name, email|
- _option name, :value => name, 'data-email' => email
+ _option name, value: name, data_email: email
end
end
end
_div do
- _label 'Email', :for=>"email"
- _select :name=>"email", :id=>"email", :required => "required" do
- _option '', :value => ''
+ _label 'Email', for: "email"
+ _select name: "email", id: "email", required: true do
+ _option value: ''
iclas.to_a.sort_by {|email, name| email.downcase}.
each do |email, name|
- _option email.downcase, :value => email, 'data-name' => name
+ _option email.downcase, value: email, data_name:name
end
end
end
_div do
- _label 'PMC', :for=>"pmc"
- _select :name=>"pmc", :id=>"pmc" do
- _option '', :value => ''
+ _label 'PMC', for: "pmc"
+ _select name: "pmc", id: "pmc" do
+ _option value: ''
pmcs.each do |pmc|
- _option pmc, {:value => pmc}
+ _option pmc, value: pmc
end
end
end
_div do
- _label 'Podling', :for=>"podling"
- _select :name=>"podling", :id=>"podling" do
- _option '', :value => ''
+ _label 'Podling', for: "podling"
+ _select name: "podling", id: "podling" do
+ _option value: ''
podlings.each do |podling|
- _option podling, {:value => podling}
+ _option podling, value: podling
end
end
end
_div do
- _label 'Vote Link', :for=>"votelink"
- _input :name=>"votelink", :id=>"votelink", :type=>"text",
- :pattern => '.*://.*|.*@.*'
+ _label 'Vote Link', for: "votelink"
+ _input name: "votelink", id: "votelink", type: "text",
+ pattern: '.*://.*|.*@.*'
end
_div do
- _label 'Comments', :for=>"comments"
- _textarea "", :name=>"comments", :id=>"comments"
+ _label 'Comments', for: "comments"
+ _textarea name: "comments", id: "comments"
end
- _input :type=>"submit", :value=>"Submit"
+ _input type: "submit", value: "Submit"
end
end
if _.post?
# server side validation
if pending.include? @email
- _div "Account request already pending for #{@email}", :class => 'error'
+ _div.error "Account request already pending for #{@email}"
elsif taken.include? @user
- _div "UserID #{@user} is not available", :class => 'error'
+ _div.error "UserID #{@user} is not available"
elsif @user !~ /^[a-z][a-z0-9_]+$/ # useridvalidationpattern dup (disallow '-' in names because of INFRA-7390)
- _div "Invalid userID #{@user}", :class => 'error'
+ _div.error "Invalid userID #{@user}"
elsif @user.length > 16
# http://forums.freebsd.org/showthread.php?t=14636
- _div "UserID #{@user} is too long (max 16)", :class => 'error'
+ _div.error "UserID #{@user} is too long (max 16)"
elsif @pmc !~ /^[0-9a-z-]+$/
- _div "Unsafe PMC #{@pmc}", :class => 'error'
+ _div.error "Unsafe PMC #{@pmc}"
elsif @podling and @podling !~ /^[0-9a-z-]*$/
- _div "Unsafe podling name #{@podling}", :class => 'error'
+ _div.error "Unsafe podling name #{@podling}"
elsif not iclas.include? @email
- _div "No ICLA on record for #{@email}", :class => 'error'
+ _div.error "No ICLA on record for #{@email}"
elsif not iclas[@email] == @name
- _div "Name #{@name} does not match name on ICLA", :class => 'error'
+ _div.error "Name #{@name} does not match name on ICLA"
elsif not pmcs.include? @pmc
- _div "Unrecognized PMC name #{@pmc}", :class => 'error'
+ _div.error "Unrecognized PMC name #{@pmc}"
else
# verb tense to be used in messages
@@ -342,7 +330,7 @@ _html do
begin
mail.deliver!
rescue Exception => exception
- _pre exception.inspect, :class => 'error'
+ _pre.error exception.inspect
tobe = 'would have been '
end
end
@@ -361,10 +349,10 @@ _html do
Open3.popen3(command) do |pin, pout, perr|
[
Thread.new do
- _p pout.readline.chomp, :class=>'stdout' until pout.eof?
+ _p.stdout pout.readline.chomp until pout.eof?
end,
Thread.new do
- _p perr.readline.chomp, :class=>'stderr' until perr.eof?
+ _p.stderr perr.readline.chomp until perr.eof?
end,
Thread.new do
pin.close
@@ -377,19 +365,19 @@ _html do
_h2 "New entry #{tobe}added:"
_pre line
_h2 "Mail #{tobe}sent:"
- _pre mail.to_s, :class => 'email'
+ _pre.email mail.to_s
end
end
unless _.post?
_p do
- if query_string.has_key? 'fulllist'
+ if @fulllist
_span 'This page shows all ICLAs ever received. Click here to'
- _a 'show only ICLAs received recently', :href => '?'
+ _a 'show only ICLAs received recently', href: '?'
_span '.'
else
_span 'This page shows only ICLAs received recently. Click here to'
- _a 'choose from the full list of ICLA submitters', :href => '?fulllist=1'
+ _a 'choose from the full list of ICLA submitters', href: '?fulllist=1'
_span '.'
end
end
diff --git a/www/officers/assets/jquery-min.js b/www/officers/assets/jquery-min.js
new file mode 100644
index 0000000..e6a051d
--- /dev/null
+++ b/www/officers/assets/jquery-min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.2",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b [...]
+return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}fu [...]
+}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=( [...]
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 08/11: more reliance on pre-existing cron jobs
Posted by ru...@apache.org.
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 f102c4601d7fab13bab1799ec9bdb98cfd27923a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 20:00:10 2016 -0400
more reliance on pre-existing cron jobs
---
www/officers/acreq.cgi | 8 --------
1 file changed, 8 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index d515444..1831b87 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -22,7 +22,6 @@ require 'pathname'
require 'rexml/document'
require 'net/http'
-
# List of unix groups that do NOT correspond to PMCs
NON_PMC_UNIX_GROUPS = %w(
apsite
@@ -41,13 +40,6 @@ OFFICERS = ASF::SVN['private/foundation/officers']
APMAIL_BIN = ASF::SVN['infra/infrastructure/apmail/trunk/bin']
# get up to date...
-`#{SVN} cleanup #{ACREQ} #{OFFICERS} #{APMAIL_BIN}`
-`#{SVN} revert -R #{ACREQ}` if ENV[' REQUEST_METHOD'] == 'POST'
-unless `#{SVN} status -q #{ACREQ}`.empty?
- raise "acreq/ working copy is dirty"
-end
-`#{SVN} update --ignore-externals #{ACREQ}`
-
REQUESTS = "#{ACREQ}/new-account-reqs.txt"
# grab the current list of PMCs from ldap
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 02/11: convert cgi-bin to wunderbar
Posted by ru...@apache.org.
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 ee5099f49454a2ed8acc588149799ccca996ae9a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 16:26:20 2016 -0400
convert cgi-bin to wunderbar
---
www/officers/acreq.cgi | 208 ++++++++++++++++++++++++-------------------------
1 file changed, 103 insertions(+), 105 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index 7ee9e5e..9ad9b7e 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -21,7 +21,7 @@
# * (optional) jQuery http://code.jquery.com/jquery.min.js
#
# Installation instructions:
-#
+#_.post?
# ruby submit-account-request.rb --install=/var/www
#
# 1) Specify a path that supports cgi, like public-html or Sites.
@@ -35,10 +35,7 @@
# Point your web browser at your generated cgi script. For best results,
# use a browser that implements HTML5 form validation.
-$SAFE=1
-
-require 'rubygems'
-require 'cgi-spa'
+require 'wunderbar'
require 'mail'
require 'date'
require 'open3'
@@ -63,7 +60,8 @@ SVN = "/usr/bin/svn"
# get up to date...
`#{SVN} cleanup #{INFRA}/acreq #{OFFICERS} #{APMAIL}/bin`
-`#{SVN} revert -R #{INFRA}/acreq`
+_.post?`#{SVN} revert -R #{INFRA}/acreq`
+st?
unless `#{SVN} status -q #{INFRA}/acreq`.empty?
raise "acreq/ working copy is dirty"
end
@@ -114,12 +112,12 @@ pending = File.read(REQUESTS).scan(/^\w.*?;.*?;(.*?);/).flatten
pending.each {|email| iclas.delete email}
# HTML output
-$cgi.html do |x|
- x.head do
- x.meta :charset => 'utf-8'
- x.title 'Submit ASF Account Request'
+_html do
+ _head do
+ _meta :charset => 'utf-8'
+ _title 'Submit ASF Account Request'
- x.style! <<-'EOF'
+ _style! <<-'EOF'
label {width: 6em; float: left}
legend {background: #141; color: #DFD; padding: 0.4em}
fieldset {background: #EFE; width: 28em}
@@ -150,7 +148,7 @@ $cgi.html do |x|
src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'
end
- x.script '', :src => src
+ _script '', :src => src
scriptSrc = <<-EOF
$(function() {
@@ -191,108 +189,108 @@ $cgi.html do |x|
});
// allow selected fields to be set based on parameters passed
- if (#{$param.user.to_s.inspect} != '')
- $('#user').val(#{$param.user.to_s.inspect});
- $('#email').val(#{$param.email.to_s.inspect}).trigger('change');
- $('#pmc').val(#{$param.pmc.to_s.inspect}).trigger('change').
+ if (#{@user.to_s.inspect} != '')
+ $('#user').val(#{@user.to_s.inspect});
+ $('#email').val(#{@email.to_s.inspect}).trigger('change');
+ $('#pmc').val(#{@pmc.to_s.inspect}).trigger('change').
attr('required', 'required');
- $('#podling').val(#{$param.podling.to_s.inspect});
- if (#{$param.votelink.to_s.inspect} != '')
- $('#votelink').val(#{$param.votelink.to_s.inspect});
+ $('#podling').val(#{@podling.to_s.inspect});
+ if (#{@votelink.to_s.inspect} != '')
+ $('#votelink').val(#{@votelink.to_s.inspect});
});
EOF
- x.script scriptSrc, :type => "text/javascript"
+ _script scriptSrc, :type => "text/javascript"
end
- x.body do
- x.form :method=>'post' do
- x.fieldset do
- x.legend 'ASF New Account Request'
+ _body do
+ _form :method=>'post' do
+ _fieldset do
+ _legend 'ASF New Account Request'
- x.div do
- x.label 'User ID', :for=>"user"
- x.input :name=>"user", :id=>"user", :autofocus => "autofocus",
+ _div do
+ _label 'User ID', :for=>"user"
+ _input :name=>"user", :id=>"user", :autofocus => "autofocus",
:type=>"text", :required => "required",
:pattern => '^[a-z][-a-z0-9_]+$' # useridvalidationpattern dup
end
- x.div do
- x.label 'Name', :for=>"name"
- x.select :name=>"name", :id=>"name", :required => "required" do
- x.option '', :value => ''
+ _div do
+ _label 'Name', :for=>"name"
+ _select :name=>"name", :id=>"name", :required => "required" do
+ _option '', :value => ''
iclas.invert.to_a.sort.each do |name, email|
- x.option name, :value => name, 'data-email' => email
+ _option name, :value => name, 'data-email' => email
end
end
end
- x.div do
- x.label 'Email', :for=>"email"
- x.select :name=>"email", :id=>"email", :required => "required" do
- x.option '', :value => ''
+ _div do
+ _label 'Email', :for=>"email"
+ _select :name=>"email", :id=>"email", :required => "required" do
+ _option '', :value => ''
iclas.to_a.sort_by {|email, name| email.downcase}.
each do |email, name|
- x.option email.downcase, :value => email, 'data-name' => name
+ _option email.downcase, :value => email, 'data-name' => name
end
end
end
- x.div do
- x.label 'PMC', :for=>"pmc"
- x.select :name=>"pmc", :id=>"pmc" do
- x.option '', :value => ''
+ _div do
+ _label 'PMC', :for=>"pmc"
+ _select :name=>"pmc", :id=>"pmc" do
+ _option '', :value => ''
pmcs.each do |pmc|
- x.option pmc, {:value => pmc}
+ _option pmc, {:value => pmc}
end
end
end
- x.div do
- x.label 'Podling', :for=>"podling"
- x.select :name=>"podling", :id=>"podling" do
- x.option '', :value => ''
+ _div do
+ _label 'Podling', :for=>"podling"
+ _select :name=>"podling", :id=>"podling" do
+ _option '', :value => ''
podlings.each do |podling|
- x.option podling, {:value => podling}
+ _option podling, {:value => podling}
end
end
end
- x.div do
- x.label 'Vote Link', :for=>"votelink"
- x.input :name=>"votelink", :id=>"votelink", :type=>"text",
+ _div do
+ _label 'Vote Link', :for=>"votelink"
+ _input :name=>"votelink", :id=>"votelink", :type=>"text",
:pattern => '.*://.*|.*@.*'
end
- x.div do
- x.label 'Comments', :for=>"comments"
- x.textarea "", :name=>"comments", :id=>"comments"
+ _div do
+ _label 'Comments', :for=>"comments"
+ _textarea "", :name=>"comments", :id=>"comments"
end
- x.input :type=>"submit", :value=>"Submit"
+ _input :type=>"submit", :value=>"Submit"
end
end
- if $HTTP_POST
+ if _.post?
# server side validation
- if pending.include? $param.email
- x.div "Account request already pending for #{$param.email}", :class => 'error'
- elsif taken.include? $param.user
- x.div "UserID #{$param.user} is not available", :class => 'error'
- elsif $param.user !~ /^[a-z][a-z0-9_]+$/ # useridvalidationpattern dup (disallow '-' in names because of INFRA-7390)
- x.div "Invalid userID #{$param.user}", :class => 'error'
- elsif $param.user.length > 16
+ if pending.include? @email
+ _div "Account request already pending for #{@email}", :class => 'error'
+ elsif taken.include? @user
+ _div "UserID #{@user} is not available", :class => 'error'
+ elsif @user !~ /^[a-z][a-z0-9_]+$/ # useridvalidationpattern dup (disallow '-' in names because of INFRA-7390)
+ _div "Invalid userID #{@user}", :class => 'error'
+ elsif @user.length > 16
# http://forums.freebsd.org/showthread.php?t=14636
- x.div "UserID #{$param.user} is too long (max 16)", :class => 'error'
- elsif $param.pmc !~ /^[0-9a-z-]+$/
- x.div "Unsafe PMC #{$param.pmc}", :class => 'error'
- elsif $param.podling and $param.podling !~ /^[0-9a-z-]*$/
- x.div "Unsafe podling name #{$param.podling}", :class => 'error'
- elsif not iclas.include? $param.email
- x.div "No ICLA on record for #{$param.email}", :class => 'error'
- elsif not iclas[$param.email] == $param.name
- x.div "Name #{$param.name} does not match name on ICLA", :class => 'error'
- elsif not pmcs.include? $param.pmc
- x.div "Unrecognized PMC name #{$param.pmc}", :class => 'error'
+ _div "UserID #{@user} is too long (max 16)", :class => 'error'
+ elsif @pmc !~ /^[0-9a-z-]+$/
+ _div "Unsafe PMC #{@pmc}", :class => 'error'
+ elsif @podling and @podling !~ /^[0-9a-z-]*$/
+ _div "Unsafe podling name #{@podling}", :class => 'error'
+ elsif not iclas.include? @email
+ _div "No ICLA on record for #{@email}", :class => 'error'
+ elsif not iclas[@email] == @name
+ _div "Name #{@name} does not match name on ICLA", :class => 'error'
+ elsif not pmcs.include? @pmc
+ _div "Unrecognized PMC name #{@pmc}", :class => 'error'
else
# verb tense to be used in messages
@@ -308,23 +306,23 @@ $cgi.html do |x|
submitter_name.untaint
# build the line to be added
- line = "#{$param.user};#{$param.name};#{$param.email};#{$param.pmc};" +
- "#{$param.pmc};#{Date.today.strftime('%m-%d-%Y')};yes;yes;no;"
+ line = "#{@user};#{@name};#{@email};#{@pmc};" +
+ "#{@pmc};#{Date.today.strftime('%m-%d-%Y')};yes;yes;no;"
# determine the requesting party and cc_list
- $param.pmc =~ /([\w.-]+)/
+ @pmc =~ /([\w.-]+)/
requestor = $1
requestor.untaint
- cc_list = ["private@#{$param.pmc}.apache.org".untaint]
- if requestor == 'incubator' and not $param.podling.empty?
- if File.read("#{APMAIL}/bin/.archives").include? "incubator-#{$param.podling}-private"
- cc_list << "#{$param.podling}-private@#{$param.pmc}.apache.org".untaint
+ cc_list = ["private@#{@pmc}.apache.org".untaint]
+ if requestor == 'incubator' and not @podling.empty?
+ if File.read("#{APMAIL}/bin/.archives").include? "incubator-#{@podling}-private"
+ cc_list << "#{@podling}-private@#{@pmc}.apache.org".untaint
else
- cc_list << "private@#{$param.podling}.#{$param.pmc}.apache.org".untaint
+ cc_list << "private@#{@podling}.#{@pmc}.apache.org".untaint
end
- requestor = "#{$param.podling}@incubator".untaint
+ requestor = "#{@podling}@incubator".untaint
end
- cc_list << "<#{$param.email}>".untaint # TODO: add $param.name RFC822-escaped
+ cc_list << "<#{@email}>".untaint # TODO: add @name RFC822-escaped
# build the mail to be sent
mail = Mail.new do
@@ -336,21 +334,21 @@ $cgi.html do |x|
return_path "root@apache.org"
to "root@apache.org"
cc cc_list
- subject "[FORM] Account Request - #{requestor}: #{$param.name}"
+ subject "[FORM] Account Request - #{requestor}: #{@name}"
ENV['REMOTE_ADDR'] =~ /(\w[\w.-]+)/
ra = $1
ra.untaint
body <<-EOF.gsub(/^ {12}/, '').gsub(/(Vote reference:)?\n\s+\n/, "\n\n")
- Prospective userid: #{$param.user}
- Full name: #{$param.name}
- Forwarding email address: #{$param.email}
+ Prospective userid: #{@user}
+ Full name: #{@name}
+ Forwarding email address: #{@email}
Vote reference:
- #{$param.votelink.gsub('mail-search.apache.org/pmc/', 'mail-search.apache.org/members/')}
+ #{@votelink.gsub('mail-search.apache.org/pmc/', 'mail-search.apache.org/members/')}
- #{$param.comments}
+ #{@comments}
--
Submitted by https://#{ENV['HTTP_HOST']}#{ENV['REQUEST_URI'].split('?').first}
@@ -365,7 +363,7 @@ $cgi.html do |x|
begin
mail.deliver!
rescue Exception => exception
- x.pre exception.inspect, :class => 'error'
+ _pre exception.inspect, :class => 'error'
tobe = 'would have been '
end
end
@@ -380,14 +378,14 @@ $cgi.html do |x|
# and commit the change ...
command = "#{SVN} commit #{INFRA}/acreq/new-account-reqs.txt -m " +
"#{requestor} account request by #{submitter_id}".inspect
- x.h2 'Commit messages'
+ _h2 'Commit messages'
Open3.popen3(command) do |pin, pout, perr|
[
Thread.new do
- x.p pout.readline.chomp, :class=>'stdout' until pout.eof?
+ _p pout.readline.chomp, :class=>'stdout' until pout.eof?
end,
Thread.new do
- x.p perr.readline.chomp, :class=>'stderr' until perr.eof?
+ _p perr.readline.chomp, :class=>'stderr' until perr.eof?
end,
Thread.new do
pin.close
@@ -397,23 +395,23 @@ $cgi.html do |x|
end
# report on status
- x.h2 "New entry #{tobe}added:"
- x.pre line
- x.h2 "Mail #{tobe}sent:"
- x.pre mail.to_s, :class => 'email'
+ _h2 "New entry #{tobe}added:"
+ _pre line
+ _h2 "Mail #{tobe}sent:"
+ _pre mail.to_s, :class => 'email'
end
end
- unless $HTTP_POST
- x.p do
+ unless _.post?
+ _p do
if query_string.has_key? 'fulllist'
- x.span 'This page shows all ICLAs ever received. Click here to'
- x.a 'show only ICLAs received recently', :href => '?'
- x.span '.'
+ _span 'This page shows all ICLAs ever received. Click here to'
+ _a 'show only ICLAs received recently', :href => '?'
+ _span '.'
else
- x.span 'This page shows only ICLAs received recently. Click here to'
- x.a 'choose from the full list of ICLA submitters', :href => '?fulllist=1'
- x.span '.'
+ _span 'This page shows only ICLAs received recently. Click here to'
+ _a 'choose from the full list of ICLA submitters', :href => '?fulllist=1'
+ _span '.'
end
end
end
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 03/11: introduce whimsy/asf
Posted by ru...@apache.org.
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 14aadfa84fde7c70bbac3eaf4d1e62944a72ee33
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 16:48:38 2016 -0400
introduce whimsy/asf
---
www/officers/acreq.cgi | 74 ++++++++++++++------------------------------------
1 file changed, 20 insertions(+), 54 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index 9ad9b7e..ca102c6 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -1,16 +1,16 @@
#!/usr/bin/ruby
#
-# Just for demo purposes at the moment. Builds a properly formatted
-# and validated new-account-reqs.txt entry based on web input. With
-# the proper browser and with jquery installed, this will do full client
-# side validation. Server-side validation will also be done.
+# Build a properly formatted and validated new-account-reqs.txt entry based
+# on web input. Does both full client validation and Server-side
+# validation.
#
-# In demo mode, this script simply shows the formatted line that would
-# be added to the file and the email to be sent. In non-demo mode, it
-# actually appends the line to the file and issue a svn commit, returns
+# Should validation succeed, the entry will be appended to the
+# new-account-reqs.txt and committed. An email will be sent to root
+# (copying the relevant pmc private list) of the request.
+#
+# The response contains
# the messages produced by the commit (if any) in the response, and
-# sends an email to root (copying the relevant pmc private list) of the
-# request.
+# a copy of the email that was sent.
#
# Prereqs:
#
@@ -36,6 +36,7 @@
# use a browser that implements HTML5 form validation.
require 'wunderbar'
+require 'whimsy/asf'
require 'mail'
require 'date'
require 'open3'
@@ -57,17 +58,19 @@ NON_PMC_UNIX_GROUPS = %w(
)
SVN = "/usr/bin/svn"
+ACREQ = ASF::SVN['infra/infrastructure/trunk/acreq']
+OFFICERS = ASF::SVN['private/foundation/officers']
+APMAIL_BIN = ASF::SVN['infra/infrastructure/apmail/trunk/bin']
# get up to date...
-`#{SVN} cleanup #{INFRA}/acreq #{OFFICERS} #{APMAIL}/bin`
-_.post?`#{SVN} revert -R #{INFRA}/acreq`
-st?
-unless `#{SVN} status -q #{INFRA}/acreq`.empty?
+`#{SVN} cleanup #{ACREQ} #{OFFICERS} #{APMAIL_BIN}`
+`#{SVN} revert -R #{ACREQ}` if ENV[' REQUEST_METHOD'] == 'POST'
+unless `#{SVN} status -q #{ACREQ}`.empty?
raise "acreq/ working copy is dirty"
end
-`#{SVN} update --ignore-externals #{INFRA}/acreq #{OFFICERS} #{APMAIL}/bin`
+`#{SVN} update --ignore-externals #{ACREQ} #{OFFICERS} #{APMAIL_BIN}`
-REQUESTS = "#{INFRA}/acreq/new-account-reqs.txt"
+REQUESTS = "#{ACREQ}/new-account-reqs.txt"
# grab the current list of PMCs from ldap
pmcs = `/usr/local/bin/list_unix_group.pl`.chomp.split("\n") - NON_PMC_UNIX_GROUPS
@@ -315,7 +318,7 @@ _html do
requestor.untaint
cc_list = ["private@#{@pmc}.apache.org".untaint]
if requestor == 'incubator' and not @podling.empty?
- if File.read("#{APMAIL}/bin/.archives").include? "incubator-#{@podling}-private"
+ if File.read("#{APMAIL_BIN}/.archives").include? "incubator-#{@podling}-private"
cc_list << "#{@podling}-private@#{@pmc}.apache.org".untaint
else
cc_list << "private@#{@podling}.#{@pmc}.apache.org".untaint
@@ -376,7 +379,7 @@ _html do
end
# and commit the change ...
- command = "#{SVN} commit #{INFRA}/acreq/new-account-reqs.txt -m " +
+ command = "#{SVN} commit #{ACREQ}/new-account-reqs.txt -m " +
"#{requestor} account request by #{submitter_id}".inspect
_h2 'Commit messages'
Open3.popen3(command) do |pin, pout, perr|
@@ -417,40 +420,3 @@ _html do
end
end
end
-
-__END__
-# Doesn't actually have any effect !? The one in the .rb file has an effect.
-$SAFE = 1
-
-# tailor these lines as necessary
-INFRA = '..'
-APMAIL = '../../apmail'
-OFFICERS = '../../foundation/officers'
-
-# uncomment the next line if you have installed gems in a non-standard location
-# ENV['GEM_PATH'] = '/prefix/install-dir'
-
-require 'rubygems'
-require 'mail'
-
-# customize the delivery method
-Mail.defaults do
- # probably will work out of the box on ASF hardware
- delivery_method :sendmail
-
-### For comparison, here's how to connect to gmail
-# delivery_method :smtp,
-# :address => "smtp.gmail.com",
-# :port => 587,
-# :domain => "apache.org",
-# :authentication => "plain",
-# :user_name => "username",
-# :password => "password",
-# :enable_starttls_auto => true
-end
-
-# this should be pretty self evident
-DEMO_MODE = true
-
-# potentially useful when installed on a personal machine
-# ENV['REMOTE_USER'] ||= `/usr/bin/whoami`.chomp
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 07/11: more wunderbar syntax and delete dead code
Posted by ru...@apache.org.
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 c1e5276f574a8e6959b835478b18f34559c02ee2
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 17:11:39 2016 -0400
more wunderbar syntax and delete dead code
---
www/officers/acreq.cgi | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index f2ccdba..d515444 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -95,7 +95,7 @@ _html do
_head do
_title 'Submit ASF Account Request'
- _style! <<-'EOF'
+ _style %{
label {width: 6em; float: left}
legend {background: #141; color: #DFD; padding: 0.4em}
fieldset {background: #EFE; width: 28em}
@@ -108,16 +108,8 @@ _html do
.stdout {background-color: yellow; margin: 0}
.stderr {background-color: red; color: white; margin: 0}
pre.email {background-color: #BDF; padding: 1em 3em; border-radius: 1em}
- EOF
-
- ENV['SCRIPT_FILENAME'] =~ /(.*)/
- sf = $1
- sf.untaint
-
- ENV['DOCUMENT_ROOT'] =~ /(.*)/
- dr = $1
- dr.untaint
-
+ }
+
_script %{
$(function() {
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 09/11: authentication; cleanup
Posted by ru...@apache.org.
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 48d5cc251d1c514397acae40d24d02beff5c4245
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 20:03:47 2016 -0400
authentication; cleanup
---
www/officers/acreq.cgi | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index 1831b87..c7ad748 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -18,9 +18,13 @@ require 'whimsy/asf'
require 'mail'
require 'date'
require 'open3'
-require 'pathname'
-require 'rexml/document'
-require 'net/http'
+
+user = ASF::Person.new($USER)
+unless user.asf_member? or ASF.pmc_chairs.include? user
+ print "Status: 401 Unauthorized\r\n"
+ print "WWW-Authenticate: Basic realm=\"ASF Members and Officers\"\r\n\r\n"
+ exit
+end
# List of unix groups that do NOT correspond to PMCs
NON_PMC_UNIX_GROUPS = %w(
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 01/11: original version of submit-account-request.rb
Posted by ru...@apache.org.
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 3d3e1cc5318f02ca0f1df5eadca0bcbcc92d949a
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 15:17:31 2016 -0400
original version of submit-account-request.rb
copied from https://s.apache.org/FrTq
Runs slowly on https://id.apache.org/acreq/ for reasons unknown.
Uses old versions of dependencies. And all users are updating a common
checkout of data from svn. Intent is to modernize the code, and in the
process identify and fix the performance issue.
---
www/officers/acreq.cgi | 458 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 458 insertions(+)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
new file mode 100755
index 0000000..7ee9e5e
--- /dev/null
+++ b/www/officers/acreq.cgi
@@ -0,0 +1,458 @@
+#!/usr/bin/ruby
+#
+# Just for demo purposes at the moment. Builds a properly formatted
+# and validated new-account-reqs.txt entry based on web input. With
+# the proper browser and with jquery installed, this will do full client
+# side validation. Server-side validation will also be done.
+#
+# In demo mode, this script simply shows the formatted line that would
+# be added to the file and the email to be sent. In non-demo mode, it
+# actually appends the line to the file and issue a svn commit, returns
+# the messages produced by the commit (if any) in the response, and
+# sends an email to root (copying the relevant pmc private list) of the
+# request.
+#
+# Prereqs:
+#
+# * svn checkout of infra/infrastructure/trunk and foundation/officers
+# * Web server with the ability to run cgi (Apache httpd recommended)
+# * Ruby 1.8.x or later
+# * cgi-spa and mail gems ([sudo] gem install cgi-spa mail)
+# * (optional) jQuery http://code.jquery.com/jquery.min.js
+#
+# Installation instructions:
+#
+# ruby submit-account-request.rb --install=/var/www
+#
+# 1) Specify a path that supports cgi, like public-html or Sites.
+# 2) Tailor the paths and smtp settings in the generated
+# submit-account-request.cgi as necessary.
+# 3) Download jQuery from the link above into either the directory
+# containing the CGI or in the DOCUMENT_ROOT for the web server
+#
+# Execution instructions:
+#
+# Point your web browser at your generated cgi script. For best results,
+# use a browser that implements HTML5 form validation.
+
+$SAFE=1
+
+require 'rubygems'
+require 'cgi-spa'
+require 'mail'
+require 'date'
+require 'open3'
+require 'pathname'
+require 'rexml/document'
+require 'net/http'
+
+
+# List of unix groups that do NOT correspond to PMCs
+NON_PMC_UNIX_GROUPS = %w(
+ apsite
+ audit
+ board
+ committers
+ concom
+ db-site
+ incubator-site
+ member
+)
+
+SVN = "/usr/bin/svn"
+
+# get up to date...
+`#{SVN} cleanup #{INFRA}/acreq #{OFFICERS} #{APMAIL}/bin`
+`#{SVN} revert -R #{INFRA}/acreq`
+unless `#{SVN} status -q #{INFRA}/acreq`.empty?
+ raise "acreq/ working copy is dirty"
+end
+`#{SVN} update --ignore-externals #{INFRA}/acreq #{OFFICERS} #{APMAIL}/bin`
+
+REQUESTS = "#{INFRA}/acreq/new-account-reqs.txt"
+
+# grab the current list of PMCs from ldap
+pmcs = `/usr/local/bin/list_unix_group.pl`.chomp.split("\n") - NON_PMC_UNIX_GROUPS
+
+# grab the list of podling mailing lists from apmail
+podlings = REXML::Document.new(
+ Net::HTTP.get_response(URI.parse 'http://incubator.apache.org/podlings.xml').body
+ ).root.elements.collect { |x| x.attributes['status'] == 'current' && x.attributes['resource'] }.select { |x| x }.sort
+
+# grab the list of iclas that have no ids assigned
+query_string = CGI::parse ENV['QUERY_STRING']
+if query_string.has_key? 'fulllist'
+ iclas = Hash[*File.read("#{OFFICERS}/iclas.txt").
+ scan(/^notinavail:.*?:(.*?):(.*?):Signed CLA/).flatten.reverse]
+else
+ oldrev = \
+ `#{SVN} log --incremental -q -r HEAD:0 -l300 -- #{OFFICERS}/iclas.txt`.
+ split("\n")[-1].split()[0][1..-1].to_i
+ iclas = Hash[*`#{SVN} diff -r #{oldrev}:HEAD -- #{OFFICERS}/iclas.txt`.
+ scan(/^[+]notinavail:.*?:(.*?):(.*?):Signed CLA/).flatten.reverse]
+end
+
+# grab the list of userids that have been assigned (for validation purposes)
+taken = File.read("#{OFFICERS}/iclas.txt").scan(/^(\w+?):/).flatten.sort.uniq
+
+# add the list of userids that are pending
+taken += File.read(REQUESTS).scan(/^(\w.*?);/).flatten
+
+# add member ids that do not have ICLAs
+taken += %w(andi andrei arved dgaudet pcs rasmus ssb zeev)
+
+# add list of ids that match ones with embedded hyphens, e.g. an-selm (INFRA-7390)
+taken += %w(an james jean rgb soc swaroop)
+
+# add list of tokens that could be mistaken for names
+taken += %w(r rw)
+
+# get a list of pending new account requests (by email)
+pending = File.read(REQUESTS).scan(/^\w.*?;.*?;(.*?);/).flatten
+
+# remove pending email addresses from the selection list
+pending.each {|email| iclas.delete email}
+
+# HTML output
+$cgi.html do |x|
+ x.head do
+ x.meta :charset => 'utf-8'
+ x.title 'Submit ASF Account Request'
+
+ x.style! <<-'EOF'
+ label {width: 6em; float: left}
+ legend {background: #141; color: #DFD; padding: 0.4em}
+ fieldset {background: #EFE; width: 28em}
+ fieldset div {clear: both; padding: 0.4em 0 0 1.5em}
+ input,textarea {width: 3in}
+ select {width: 3.06in}
+ input[type=checkbox] {margin-left: 6em; width: 1em}
+ input[type=submit] {margin-top: 0.5em; margin-left: 3em; width: 8em}
+ .error {margin: 1em; padding: 1em; background: red; color: white}
+ .stdout {background-color: yellow; margin: 0}
+ .stderr {background-color: red; color: white; margin: 0}
+ pre.email {background-color: #BDF; padding: 1em 3em; border-radius: 1em}
+ EOF
+
+ ENV['SCRIPT_FILENAME'] =~ /(.*)/
+ sf = $1
+ sf.untaint
+
+ ENV['DOCUMENT_ROOT'] =~ /(.*)/
+ dr = $1
+ dr.untaint
+
+ if (Pathname(sf).dirname + 'jquery.min.js').exist?
+ src = 'jquery.min.js'
+ elsif (Pathname(dr) + 'jquery.min.js').exist?
+ src = '/jquery.min.js'
+ else
+ src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'
+ end
+
+ x.script '', :src => src
+
+ scriptSrc = <<-EOF
+ $(function() {
+
+ // if name changes, change email to match
+ $('#name').change(function() {
+ $("option:selected").each(function() {
+ var email = $(this).attr('data-email');
+ if (email) $('#email').val(email);
+ });
+ });
+
+ // if email changes, change name to match
+ $('#email').change(function() {
+ $("option:selected").each(function() {
+ var name = $(this).attr('data-name');
+ if (name) $('#name').val(name);
+ });
+ });
+
+ // if user changes, validate that the id is available
+ $('#user').focus().blur(function() {
+ if ($.inArray($(this).val(),#{taken.to_json}) != -1) {
+ this.setCustomValidity('userid is not available');
+ } else {
+ this.setCustomValidity('');
+ }
+ });
+
+ // if pmc is incubator, enable podling, else disable and clear podling
+ $('#pmc').change(function() {
+ if ($(this).val() == 'incubator') {
+ $('#podling').removeAttr('disabled', 'disabled');
+ } else {
+ $('#podling').attr('disabled', 'disabled')[0].
+ selectedIndex = -1;
+ }
+ });
+
+ // allow selected fields to be set based on parameters passed
+ if (#{$param.user.to_s.inspect} != '')
+ $('#user').val(#{$param.user.to_s.inspect});
+ $('#email').val(#{$param.email.to_s.inspect}).trigger('change');
+ $('#pmc').val(#{$param.pmc.to_s.inspect}).trigger('change').
+ attr('required', 'required');
+ $('#podling').val(#{$param.podling.to_s.inspect});
+ if (#{$param.votelink.to_s.inspect} != '')
+ $('#votelink').val(#{$param.votelink.to_s.inspect});
+ });
+ EOF
+ x.script scriptSrc, :type => "text/javascript"
+ end
+
+ x.body do
+ x.form :method=>'post' do
+ x.fieldset do
+ x.legend 'ASF New Account Request'
+
+ x.div do
+ x.label 'User ID', :for=>"user"
+ x.input :name=>"user", :id=>"user", :autofocus => "autofocus",
+ :type=>"text", :required => "required",
+ :pattern => '^[a-z][-a-z0-9_]+$' # useridvalidationpattern dup
+ end
+
+ x.div do
+ x.label 'Name', :for=>"name"
+ x.select :name=>"name", :id=>"name", :required => "required" do
+ x.option '', :value => ''
+ iclas.invert.to_a.sort.each do |name, email|
+ x.option name, :value => name, 'data-email' => email
+ end
+ end
+ end
+
+ x.div do
+ x.label 'Email', :for=>"email"
+ x.select :name=>"email", :id=>"email", :required => "required" do
+ x.option '', :value => ''
+ iclas.to_a.sort_by {|email, name| email.downcase}.
+ each do |email, name|
+ x.option email.downcase, :value => email, 'data-name' => name
+ end
+ end
+ end
+
+ x.div do
+ x.label 'PMC', :for=>"pmc"
+ x.select :name=>"pmc", :id=>"pmc" do
+ x.option '', :value => ''
+ pmcs.each do |pmc|
+ x.option pmc, {:value => pmc}
+ end
+ end
+ end
+
+ x.div do
+ x.label 'Podling', :for=>"podling"
+ x.select :name=>"podling", :id=>"podling" do
+ x.option '', :value => ''
+ podlings.each do |podling|
+ x.option podling, {:value => podling}
+ end
+ end
+ end
+
+ x.div do
+ x.label 'Vote Link', :for=>"votelink"
+ x.input :name=>"votelink", :id=>"votelink", :type=>"text",
+ :pattern => '.*://.*|.*@.*'
+ end
+
+ x.div do
+ x.label 'Comments', :for=>"comments"
+ x.textarea "", :name=>"comments", :id=>"comments"
+ end
+
+ x.input :type=>"submit", :value=>"Submit"
+ end
+ end
+
+ if $HTTP_POST
+ # server side validation
+ if pending.include? $param.email
+ x.div "Account request already pending for #{$param.email}", :class => 'error'
+ elsif taken.include? $param.user
+ x.div "UserID #{$param.user} is not available", :class => 'error'
+ elsif $param.user !~ /^[a-z][a-z0-9_]+$/ # useridvalidationpattern dup (disallow '-' in names because of INFRA-7390)
+ x.div "Invalid userID #{$param.user}", :class => 'error'
+ elsif $param.user.length > 16
+ # http://forums.freebsd.org/showthread.php?t=14636
+ x.div "UserID #{$param.user} is too long (max 16)", :class => 'error'
+ elsif $param.pmc !~ /^[0-9a-z-]+$/
+ x.div "Unsafe PMC #{$param.pmc}", :class => 'error'
+ elsif $param.podling and $param.podling !~ /^[0-9a-z-]*$/
+ x.div "Unsafe podling name #{$param.podling}", :class => 'error'
+ elsif not iclas.include? $param.email
+ x.div "No ICLA on record for #{$param.email}", :class => 'error'
+ elsif not iclas[$param.email] == $param.name
+ x.div "Name #{$param.name} does not match name on ICLA", :class => 'error'
+ elsif not pmcs.include? $param.pmc
+ x.div "Unrecognized PMC name #{$param.pmc}", :class => 'error'
+ else
+
+ # verb tense to be used in messages
+ tobe = 'to be ' if DEMO_MODE
+
+ # capture submitter information
+ ENV['REMOTE_USER'] =~ /(\w+)/
+ submitter_id = $1
+ submitter_id.untaint
+
+ submitter_name =
+ File.read("#{OFFICERS}/iclas.txt")[/^#{submitter_id}:.*?:(.*?):/,1]
+ submitter_name.untaint
+
+ # build the line to be added
+ line = "#{$param.user};#{$param.name};#{$param.email};#{$param.pmc};" +
+ "#{$param.pmc};#{Date.today.strftime('%m-%d-%Y')};yes;yes;no;"
+
+ # determine the requesting party and cc_list
+ $param.pmc =~ /([\w.-]+)/
+ requestor = $1
+ requestor.untaint
+ cc_list = ["private@#{$param.pmc}.apache.org".untaint]
+ if requestor == 'incubator' and not $param.podling.empty?
+ if File.read("#{APMAIL}/bin/.archives").include? "incubator-#{$param.podling}-private"
+ cc_list << "#{$param.podling}-private@#{$param.pmc}.apache.org".untaint
+ else
+ cc_list << "private@#{$param.podling}.#{$param.pmc}.apache.org".untaint
+ end
+ requestor = "#{$param.podling}@incubator".untaint
+ end
+ cc_list << "<#{$param.email}>".untaint # TODO: add $param.name RFC822-escaped
+
+ # build the mail to be sent
+ mail = Mail.new do
+ if submitter_name
+ from "#{submitter_name} <#{...@apache.org>"
+ else
+ from "#{submitter_id}@apache.org"
+ end
+ return_path "root@apache.org"
+ to "root@apache.org"
+ cc cc_list
+ subject "[FORM] Account Request - #{requestor}: #{$param.name}"
+
+ ENV['REMOTE_ADDR'] =~ /(\w[\w.-]+)/
+ ra = $1
+ ra.untaint
+
+ body <<-EOF.gsub(/^ {12}/, '').gsub(/(Vote reference:)?\n\s+\n/, "\n\n")
+ Prospective userid: #{$param.user}
+ Full name: #{$param.name}
+ Forwarding email address: #{$param.email}
+
+ Vote reference:
+ #{$param.votelink.gsub('mail-search.apache.org/pmc/', 'mail-search.apache.org/members/')}
+
+ #{$param.comments}
+
+ --
+ Submitted by https://#{ENV['HTTP_HOST']}#{ENV['REQUEST_URI'].split('?').first}
+ From #{`/usr/bin/host #{ra}`.chomp}
+ Using #{ENV['HTTP_USER_AGENT']}
+ EOF
+ end
+
+ unless DEMO_MODE
+ # deliver the email. Done first as undeliverable mail stops
+ # the process
+ begin
+ mail.deliver!
+ rescue Exception => exception
+ x.pre exception.inspect, :class => 'error'
+ tobe = 'would have been '
+ end
+ end
+
+ unless tobe
+ # Update the new-account-reqs file...
+ requests = File.read(REQUESTS)
+ File.open(REQUESTS, 'w') do |file|
+ file.write("#{requests}#{line}\n")
+ end
+
+ # and commit the change ...
+ command = "#{SVN} commit #{INFRA}/acreq/new-account-reqs.txt -m " +
+ "#{requestor} account request by #{submitter_id}".inspect
+ x.h2 'Commit messages'
+ Open3.popen3(command) do |pin, pout, perr|
+ [
+ Thread.new do
+ x.p pout.readline.chomp, :class=>'stdout' until pout.eof?
+ end,
+ Thread.new do
+ x.p perr.readline.chomp, :class=>'stderr' until perr.eof?
+ end,
+ Thread.new do
+ pin.close
+ end
+ ].each {|thread| thread.join}
+ end
+ end
+
+ # report on status
+ x.h2 "New entry #{tobe}added:"
+ x.pre line
+ x.h2 "Mail #{tobe}sent:"
+ x.pre mail.to_s, :class => 'email'
+ end
+ end
+
+ unless $HTTP_POST
+ x.p do
+ if query_string.has_key? 'fulllist'
+ x.span 'This page shows all ICLAs ever received. Click here to'
+ x.a 'show only ICLAs received recently', :href => '?'
+ x.span '.'
+ else
+ x.span 'This page shows only ICLAs received recently. Click here to'
+ x.a 'choose from the full list of ICLA submitters', :href => '?fulllist=1'
+ x.span '.'
+ end
+ end
+ end
+ end
+end
+
+__END__
+# Doesn't actually have any effect !? The one in the .rb file has an effect.
+$SAFE = 1
+
+# tailor these lines as necessary
+INFRA = '..'
+APMAIL = '../../apmail'
+OFFICERS = '../../foundation/officers'
+
+# uncomment the next line if you have installed gems in a non-standard location
+# ENV['GEM_PATH'] = '/prefix/install-dir'
+
+require 'rubygems'
+require 'mail'
+
+# customize the delivery method
+Mail.defaults do
+ # probably will work out of the box on ASF hardware
+ delivery_method :sendmail
+
+### For comparison, here's how to connect to gmail
+# delivery_method :smtp,
+# :address => "smtp.gmail.com",
+# :port => 587,
+# :domain => "apache.org",
+# :authentication => "plain",
+# :user_name => "username",
+# :password => "password",
+# :enable_starttls_auto => true
+end
+
+# this should be pretty self evident
+DEMO_MODE = true
+
+# potentially useful when installed on a personal machine
+# ENV['REMOTE_USER'] ||= `/usr/bin/whoami`.chomp
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 06/11: rely on cron jobs to keep svn up to date
Posted by ru...@apache.org.
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 dcd93cb5a1770905ba4929d4cf9e7a50b681da31
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 17:11:20 2016 -0400
rely on cron jobs to keep svn up to date
---
www/officers/acreq.cgi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index ea4c4f1..f2ccdba 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -46,7 +46,7 @@ APMAIL_BIN = ASF::SVN['infra/infrastructure/apmail/trunk/bin']
unless `#{SVN} status -q #{ACREQ}`.empty?
raise "acreq/ working copy is dirty"
end
-`#{SVN} update --ignore-externals #{ACREQ} #{OFFICERS} #{APMAIL_BIN}`
+`#{SVN} update --ignore-externals #{ACREQ}`
REQUESTS = "#{ACREQ}/new-account-reqs.txt"
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 10/11: only active podlings
Posted by ru...@apache.org.
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 a69666086702f311d53e2041974b48dc5dffac74
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Thu Aug 4 08:50:42 2016 -0400
only active podlings
---
www/officers/acreq.cgi | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index c7ad748..986dbab 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -49,8 +49,9 @@ REQUESTS = "#{ACREQ}/new-account-reqs.txt"
# grab the current list of PMCs from ldap
pmcs = ASF::Committee.list.map(&:name).sort - NON_PMC_UNIX_GROUPS
-# grab the list of podling mailing lists from apmail
-podlings = ASF::Podling.list.map(&:name).sort
+# grab the list of active podlings
+podlings = ASF::Podling.list.select {|podling| podling.status == 'current'}.
+ map(&:name).sort
# grab the list of iclas that have no ids assigned
query_string = CGI::parse ENV['QUERY_STRING']
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 04/11: start to take advantage of Whimsy library methods
Posted by ru...@apache.org.
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 4a9ccc72d784b39fcc4f22b4df0ddd38066311e7
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Wed Aug 3 16:53:39 2016 -0400
start to take advantage of Whimsy library methods
---
www/officers/acreq.cgi | 28 ++--------------------------
1 file changed, 2 insertions(+), 26 deletions(-)
diff --git a/www/officers/acreq.cgi b/www/officers/acreq.cgi
index ca102c6..bb9aa30 100755
--- a/www/officers/acreq.cgi
+++ b/www/officers/acreq.cgi
@@ -12,28 +12,6 @@
# the messages produced by the commit (if any) in the response, and
# a copy of the email that was sent.
#
-# Prereqs:
-#
-# * svn checkout of infra/infrastructure/trunk and foundation/officers
-# * Web server with the ability to run cgi (Apache httpd recommended)
-# * Ruby 1.8.x or later
-# * cgi-spa and mail gems ([sudo] gem install cgi-spa mail)
-# * (optional) jQuery http://code.jquery.com/jquery.min.js
-#
-# Installation instructions:
-#_.post?
-# ruby submit-account-request.rb --install=/var/www
-#
-# 1) Specify a path that supports cgi, like public-html or Sites.
-# 2) Tailor the paths and smtp settings in the generated
-# submit-account-request.cgi as necessary.
-# 3) Download jQuery from the link above into either the directory
-# containing the CGI or in the DOCUMENT_ROOT for the web server
-#
-# Execution instructions:
-#
-# Point your web browser at your generated cgi script. For best results,
-# use a browser that implements HTML5 form validation.
require 'wunderbar'
require 'whimsy/asf'
@@ -73,12 +51,10 @@ end
REQUESTS = "#{ACREQ}/new-account-reqs.txt"
# grab the current list of PMCs from ldap
-pmcs = `/usr/local/bin/list_unix_group.pl`.chomp.split("\n") - NON_PMC_UNIX_GROUPS
+pmcs = ASF::Committee.list.map(&:name).sort - NON_PMC_UNIX_GROUPS
# grab the list of podling mailing lists from apmail
-podlings = REXML::Document.new(
- Net::HTTP.get_response(URI.parse 'http://incubator.apache.org/podlings.xml').body
- ).root.elements.collect { |x| x.attributes['status'] == 'current' && x.attributes['resource'] }.select { |x| x }.sort
+podlings = ASF::Podling.list.map(&:name).sort
# grab the list of iclas that have no ids assigned
query_string = CGI::parse ENV['QUERY_STRING']
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.