whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: Distinguish empty owner list from missing LDAP
Date Tue, 18 Sep 2018 11:40:56 GMT
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 ac1ceca  Distinguish empty owner list from missing LDAP
ac1ceca is described below

commit ac1cecaac65664509b6797d5d1a1409e99f55c20
Author: Sebb <sebb@apache.org>
AuthorDate: Tue Sep 18 12:40:53 2018 +0100

    Distinguish empty owner list from missing LDAP
---
 lib/whimsy/asf/ldap.rb           | 5 +++++
 lib/whimsy/asf/podling.rb        | 4 ++++
 www/roster/models/ppmc.rb        | 1 +
 www/roster/views/ppmc/main.js.rb | 2 +-
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index afad201..c4b6f55 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -507,6 +507,11 @@ module ASF
     def self.mod_delete(attr, vals)
       ::LDAP::Mod.new(::LDAP::LDAP_MOD_DELETE, attr.to_s, Array(vals))
     end
+
+    def hasLDAP?
+      ASF.search_one(base, "cn=#{name}", 'cn').any?
+    end
+
   end
 
   # a hash of attributes which is not populated until the first attempt
diff --git a/lib/whimsy/asf/podling.rb b/lib/whimsy/asf/podling.rb
index a26d848..704bada 100644
--- a/lib/whimsy/asf/podling.rb
+++ b/lib/whimsy/asf/podling.rb
@@ -210,6 +210,10 @@ module ASF
       ASF::Project.find(id).members
     end
 
+    def hasLDAP?
+      ASF::Project.find(id).hasLDAP?
+    end
+
     # development mailing list associated with a given podling
     def dev_mail_list
       case name
diff --git a/www/roster/models/ppmc.rb b/www/roster/models/ppmc.rb
index 46768c8..351f2ef 100644
--- a/www/roster/models/ppmc.rb
+++ b/www/roster/models/ppmc.rb
@@ -67,6 +67,7 @@ class PPMC
       enddate: ppmc.enddate.to_s,
       status: ppmc.status,
       mentors: ppmc.mentors,
+      hasLDAP: ppmc.hasLDAP?,
       owners: ppmc.owners.map {|person| person.id},
       committers: ppmc.members.map {|person| person.id},
       roster: roster,
diff --git a/www/roster/views/ppmc/main.js.rb b/www/roster/views/ppmc/main.js.rb
index c287a9a..4b08d6b 100644
--- a/www/roster/views/ppmc/main.js.rb
+++ b/www/roster/views/ppmc/main.js.rb
@@ -76,7 +76,7 @@ class PPMC < Vue
             _br
             _ 'Note: to Add existing committers, please select the committer from the list
below and use the Modify button instead.'
           end
-        elsif @ppmc.owners.empty? and (@@auth.root or @@auth.secretary)
+        elsif not @ppmc.hasLDAP? and (@@auth.root or @@auth.secretary)
           _button.btn.btn_primary 'Create project in LDAP', onClick: self.post,
             disabled: @create_disabled
         end


Mime
View raw message