Index: trunk/extensions/OpenStackManager/OpenStackNovaRole.php |
— | — | @@ -77,15 +77,26 @@ |
78 | 78 | * @return array |
79 | 79 | */ |
80 | 80 | function getMembers() { |
| 81 | + global $wgAuth; |
| 82 | + |
81 | 83 | $members = array(); |
82 | 84 | if ( isset( $this->roleInfo[0]['member'] ) ) { |
83 | 85 | $memberdns = $this->roleInfo[0]['member']; |
84 | 86 | array_shift( $memberdns ); |
85 | 87 | foreach ( $memberdns as $memberdn ) { |
86 | | - $member = explode( '=', $memberdn ); |
87 | | - $member = explode( ',', $member[1] ); |
88 | | - $member = $member[0]; |
89 | | - $members[] = $member; |
| 88 | + $searchattr = $wgAuth->getSearchAttribute(); |
| 89 | + if ( $searchattr ) { |
| 90 | + // We need to look up the search attr from the user entry |
| 91 | + // this is expensive, but must be done. |
| 92 | + // TODO: memcache this |
| 93 | + $userInfo = $wgAuth->getUserInfoStateless( $memberdn ); |
| 94 | + $members[] = $userInfo[0][$searchattr][0]; |
| 95 | + } else { |
| 96 | + $member = explode( '=', $memberdn ); |
| 97 | + $member = explode( ',', $member[1] ); |
| 98 | + $member = $member[0]; |
| 99 | + $members[] = $member; |
| 100 | + } |
90 | 101 | } |
91 | 102 | } |
92 | 103 | |
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php |
— | — | @@ -73,15 +73,26 @@ |
74 | 74 | * @return array |
75 | 75 | */ |
76 | 76 | function getMembers() { |
| 77 | + global $wgAuth; |
| 78 | + |
77 | 79 | $members = array(); |
78 | 80 | if ( isset( $this->projectInfo[0]['member'] ) ) { |
79 | 81 | $memberdns = $this->projectInfo[0]['member']; |
80 | 82 | array_shift( $memberdns ); |
81 | 83 | foreach ( $memberdns as $memberdn ) { |
82 | | - $member = explode( '=', $memberdn ); |
83 | | - $member = explode( ',', $member[1] ); |
84 | | - $member = $member[0]; |
85 | | - $members[] = $member; |
| 84 | + $searchattr = $wgAuth->getSearchAttribute(); |
| 85 | + if ( $searchattr ) { |
| 86 | + // We need to look up the search attr from the user entry |
| 87 | + // this is expensive, but must be done. |
| 88 | + // TODO: memcache this |
| 89 | + $userInfo = $wgAuth->getUserInfoStateless( $memberdn ); |
| 90 | + $members[] = $userInfo[0][$searchattr][0]; |
| 91 | + } else { |
| 92 | + $member = explode( '=', $memberdn ); |
| 93 | + $member = explode( ',', $member[1] ); |
| 94 | + $member = $member[0]; |
| 95 | + $members[] = $member; |
| 96 | + } |
86 | 97 | } |
87 | 98 | } |
88 | 99 | |
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php |
— | — | @@ -20,12 +20,13 @@ |
21 | 21 | */ |
22 | 22 | function fetchUserInfo() { |
23 | 23 | global $wgAuth, $wgUser; |
24 | | - global $wgOpenStackManagerLDAPUseUidAsNamingAttribute; |
25 | 24 | |
26 | | - if ( $this->username && !$wgOpenStackManagerLDAPUseUidAsNamingAttribute ) { |
| 25 | + if ( $this->username ) { |
27 | 26 | $this->userDN = $wgAuth->getUserDN( strtolower( $this->username ) ); |
| 27 | + $wgAuth->printDebug( "Fetching userdn using username: $this->userDN ", NONSENSITIVE ); |
28 | 28 | } else { |
29 | 29 | $this->userDN = $wgAuth->getUserDN( strtolower( $wgUser->getName() ) ); |
| 30 | + $wgAuth->printDebug( "Fetching userdn using wiki name: $this->userDN", NONSENSITIVE ); |
30 | 31 | } |
31 | 32 | $this->userInfo = $wgAuth->userInfo; |
32 | 33 | } |