Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ $ solid start
Otherwise, if you want to use flags, this would be the equivalent

```bash
$ solid --idp --port 8443 --cert /path/to/cert --key /path/to/key --root ./accounts
$ solid --multiuser --port 8443 --cert /path/to/cert --key /path/to/key --root ./accounts
```

Your users will have a dedicated folder under `./accounts`. Also, your root domain's website will be in `./accounts/yourdomain.tld`. New users can create accounts on `/api/accounts/new` and create new certificates on `/api/accounts/cert`. An easy-to-use sign-up tool is found on `/api/accounts`.
Expand Down Expand Up @@ -157,7 +157,7 @@ $ solid start --help
--owner [value] Set the owner of the storage (overwrites the root ACL file)
--ssl-key [value] Path to the SSL private key in PEM format
--ssl-cert [value] Path to the SSL certificate key in PEM format
--idp Enable multi-user mode (users can sign up for accounts)
--multiuser Enable multi-user mode
--corsProxy [value] Serve the CORS proxy on this path
--file-browser [value] Url to file browser app (uses Warp by default)
--data-browser Enable viewing RDF resources using a default data browser application (e.g. mashlib)
Expand Down
12 changes: 8 additions & 4 deletions bin/lib/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,18 @@ module.exports = [
prompt: false
},
{
name: 'idp',
help: 'Enable multi-user mode (users can sign up for accounts)',
question: 'Enable multi-user mode (users can sign up for accounts)',
full: 'allow-signup',
name: 'multiuser',
help: 'Enable multi-user mode',
question: 'Enable multi-user mode',
flag: true,
default: false,
prompt: true
},
{
name: 'idp',
help: 'Obsolete; use --multiuser',
prompt: false
},
{
name: 'no-live',
help: 'Disable live support through WebSockets',
Expand Down
2 changes: 1 addition & 1 deletion default-views/auth/reset-password.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{/if}}
<div class="row">
<div class="col-md-12">
{{#if multiUser}}
{{#if multiuser}}
<p>Please enter your account name. A password reset link will be
emailed to the address you provided during account registration.</p>

Expand Down
6 changes: 3 additions & 3 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function createApp (argv = {}) {

// Add CORS proxy
if (argv.proxy) {
console.error('The proxy configuration option has been renamed to corsProxy.')
console.warn('The proxy configuration option has been renamed to corsProxy.')
argv.corsProxy = argv.proxy
delete argv.proxy
}
Expand Down Expand Up @@ -187,7 +187,7 @@ function initWebId (argv, app, ldp) {
host: argv.host,
accountTemplatePath: argv.templates.account,
store: ldp,
multiUser: argv.idp
multiuser: argv.multiuser
})
app.locals.accountManager = accountManager

Expand All @@ -197,7 +197,7 @@ function initWebId (argv, app, ldp) {
// Set up authentication-related API endpoints and app.locals
initAuthentication(app, argv)

if (argv.idp) {
if (argv.multiuser) {
app.use(vhost('*', LdpMiddleware(corsSettings)))
}
}
Expand Down
8 changes: 7 additions & 1 deletion lib/create-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ function createServer (argv, app) {
app.use(mount, ldpApp)
debug.settings('Base URL (--mount): ' + mount)

if (argv.idp) {
console.warn('The idp configuration option has been renamed to multiuser.')
argv.idp = argv.multiuser
delete argv.idp
}

var server
var needsTLS = argv.sslKey || argv.sslCert ||
(ldp.webid || ldp.idp) && !argv.certificateHeader
(ldp.webid || ldp.multiuser) && !argv.certificateHeader
if (!needsTLS) {
server = http.createServer(app)
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/allow.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function readFile (uri, host, ldp, baseUri) {
: uri
// Determine the root file system folder to look in
// TODO prettify this
var root = !ldp.idp ? ldp.root : ldp.root + host + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + host + '/'
// Derive the file path for the resource
var documentPath = utils.uriToFilename(newPath, root)
var documentUri = url.parse(documentPath)
Expand Down
4 changes: 2 additions & 2 deletions lib/handlers/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function handler (req, res, next) {

function globHandler (req, res, next) {
var ldp = req.app.locals.ldp
var root = !ldp.idp ? ldp.root : ldp.root + req.hostname + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + req.hostname + '/'
var filename = utils.uriToFilename(req.path, root)
var uri = utils.getFullUri(req)
const requestUri = url.resolve(uri, req.path)
Expand Down Expand Up @@ -199,7 +199,7 @@ function aclAllow (match, req, res, callback) {
return callback(true)
}

var root = ldp.idp ? ldp.root + req.hostname + '/' : ldp.root
var root = ldp.multiuser ? ldp.root + req.hostname + '/' : ldp.root
var relativePath = '/' + _path.relative(root, match)
res.locals.path = relativePath
allow('Read', req, res, function (err) {
Expand Down
2 changes: 1 addition & 1 deletion lib/handlers/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function patchHandler (req, res, next) {

// Obtain details of the target resource
const ldp = req.app.locals.ldp
const root = !ldp.idp ? ldp.root : `${ldp.root}${req.hostname}/`
const root = !ldp.multiuser ? ldp.root : `${ldp.root}${req.hostname}/`
const target = {}
target.file = utils.uriToFilename(req.path, root)
target.uri = utils.getBaseUri(req) + req.originalUrl
Expand Down
2 changes: 1 addition & 1 deletion lib/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function addLinks (res, fileMetadata) {

function linksHandler (req, res, next) {
var ldp = req.app.locals.ldp
var root = !ldp.idp ? ldp.root : ldp.root + req.hostname + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + req.hostname + '/'
var filename = utils.uriToFilename(req.url, root)

filename = path.join(filename, req.path)
Expand Down
12 changes: 6 additions & 6 deletions lib/ldp.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class LDP {
debug.settings('Filesystem Root: ' + this.root)
debug.settings('Allow WebID authentication: ' + !!this.webid)
debug.settings('Live-updates: ' + !!this.live)
debug.settings('Identity Provider: ' + !!this.idp)
debug.settings('Multi-user: ' + !!this.multiuser)
debug.settings('Default file browser app: ' + this.fileBrowser)
debug.settings('Suppress default data browser app: ' + this.suppressDataBrowser)
debug.settings('Default data browser app file path: ' + this.dataBrowserPath)
Expand Down Expand Up @@ -142,7 +142,7 @@ class LDP {
listContainer (filename, reqUri, uri, containerData, contentType, callback) {
var ldp = this
// var host = url.parse(uri).hostname
// var root = !ldp.idp ? ldp.root : ldp.root + host + '/'
// var root = !ldp.multiuser ? ldp.root : ldp.root + host + '/'

// var baseUri = utils.filenameToBaseUri(filename, uri, root)
var resourceGraph = $rdf.graph()
Expand Down Expand Up @@ -259,7 +259,7 @@ class LDP {

put (host, resourcePath, stream, callback) {
var ldp = this
var root = !ldp.idp ? ldp.root : ldp.root + host + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + host + '/'
var filePath = utils.uriToFilename(resourcePath, root, host)

// PUT requests not supported on containers. Use POST instead
Expand Down Expand Up @@ -344,7 +344,7 @@ class LDP {
baseUri = undefined
}

var root = ldp.idp ? ldp.root + host + '/' : ldp.root
var root = ldp.multiuser ? ldp.root + host + '/' : ldp.root
var filename = utils.uriToFilename(reqPath, root)

ldp.readFile(filename, (err, body) => {
Expand All @@ -363,7 +363,7 @@ class LDP {
var range = options.range
}
var ldp = this
var root = !ldp.idp ? ldp.root : ldp.root + host + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + host + '/'
var filename = utils.uriToFilename(reqPath, root)

ldp.stat(filename, function (err, stats) {
Expand Down Expand Up @@ -430,7 +430,7 @@ class LDP {

delete (host, resourcePath, callback) {
var ldp = this
var root = !ldp.idp ? ldp.root : ldp.root + host + '/'
var root = !ldp.multiuser ? ldp.root : ldp.root + host + '/'
var filename = utils.uriToFilename(resourcePath, root)
ldp.stat(filename, function (err, stats) {
if (err) {
Expand Down
18 changes: 9 additions & 9 deletions lib/models/account-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class AccountManager {
* @param [options.emailService] {EmailService}
* @param [options.tokenService] {TokenService}
* @param [options.host] {SolidHost}
* @param [options.multiUser=false] {boolean} (argv.idp) Is the server running
* in multiUser mode (users can sign up for accounts) or single user
* @param [options.multiuser=false] {boolean} (argv.multiuser) Is the server running
* in multiuser mode (users can sign up for accounts) or single user
* (such as a personal website).
* @param [options.store] {LDP}
* @param [options.pathCard] {string}
Expand All @@ -45,7 +45,7 @@ class AccountManager {
this.emailService = options.emailService
this.tokenService = options.tokenService
this.authMethod = options.authMethod || defaults.auth
this.multiUser = options.multiUser || false
this.multiuser = options.multiuser || false
this.store = options.store
this.pathCard = options.pathCard || 'profile/card'
this.suffixURI = options.suffixURI || '#me'
Expand All @@ -56,7 +56,7 @@ class AccountManager {
* Factory method for new account manager creation. Usage:
*
* ```
* let options = { host, multiUser, store }
* let options = { host, multiuser, store }
* let accontManager = AccountManager.from(options)
* ```
*
Expand Down Expand Up @@ -137,7 +137,7 @@ class AccountManager {
accountDirFor (accountName) {
let accountDir

if (this.multiUser) {
if (this.multiuser) {
let uri = this.accountUriFor(accountName)
let hostname = url.parse(uri).hostname
accountDir = path.join(this.store.root, hostname)
Expand Down Expand Up @@ -165,11 +165,11 @@ class AccountManager {
* @param [accountName] {string}
*
* @throws {Error} If `this.host` has not been initialized with serverUri,
* or if in multiUser mode and accountName is not provided.
* or if in multiuser mode and accountName is not provided.
* @return {string}
*/
accountUriFor (accountName) {
let accountUri = this.multiUser
let accountUri = this.multiuser
? this.host.accountUriFor(accountName)
: this.host.serverUri // single user mode

Expand Down Expand Up @@ -335,7 +335,7 @@ class AccountManager {
* @param [userData.email] {string}
* @param [userData.name] {string}
*
* @throws {Error} (via `accountWebIdFor()`) If in multiUser mode and no
* @throws {Error} (via `accountWebIdFor()`) If in multiuser mode and no
* username passed
*
* @return {UserAccount}
Expand Down Expand Up @@ -378,7 +378,7 @@ class AccountManager {
}

usernameFromWebId (webId) {
if (!this.multiUser) {
if (!this.multiuser) {
return DEFAULT_ADMIN_USERNAME
}

Expand Down
2 changes: 1 addition & 1 deletion lib/models/solid-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SolidHost {
}

/**
* Composes and returns an account URI for a given username, in multiUser mode.
* Composes and returns an account URI for a given username, in multi-user mode.
* Usage:
*
* ```
Expand Down
6 changes: 3 additions & 3 deletions lib/requests/password-reset-email-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class PasswordResetEmailRequest extends AuthRequest {
* @throws {Error}
*/
validate () {
if (this.accountManager.multiUser && !this.username) {
if (this.accountManager.multiuser && !this.username) {
throw new Error('Username required')
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ class PasswordResetEmailRequest extends AuthRequest {
let params = {
error: error.message,
returnToUrl: this.returnToUrl,
multiUser: this.accountManager.multiUser
multiuser: this.accountManager.multiuser
}

res.status(error.statusCode || 400)
Expand All @@ -182,7 +182,7 @@ class PasswordResetEmailRequest extends AuthRequest {
renderForm () {
let params = {
returnToUrl: this.returnToUrl,
multiUser: this.accountManager.multiUser
multiuser: this.accountManager.multiuser
}

this.response.render('auth/reset-password', params)
Expand Down
5 changes: 2 additions & 3 deletions lib/server-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ function ensureDirCopyExists (fromDir, toDir) {
* @param argv {Function} Express.js app object
*/
function ensureWelcomePage (argv) {
let multiUser = argv.idp
let { multiuser, templates } = argv
let rootDir = path.resolve(argv.root)
let templates = argv.templates
let serverRootDir

if (multiUser) {
if (multiuser) {
serverRootDir = path.join(rootDir, argv.host.hostname)
} else {
serverRootDir = rootDir
Expand Down
2 changes: 1 addition & 1 deletion lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,6 @@ function stripLineEndings (obj) {

function reqToPath (req) {
var ldp = req.app.locals.ldp
var root = ldp.idp ? ldp.root + req.hostname + '/' : ldp.root
var root = ldp.multiuser ? ldp.root + req.hostname + '/' : ldp.root
return uriToFilename(req.path, root)
}
4 changes: 2 additions & 2 deletions test/integration/account-creation-oidc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('AccountManager (OIDC account creation tests)', function () {
sslCert: path.join(__dirname, '../keys/cert.pem'),
auth: 'oidc',
webid: true,
idp: true,
multiuser: true,
strictOrigin: true,
dbPath,
serverUri
Expand Down Expand Up @@ -212,7 +212,7 @@ describe('Single User signup page', () => {
sslKey: path.join(__dirname, '../keys/key.pem'),
sslCert: path.join(__dirname, '../keys/cert.pem'),
webid: true,
idp: false,
multiuser: false,
strictOrigin: true
})
const server = supertest(serverUri)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/account-creation-tls-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// sslCert: path.join(__dirname, '../keys/cert.pem'),
// auth: 'tls',
// webid: true,
// idp: true,
// multiuser: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test file is completely commented out...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know; I'm not sure about the purpose of this file, I just search & replaced even in the commented code in case it is ever taken up again.

// strictOrigin: true
// })
//
Expand Down
Loading