This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 1ad3714 add server side validation
1ad3714 is described below
commit 1ad37147718697341cdf28225e5d7232fbf0fe1a
Author: Sam Ruby <[email protected]>
AuthorDate: Sat Oct 7 08:32:29 2017 -0400
add server side validation
---
www/roster/views/actions/committee.json.rb | 9 +++++++--
www/roster/views/actions/ppmc.json.rb | 9 +++++----
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/www/roster/views/actions/committee.json.rb
b/www/roster/views/actions/committee.json.rb
index 6e78fc5..cf6f909 100644
--- a/www/roster/views/actions/committee.json.rb
+++ b/www/roster/views/actions/committee.json.rb
@@ -1,8 +1,13 @@
if env.password
- people = @ids.split(',').map {|id| ASF::Person.find(id)}
- pmc = ASF::Committee.find(@project)
+ people = @ids.split(',').map {|id| ASF::Person[id]}
+
+ pmc = ASF::Committee[@project]
group = ASF::Group.find(@project) if @targets.include? 'commit'
+ # validate arguments
+ raise ArgumentError.new("ids=#{@ids}") if people.any? {|person| person.nil?}
+ raise ArgumentError.new("project=#{@project}") unless pmc
+
# update LDAP
if @targets.include? 'pmc' or @targets.include? 'commit'
ASF::LDAP.bind(env.user, env.password) do
diff --git a/www/roster/views/actions/ppmc.json.rb
b/www/roster/views/actions/ppmc.json.rb
index 614f91f..4cb68f6 100644
--- a/www/roster/views/actions/ppmc.json.rb
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -1,17 +1,18 @@
if env.password
people = @ids.split(',').map {|id| ASF::Person[id]}
- # validate ids
- raise ArgumentError.new("ids=#{@ids}") if people.any? {|person| person.nil?}
-
# if target is ONLY icommit, use incubator in the email message, etc.
# Otherwise, use the project (podling).
if @targets == ['icommit']
project = ASF::Project.find('incubator')
else
- project = ASF::Project.find(@project)
+ project = ASF::Project[@project]
end
+ # validate arguments
+ raise ArgumentError.new("ids=#{@ids}") if people.any? {|person| person.nil?}
+ raise ArgumentError.new("project=#{@project}") unless project
+
# update LDAP
if %w(ppmc committer icommit).any? {|target| @targets.include? target}
ASF::LDAP.bind(env.user, env.password) do
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].