Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F22947574
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
10 KB
Subscribers
None
View Options
diff --git a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
index baffd7706..4992833c5 100644
--- a/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
+++ b/src/applications/drydock/management/DrydockManagementLeaseWorkflow.php
@@ -1,102 +1,102 @@
<?php
final class DrydockManagementLeaseWorkflow
extends DrydockManagementWorkflow {
protected function didConstruct() {
$this
->setName('lease')
->setSynopsis(pht('Lease a resource.'))
->setArguments(
array(
array(
'name' => 'type',
'param' => 'resource_type',
'help' => pht('Resource type.'),
),
array(
'name' => 'until',
'param' => 'time',
'help' => pht('Set lease expiration time.'),
),
array(
'name' => 'attributes',
'param' => 'name=value,...',
- 'help' => pht('Resource specficiation.'),
+ 'help' => pht('Resource specification.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$resource_type = $args->getArg('type');
if (!$resource_type) {
throw new PhutilArgumentUsageException(
pht(
'Specify a resource type with `%s`.',
'--type'));
}
$until = $args->getArg('until');
if (strlen($until)) {
$until = strtotime($until);
if ($until <= 0) {
throw new PhutilArgumentUsageException(
pht(
'Unable to parse argument to "%s".',
'--until'));
}
}
$attributes = $args->getArg('attributes');
if ($attributes) {
$options = new PhutilSimpleOptions();
$options->setCaseSensitive(true);
$attributes = $options->parse($attributes);
}
$lease = id(new DrydockLease())
->setResourceType($resource_type);
$drydock_phid = id(new PhabricatorDrydockApplication())->getPHID();
$lease->setAuthorizingPHID($drydock_phid);
// TODO: This is not hugely scalable, although this is a debugging workflow
// so maybe it's fine. Do we even need `bin/drydock lease` in the long run?
$all_blueprints = id(new DrydockBlueprintQuery())
->setViewer($viewer)
->execute();
$allowed_phids = mpull($all_blueprints, 'getPHID');
if (!$allowed_phids) {
throw new Exception(
pht(
'No blueprints exist which can plausibly allocate resources to '.
'satisfy the requested lease.'));
}
$lease->setAllowedBlueprintPHIDs($allowed_phids);
if ($attributes) {
$lease->setAttributes($attributes);
}
if ($until) {
$lease->setUntil($until);
}
$lease->queueForActivation();
echo tsprintf(
"%s\n",
pht('Waiting for daemons to activate lease...'));
$lease->waitUntilActive();
echo tsprintf(
"%s\n",
pht('Activated lease "%s".', $lease->getID()));
return 0;
}
}
diff --git a/src/applications/harbormaster/stepgroup/HarbormasterExternalBuildStepGroup.php b/src/applications/harbormaster/stepgroup/HarbormasterExternalBuildStepGroup.php
index 274a25bfb..df92a2fd9 100644
--- a/src/applications/harbormaster/stepgroup/HarbormasterExternalBuildStepGroup.php
+++ b/src/applications/harbormaster/stepgroup/HarbormasterExternalBuildStepGroup.php
@@ -1,16 +1,16 @@
<?php
final class HarbormasterExternalBuildStepGroup
extends HarbormasterBuildStepGroup {
const GROUPKEY = 'harbormaster.external';
public function getGroupName() {
- return pht('Interacting with External Build Sytems');
+ return pht('Interacting with External Build Systems');
}
public function getGroupOrder() {
return 4000;
}
}
diff --git a/src/applications/people/controller/PhabricatorPeopleLdapController.php b/src/applications/people/controller/PhabricatorPeopleLdapController.php
index 1a6530ab3..876bf986a 100644
--- a/src/applications/people/controller/PhabricatorPeopleLdapController.php
+++ b/src/applications/people/controller/PhabricatorPeopleLdapController.php
@@ -1,214 +1,214 @@
<?php
final class PhabricatorPeopleLdapController
extends PhabricatorPeopleController {
public function handleRequest(AphrontRequest $request) {
$this->requireApplicationCapability(
PeopleCreateUsersCapability::CAPABILITY);
$admin = $request->getUser();
$content = array();
$form = id(new AphrontFormView())
->setAction($request->getRequestURI()
->alter('search', 'true')->alter('import', null))
->setUser($admin)
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('LDAP username'))
->setName('username'))
->appendChild(
id(new AphrontFormPasswordControl())
->setDisableAutocomplete(true)
->setLabel(pht('Password'))
->setName('password'))
->appendChild(
id(new AphrontFormTextControl())
->setLabel(pht('LDAP query'))
->setCaption(pht('A filter such as %s.', '(objectClass=*)'))
->setName('query'))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Search')));
$panel = id(new PHUIObjectBoxView())
->setHeaderText(pht('Import LDAP Users'))
->setForm($form);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
- pht('Import Ldap Users'),
+ pht('Import LDAP Users'),
$this->getApplicationURI('/ldap/'));
$nav = $this->buildSideNavView();
$nav->selectFilter('ldap');
$nav->appendChild($content);
if ($request->getStr('import')) {
$nav->appendChild($this->processImportRequest($request));
}
$nav->appendChild($panel);
if ($request->getStr('search')) {
$nav->appendChild($this->processSearchRequest($request));
}
return $this->newPage()
- ->setTitle(pht('Import Ldap Users'))
+ ->setTitle(pht('Import LDAP Users'))
->setCrumbs($crumbs)
->setNavigation($nav);
}
private function processImportRequest($request) {
$admin = $request->getUser();
$usernames = $request->getArr('usernames');
$emails = $request->getArr('email');
$names = $request->getArr('name');
$notice_view = new PHUIInfoView();
$notice_view->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
$notice_view->setTitle(pht('Import Successful'));
$notice_view->setErrors(array(
pht('Successfully imported users from LDAP'),
));
$list = new PHUIObjectItemListView();
$list->setNoDataString(pht('No users imported?'));
foreach ($usernames as $username) {
$user = new PhabricatorUser();
$user->setUsername($username);
$user->setRealname($names[$username]);
$email_obj = id(new PhabricatorUserEmail())
->setAddress($emails[$username])
->setIsVerified(1);
try {
id(new PhabricatorUserEditor())
->setActor($admin)
->createNewUser($user, $email_obj);
id(new PhabricatorExternalAccount())
->setUserPHID($user->getPHID())
->setAccountType('ldap')
->setAccountDomain('self')
->setAccountID($username)
->save();
$header = pht('Successfully added %s', $username);
$attribute = null;
$color = 'fa-check green';
} catch (Exception $ex) {
$header = pht('Failed to add %s', $username);
$attribute = $ex->getMessage();
$color = 'fa-times red';
}
$item = id(new PHUIObjectItemView())
->setHeader($header)
->addAttribute($attribute)
->setStatusIcon($color);
$list->addItem($item);
}
return array(
$notice_view,
$list,
);
}
private function processSearchRequest($request) {
$panel = new PHUIBoxView();
$admin = $request->getUser();
$search = $request->getStr('query');
$ldap_provider = PhabricatorLDAPAuthProvider::getLDAPProvider();
if (!$ldap_provider) {
throw new Exception(pht('No LDAP provider enabled!'));
}
$ldap_adapter = $ldap_provider->getAdapter();
$ldap_adapter->setLoginUsername($request->getStr('username'));
$ldap_adapter->setLoginPassword(
new PhutilOpaqueEnvelope($request->getStr('password')));
// This causes us to connect and bind.
// TODO: Clean up this discard mode stuff.
DarkConsoleErrorLogPluginAPI::enableDiscardMode();
$ldap_adapter->getAccountID();
DarkConsoleErrorLogPluginAPI::disableDiscardMode();
$results = $ldap_adapter->searchLDAP('%Q', $search);
foreach ($results as $key => $record) {
$account_id = $ldap_adapter->readLDAPRecordAccountID($record);
if (!$account_id) {
unset($results[$key]);
continue;
}
$info = array(
$account_id,
$ldap_adapter->readLDAPRecordEmail($record),
$ldap_adapter->readLDAPRecordRealName($record),
);
$results[$key] = $info;
$results[$key][] = $this->renderUserInputs($info);
}
$form = id(new AphrontFormView())
->setUser($admin);
$table = new AphrontTableView($results);
$table->setHeaders(
array(
pht('Username'),
pht('Email'),
pht('Real Name'),
pht('Import?'),
));
$form->appendChild($table);
$form->setAction($request->getRequestURI()
->alter('import', 'true')->alter('search', null))
->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Import')));
$panel->appendChild($form);
return $panel;
}
private function renderUserInputs($user) {
$username = $user[0];
return hsprintf(
'%s%s%s',
phutil_tag(
'input',
array(
'type' => 'checkbox',
'name' => 'usernames[]',
'value' => $username,
)),
phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => "email[$username]",
'value' => $user[1],
)),
phutil_tag(
'input',
array(
'type' => 'hidden',
'name' => "name[$username]",
'value' => $user[2],
)));
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, May 10, 8:24 AM (1 d, 7 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
c5/b3/0ad437960c928a017cfbebafc344
Attached To
rPHAB Phabricator
Event Timeline
Log In to Comment