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 2018/02/23 23:18:43 UTC

[whimsy] branch master updated: don't always assume that the uid is new

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 59860d6  don't always assume that the uid is new
59860d6 is described below

commit 59860d6fa7436c4b35a4ece72f4dfd9b82d5c66f
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Fri Feb 23 18:18:29 2018 -0500

    don't always assume that the uid is new
---
 lib/whimsy/asf/ldap.rb | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/whimsy/asf/ldap.rb b/lib/whimsy/asf/ldap.rb
index 013cdbb..709b42f 100644
--- a/lib/whimsy/asf/ldap.rb
+++ b/lib/whimsy/asf/ldap.rb
@@ -808,12 +808,14 @@ module ASF
 
       availid = attrs['uid']
 
-      # determine next uid and group
-      nextuid = ASF::search_one(ASF::Person.base, 'uid=*', 'uidNumber').
-        flatten.map(&:to_i).max + 1
-
-      nextgid = ASF::search_one(group_base, 'cn=*', 'gidNumber').
-        flatten.map(&:to_i).max + 1
+      # determine next uid and group, unless provided
+      nextuid = attrs['uidNumber'] || 
+        ASF::search_one(ASF::Person.base, 'uid=*', 'uidNumber').
+          flatten.map(&:to_i).max + 1
+
+      nextgid = attrs['gidNumber'] ||
+        ASF::search_one(group_base, 'cn=*', 'gidNumber').
+          flatten.map(&:to_i).max + 1
  
       # fixed attributes
       attrs.merge!({

-- 
To stop receiving notification emails like this one, please contact
rubys@apache.org.