Page MenuHomestyx hydra

No OneTemporary

diff --git a/bin/accountadmin b/bin/accountadmin
new file mode 120000
index 0000000000..a846766c26
--- /dev/null
+++ b/bin/accountadmin
@@ -0,0 +1 @@
+../scripts/user/account_admin.php
\ No newline at end of file
diff --git a/scripts/user/account_admin.php b/scripts/user/account_admin.php
new file mode 100755
index 0000000000..41d05f4751
--- /dev/null
+++ b/scripts/user/account_admin.php
@@ -0,0 +1,121 @@
+#!/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';
+
+phutil_require_module('phutil', 'console');
+
+echo "Enter a username to create a new account or edit an existing account.";
+
+$username = phutil_console_prompt("Enter a username:");
+if (!strlen($username)) {
+ echo "Cancelled.\n";
+ exit(1);
+}
+
+$user = id(new PhabricatorUser())->loadOneWhere(
+ 'username = %s',
+ $username);
+
+if (!$user) {
+ echo "There is no existing user account '{$username}'.\n";
+ $ok = phutil_console_confirm(
+ "Do you want to create a new '{$username}' account?",
+ $default_no = false);
+ if (!$ok) {
+ echo "Cancelled.\n";
+ exit(1);
+ }
+ $user = new PhabricatorUser();
+ $user->setUsername($username);
+} else {
+ echo "There is an existing user account '{$username}'.\n";
+ $ok = phutil_console_confirm(
+ "Do you want to edit the existing '{$username}' account?",
+ $default_no = false);
+ if (!$ok) {
+ echo "Cancelled.\n";
+ exit(1);
+ }
+}
+
+$original = clone $user;
+
+$user_realname = $user->getRealName();
+if (strlen($user_realname)) {
+ $realname_prompt = ' ['.$user_realname.']';
+} else {
+ $realname_prompt = '';
+}
+$realname = nonempty(
+ phutil_console_prompt("Enter user real name{$realname_prompt}:"),
+ $user_realname);
+$user->setRealName($realname);
+
+$user_email = $user->getEmail();
+if (strlen($user_email)) {
+ $email_prompt = ' ['.$user_email.']';
+} else {
+ $email_prompt = '';
+}
+$email = nonempty(
+ phutil_console_prompt("Enter user email address{$email_prompt}:"),
+ $user_email);
+$user->setEmail($email);
+
+$changed_pass = false;
+$password = phutil_console_prompt(
+ "Enter a password for this user [blank to leave unchanged]:");
+if (strlen($password)) {
+ $user->setPassword($password);
+ $changed_pass = true;
+}
+
+$is_admin = $user->getIsAdmin();
+$set_admin = phutil_console_confirm(
+ 'Should this user be an administrator?',
+ $default_no = !$is_admin);
+$user->setIsAdmin($set_admin);
+
+echo "\n\nACCOUNT SUMMARY\n\n";
+$tpl = "%12s %-30s %-30s\n";
+printf($tpl, null, 'OLD VALUE', 'NEW VALUE');
+printf($tpl, 'Username', $original->getUsername(), $user->getUsername());
+printf($tpl, 'Real Name', $original->getRealName(), $user->getRealName());
+printf($tpl, 'Email', $original->getEmail(), $user->getEmail());
+printf($tpl, 'Password', null, $changed_pass ? 'Updated' : 'Unchanged');
+
+printf(
+ $tpl,
+ 'Admin',
+ $original->getIsAdmin() ? 'Y' : 'N',
+ $user->getIsAdmin() ? 'Y' : 'N');
+
+echo "\n";
+
+if (!phutil_console_confirm("Save these changes?", $default_no = false)) {
+ echo "Cancelled.\n";
+ exit(1);
+}
+
+$user->save();
+
+echo "Saved changes.\n";
diff --git a/scripts/user/create_user.php b/scripts/user/create_user.php
deleted file mode 100755
index 44173cbfd7..0000000000
--- a/scripts/user/create_user.php
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/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/docs/configuration_guide.diviner b/src/docs/configuration_guide.diviner
index 11521d787f..d015fa9730 100644
--- a/src/docs/configuration_guide.diviner
+++ b/src/docs/configuration_guide.diviner
@@ -1,143 +1,145 @@
@title Configuration Guide
@group config
This document contains basic configuration instructions for Phabricator.
= Prerequisites =
This document assumes you've already installed all the components you need.
If you haven't, see @{article:Installation Guide}.
= Configuring MySQL =
Get MySQL running and verify you can connect to it. Consult the MySQL
documentation for help. When MySQL works, you need to load the Phabricator
schemata into it. First, load the initial database schema.
mysql -uroot < path/to/phabricator/resources/sql/init/initialize.sql
After this you need to upgrade the schema (see @{article:Upgrading Schema}),
but you need to finish the rest of the configuration first.
= Configuring Phabricator =
Create a new file here:
path/to/phabricator/conf/custom/myconfig.conf.php
...where ##myconfig## is some name which identifies your installation. Put this
in the file:
<?php
return array(
// Important! This will put Phabricator into setup mode to help you
// configure things.
'phabricator.setup' => true,
// This will be the base domain for your install, and must be configured.
// Use "https://" if you have SSL. See below for some notes.
'phabricator.base-uri' => 'http://phabricator.example.com/',
) + phabricator_read_config_file('production');
For the last line, you can also use ##'development'## instead of
##'production'## if you are planning to develop Phabricator itself. This will
turn on some debugging features.
= Configuring Apache =
Get Apache running and verify it's serving a test page. Consult the Apache
documentation for help. Make sure ##mod_php## and ##mod_rewrite## are enabled,
and ##mod_ssl## if you intend to set up SSL.
If you haven't already, set up a domain name to point to the host you're
installing on. You can either install Phabricator on a subdomain (like
phabricator.example.com) or an entire domain, but you can not install it in
some subdirectory of an existing website. Navigate to whatever domain you're
going to use and make sure Apache serves you something to verify that DNS
is correctly configured.
Now, either create a VirtualHost entry (to put Phabricator on a subdomain)
or edit the Directory entry for the DocumentRoot. It should look something like
this:
<VirtualHost *>
# Change this to the domain which points to your host, i.e. the domain
# you set as "phabricator.base-uri".
ServerName phabricator.example.com
# Change this to the path where you put 'phabricator' when you checked it
# out from github when following the Installation Guide.
DocumentRoot /path/to/phabricator/webroot
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [L,QSA]
# This will use the config file you set up in the previous step. If you
# called it something other than 'myconfig', put that here.
SetEnv PHABRICATOR_ENV custom/myconfig
</VirtualHost>
Now, restart apache and navigate to whichever subdomain you set up. You should
either see the Phabricator setup screen, which is a simple text page that looks
something like this:
PHABRICATOR SETUP
This setup mode will guide you through setting up your Phabricator
configuration.
>>> REQUIRED PHP EXTENSIONS ------------------------------------------------
...
If you see this, you're in good shape. Follow the instructions and correct any
problems setup detects. If you don't see it but you do see a useful error
message, try to fix that. If neither of these cover you, something is wrong.
If you can't figure it out, come get help in IRC or on the mailing list (see
http://phabricator.org/ for links).
= Configuring Phabricator =
Now that basic setup is complete, you should configure Phabricator for your
installation. Phabricator configuration options which control how the
applications behave are documented here:
/path/to/phabricator/conf/default.conf.php
There are several builtin configurations:
- ##default.conf.php##: root configuration, lists every configuration option
and sets some default for it. Look in this file to figure out what you can
configure.
- ##development.conf.php##: pulls in ##default.conf.php##, but overrides some
configuration options to better values for doing development on Phabricator.
You probably don't need to even look at this file unless you're making
changes to Phabricator itself.
- ##production.conf.php##: pulls in ##default.conf.php##, but overrides some
configuration options to provide better values for a production install.
To actually configure your install, edit your ##custom/myconfig.conf.php## file
and override values from either the ##'production'## or ##'development'##
configurations. You should not edit the builtin configurations directly because
that will make upgrading Phabricator more difficult in the future.
= Upgrading Schema =
After you have configured Phabricator, you need to upgrade the database
schema -- see @{article:Upgrading Schema}. You'll also need to do this after you
update the code in the future.
= Next Steps =
Continue by:
- upgrading the database schema with @{article:Upgrading Schema}; or
+ - setting up your admin account and login/registration with
+ @{article:Configuring Accounts and Registration}; or
- configuring Phabricator so it can send mail with
@{article:Configuring Outbound Email}; or
- configuring inbound mail with @{article:Configuring Inbound Email}; or
- learning about daemons with @{article:Managing Daemons with phd}; or
- contributing to Phabricator with @{article:Contributor Introduction}.
\ No newline at end of file
diff --git a/src/docs/configuring_accounts_and_registration.diviner b/src/docs/configuring_accounts_and_registration.diviner
new file mode 100644
index 0000000000..fa84607059
--- /dev/null
+++ b/src/docs/configuring_accounts_and_registration.diviner
@@ -0,0 +1,98 @@
+@title Configuring Accounts and Registration
+@group config
+
+Describes how to configure user access to Phabricator.
+
+= Overview =
+
+Phabricator supports a number of login systems, like traditional
+username/password, Facebook OAuth, and GitHub OAuth. You can enable or disable
+these systems to configure who can register for and access your install, and
+how users with existing accounts can login.
+
+By default, only username/password auth is enabled, and there are no valid
+accounts. Start by creating a new account with the
+##phabricator/bin/accountadmin## script.
+
+= Using accountadmin =
+
+##accountadmin## is a user-friendly command line interface for creating and
+editing accounts. To use ##accountadmin##, just run the script:
+
+ $ ./phabricator/bin/accountadmin
+ Enter a username to create a new account or edit an existing account.
+
+ Enter a username:
+
+This will walk you through the process of creating an initial user account.
+Once you've created an account, you can login with it and use the web console
+to create and manage accounts more easily (provided you make your first account
+an administrator).
+
+You can use this script later to create or edit accounts if you, for example,
+accidentally remove your admin flag.
+
+= Managing Accounts with the Web Console =
+
+To manage accounts from the web, login as an administrator account and go to
+##/people/## or click "People" on the homepage. Provided you're an admin,
+you'll see options to create or edit accounts.
+
+= Configuring Facebook OAuth =
+
+You can configure Facebook OAuth to allow login, login and registration, or
+nothing (the default). If registration is not allowed, users must have an
+existing account in order to link a Facebook account to it, but can use
+Facebook to login once the accounts are linked.
+
+To configure Facebook OAuth, create a new Facebook Application:
+
+https://www.facebook.com/developers/createapp.php
+
+Once that is set up, edit your Phabricator configuration and set these keys:
+
+ - **facebook.auth-enabled**: set this to ##true##.
+ - **facebook.application-id**: set to your Facebook application's ID. Make
+ sure you set this as a string.
+ - **facebook.application-secret**: set to your Facebook application's
+ secret key.
+ - **facebook.registration-enabled**: set this to ##true## to let users
+ register for your install with a Facebook account (this is a very open
+ setting) or ##false## to prevent users from registering with Facebook.
+ - **facebook.auth-permanent**: you can set this to prevent account unlinking.
+ It is unlikely you want to prevent it, but Facebook's internal install uses
+ this option since Facebook uses Facebook as its only auth mechanism.
+
+= Configuring GitHub OAuth =
+
+You can configure GitHub OAuth to allow login, login and registration, or
+nothing (the default).
+
+To configure GitHub OAuth, create a new GitHub Application:
+
+https://github.com/account/applications/new
+
+Once you've created an application, edit your Phabricator configuration and
+set these keys:
+
+ - **github.auth-enabled**: set this to ##true##.
+ - **github.application-id**: set this to your application/client ID.
+ - **github.application-secret**: set this to your application secret.
+ - **github.registration-enabled**: set to ##true## to let users register with
+ just GitHub credentials (this is a very open setting) or ##false## to
+ prevent users from registering. If set to ##false##, users may still link
+ existing accounts and use GitHub to login, they just can't create new
+ accounts.
+ - **github.auth-permanent**: set to ##true## to prevent unlinking Phabricator
+ accounts from GitHub accounts.
+
+Note that you can see a list of your GitHub applications here, although it's not
+immediately clear how to get there via the UI:
+
+https://github.com/account/applications/
+
+= Next Steps =
+
+Continue by:
+
+ - returning to the @{article:Configuration Guide}.

File Metadata

Mime Type
text/x-diff
Expires
Sun, Sep 7, 10:16 AM (1 d, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
223068
Default Alt Text
(15 KB)

Event Timeline