You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2017/12/15 13:37:29 UTC

[whimsy] branch master updated: Simplify id validation - copy code from committee

This is an automated email from the ASF dual-hosted git repository.

sebb 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 beab937  Simplify id validation - copy code from committee
beab937 is described below

commit beab9374c9267dca7e48eaefcc9b32eb9ec84eb8
Author: Sebb <se...@apache.org>
AuthorDate: Fri Dec 15 13:37:15 2017 +0000

    Simplify id validation - copy code from committee
---
 www/roster/views/actions/ppmc.json.rb | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/www/roster/views/actions/ppmc.json.rb b/www/roster/views/actions/ppmc.json.rb
index 0f29252..fb476e5 100644
--- a/www/roster/views/actions/ppmc.json.rb
+++ b/www/roster/views/actions/ppmc.json.rb
@@ -1,6 +1,12 @@
 if env.password
-  # Allow for missing people
-  people = @ids.split(',').map {|id| ASF::Person[id] || ASF::Person.find(id) }
+
+  # validate ids
+  if @action == 'remove' 
+    people = @ids.split(',').map {|id| ASF::Person.find(id)}
+  else
+    people = @ids.split(',').map {|id| ASF::Person[id]}
+    raise ArgumentError.new("ids=#{@ids}") if people.any? {|person| person.nil?}
+  end
 
   # if target is ONLY icommit, use incubator in the email message, etc.
   # Otherwise, use the project (podling).
@@ -10,11 +16,6 @@ if env.password
     project = ASF::Project[@project]
   end
 
-  # validate arguments (dn attribute is only present for real people)
-  if @action != 'remove' and people.any? {|person| person.attrs['dn'].nil?}
-    raise ArgumentError.new("ids=#{@ids}") 
-  end
-
   unless @action == 'add' and @targets.include? 'ldap'
     raise ArgumentError.new("project=#{@project}") unless project
   end

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