davidhernandeze opened a new pull request, #1568:
URL: https://github.com/apache/couchdb-fauxton/pull/1568

   ## Overview
   
   Adds a **Create User** button next to **Create Document** in the `_users` 
database. It opens a form (`#/database/_users/_new_user`) that builds a valid 
user document, so admins no longer have to write the JSON by hand:
   
   ```json
   {
     "_id": "org.couchdb.user:<name>",
     "name": "<name>",
     "password": "<password>",
     "type": "user",
     "roles": []
   }
   ```
   
   The form uses the same layout as the New Replication form, and its roles 
editor is modelled on the one in Permissions. Before sending, it applies the 
same rules as _design/_auth's validate_doc_update:
   
   - Username: required, can't start with _, can't contain :. The documeown 
below the field.
   - Unique name: checked when the field loses focus and again on submit. A 409 
conflict on save is also reported as "user already exists".
   - Roles: non-empty, no duplicates, no system roles (anything starting
   - Password: required, and must match the confirmation field.
   
   Rules that depend on who is logged in (for example, only admins may set 
roles) are still enforced by CouchDB, and its error message is shown in a 
notification.
   
   Changes:
   - New users addon (app/addons/users): route, form, roles editor, valid 
styles and tests.
   - documents/components/results-toolbar.js: shows the button only when the 
database is _users.
   - settings.json.default.json: registers the users addon after documenuse its 
route has to take precedence over the genericdatabase/:database/:doc editor 
route.
   - app/constants.js: adds a USERS_DB documentation link for the header
   - .gitignore: adds app/addons/users to the addon allow-list.
   
   Testing recommendations
   
   Unit tests:
   
   npx jest --config ./jest-config.json app/addons/users app/addons/documents
   Manual test (as a server admin):
   
   1. Open the _users database. Create User should appear next to Creates 
database.
   2. Click it. The form should open with the breadcrumb _users > New User.
   3. Enter an existing username and move to the next field. You should ady 
exists."
   4. Enter _foo or foo:bar as the username. You should see an error telling 
you the name isn't allowed.
   5. Try to add _admin as a role. It should be rejected. _metrics and ocepted, 
and a role can be removed with its ×.
   6. Enter two passwords that don't match. You should see "Passwords do not 
match."
   7. Fill in valid values and click Create User. You should get a succeen back 
to _users, and the new org.couchdb.user:<name> document should have the roles 
you entered and a hashed password (password_scheme: pbkdf2).
   8. Clear should reset the form.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to