20after4 has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/258515

Change subject: OSM trying not to create empty groups
......................................................................

OSM trying not to create empty groups

The move to openldap has broken project creation
seemingly based on openldap's sane coherence to rfc's

Bug: T121064

Change-Id: Idfe00340555edc11659cb3705368bd61813065d5
(cherry picked from commit c77d206e0ec9d9fc3837249f508070e09aa51af1)
---
M nova/OpenStackNovaProjectGroup.php
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenStackManager 
refs/changes/15/258515/1

diff --git a/nova/OpenStackNovaProjectGroup.php 
b/nova/OpenStackNovaProjectGroup.php
index 9d4a80b..ea075fa 100644
--- a/nova/OpenStackNovaProjectGroup.php
+++ b/nova/OpenStackNovaProjectGroup.php
@@ -251,11 +251,20 @@
        static function createProjectGroup( $projectname ) {
                global $wgAuth;
                global $wgOpenStackManagerLDAPProjectGroupBaseDN;
+               global $wgOpenStackManagerLDAPUsername;
 
                OpenStackNovaLdapConnection::connect();
 
+               $user = new OpenStackNovaUser( $wgOpenStackManagerLDAPUsername 
);
+
+                if ( ! $user->userDN ) {
+                        $wgAuth->printDebug( "Failed to find userDN in 
createProjectGroup", NONSENSITIVE );
+                        return false;
+                }
+
                $projectGroupName = self::$prefix . $projectname;
                $projectGroup = array();
+               $projectGroup['member'][] = $user->userDN;
                $projectGroup['objectclass'][] = 'posixgroup';
                $projectGroup['objectclass'][] = 'groupofnames';
                $projectGroup['cn'] = $projectGroupName;
@@ -269,6 +278,7 @@
                }
                else {
                        $wgAuth->printDebug( "Failed to add project group 
$projectGroupName: " . ldap_error( $wgAuth->ldapconn ), NONSENSITIVE );
+                        return false;
                }
                return $success;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/258515
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idfe00340555edc11659cb3705368bd61813065d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenStackManager
Gerrit-Branch: wmf/1.27.0-wmf.8
Gerrit-Owner: 20after4 <mmod...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to