Page MenuHomestyx hydra

No OneTemporary

diff --git a/scripts/user/create_user.php b/scripts/user/create_user.php
new file mode 100755
index 0000000000..44173cbfd7
--- /dev/null
+++ b/scripts/user/create_user.php
@@ -0,0 +1,49 @@
+#!/usr/bin/env php
+<?php
+
+/*
+ * Copyright 2011 Facebook, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+$root = dirname(dirname(dirname(__FILE__)));
+require_once $root.'/scripts/__init_script__.php';
+require_once $root.'/scripts/__init_env__.php';
+
+if ($argc < 4) {
+ echo "usage: create_user.php <user_name> <real_name> <email> [--agent]\n";
+ die(1);
+}
+
+$username = $argv[1];
+$realname = $argv[2];
+$email = $argv[3];
+$user = id(new PhabricatorUser())->loadOneWhere(
+ 'userName = %s',
+ $username);
+if ($user) {
+ echo "User already exists!\n";
+ die(1);
+}
+
+$user = new PhabricatorUser();
+$user->setUserName($username);
+$user->setRealName($realname);
+$user->setEmail($email);
+if (isset($argv[4]) && $argv[4] == '--agent') {
+ $user->setIsSystemAgent(true);
+}
+$user->save();
+
+echo "Created user.\n";
diff --git a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
index 349bbfb5a4..068690600e 100644
--- a/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/common/PhabricatorTypeaheadCommonDatasourceController.php
@@ -1,125 +1,128 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorTypeaheadCommonDatasourceController
extends PhabricatorTypeaheadDatasourceController {
public function willProcessRequest(array $data) {
$this->type = $data['type'];
}
public function processRequest() {
$need_users = false;
$need_lists = false;
$need_projs = false;
$need_repos = false;
$need_packages = false;
$need_upforgrabs = false;
switch ($this->type) {
case 'searchowner':
$need_users = true;
$need_upforgrabs = true;
case 'users':
$need_users = true;
break;
case 'mailable':
$need_users = true;
$need_lists = true;
break;
case 'projects':
$need_projs = true;
break;
case 'repositories':
$need_repos = true;
break;
case 'packages':
$need_packages = true;
break;
}
$data = array();
if ($need_upforgrabs) {
$data[] = array(
'Up For Grabs',
null,
'PHID-!!!!-UP-FOR-GRABS',
);
}
if ($need_users) {
$users = id(new PhabricatorUser())->loadAll();
foreach ($users as $user) {
+ if ($user->getIsSystemAgent()) {
+ continue;
+ }
$data[] = array(
$user->getUsername().' ('.$user->getRealName().')',
'/p/'.$user->getUsername(),
$user->getPHID(),
);
}
}
if ($need_lists) {
$lists = id(new PhabricatorMetaMTAMailingList())->loadAll();
foreach ($lists as $list) {
$data[] = array(
$list->getName(),
$list->getURI(),
$list->getPHID(),
);
}
}
if ($need_projs) {
$projs = id(new PhabricatorProject())->loadAll();
foreach ($projs as $proj) {
$data[] = array(
$proj->getName(),
'/project/view/'.$proj->getID().'/',
$proj->getPHID(),
);
}
}
if ($need_repos) {
$repos = id(new PhabricatorRepository())->loadAll();
foreach ($repos as $repo) {
$data[] = array(
'r'.$repo->getCallsign().' ('.$repo->getName().')',
'/diffusion/'.$repo->getCallsign().'/',
$repo->getPHID(),
);
}
}
if ($need_packages) {
$packages = id(new PhabricatorOwnersPackage())->loadAll();
foreach ($packages as $package) {
$data[] = array(
$package->getName(),
'/owners/package/'.$package->getID().'/',
$package->getPHID(),
);
}
}
return id(new AphrontAjaxResponse())
->setContent($data);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Mon, Dec 1, 12:20 AM (19 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
430051
Default Alt Text
(5 KB)

Event Timeline