Rush has uploaded a new change for review.
https://gerrit.wikimedia.org/r/181609
Change subject: add LDAP username / link to profile to profile
......................................................................
add LDAP username / link to profile to profile
Some people (like me) have different names on wikitech
than on Phab or other systems (including IRC).
Change-Id: I0c2c4a6234a756c268a18e154855a35f119263bb
---
A LDAPUserpageCustomField.php
1 file changed, 44 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions
refs/changes/09/181609/1
diff --git a/LDAPUserpageCustomField.php b/LDAPUserpageCustomField.php
new file mode 100644
index 0000000..b5d5558
--- /dev/null
+++ b/LDAPUserpageCustomField.php
@@ -0,0 +1,44 @@
+<?php
+
+final class LDAPUserpageCustomField extends PhabricatorUserCustomField {
+
+ public function shouldUseStorage() {
+ return false;
+ }
+
+ public function getFieldKey() {
+ return 'ldap:externalaccount';
+ }
+
+ public function shouldAppearInPropertyView() {
+ return true;
+ }
+
+ public function renderPropertyViewLabel() {
+ return pht('LDAP Username');
+ }
+
+ public function renderPropertyViewValue(array $handles) {
+ $user = $this->getObject();
+
+ $account = id(new PhabricatorExternalAccount())->loadOneWhere(
+ 'userPHID = %s AND accountType = %s',
+ $user->getPHID(),
+ 'ldap');
+
+ if (! $account || !strlen($account->getusername())) {
+ return pht('Unknown');
+ }
+ $url = 'https://wikitech.wikimedia.org/wiki/User:';
+ $name = $account->getusername();
+ $uri = urldecode($url . $name);
+
+ return phutil_tag(
+ 'a',
+ array(
+ 'href' => $uri
+ ),
+ $name);
+ }
+
+}
--
To view, visit https://gerrit.wikimedia.org/r/181609
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0c2c4a6234a756c268a18e154855a35f119263bb
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions
Gerrit-Branch: master
Gerrit-Owner: Rush <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits