Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Command-line tool to manage Snap AuthManager database
Haskell
Tree: 38a6018fd0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.hgignore
LICENSE
README.org
Setup.hs
snap-auth-cli.cabal

README.org

Overview

This tool provides command-line interface to Snap AuthManager to create, view and delete users in database. Currently only JsonFile backend is supported.

Passwords for new users are provided in plain text.

By default the database resides in current directory in `users.json` file.

Note that if database file doesn’t exist, it will be created from scratch. A different db may be specified using `-j` flag.

Basic operations

Type `./snap-auth-cli –help` to get usage help.

Create a user:

./snap-auth-cli --create -u TwasBrillig -p SlithyToves1855

User roles may be set when creating account:

./snap-auth-cli --create -u TwasBrillig2 -p SlithyToves1855 -r gyre -r gimble

A user may have arbitary number of key-value pairs attached in meta field (currently all fields are stored in Strings):

./snap-auth-cli --create -u AlexP -p 1234 -k number -v 3214 -k foo -v bar -r admin

Read the user from DB (`–read` flag may be omitted):

./snap-auth-cli --read -u AlexP
{
    "meta": {
        "number": "3214",
        "foo": "bar"
    },
    "suspended_at": null,
    "roles": [
        "admin"
    ],
    "pw": "sha256|12|VpUGBg2O/NBkDTVTSqqYuA==|TIDuc3ToAPmALXCHBxTA8SjlUBztPS8nH6qiV63a+f4=",
    "activated_at": null,
    "current_ip": null,
    "locked_until": null,
    "updated_at": "2012-02-22T09:00:29.377Z",
    "login_count": 0,
    "current_login_at": null,
    "login": "AlexP",
    "remember_token": null,
    "failed_login_count": 0,
    "last_ip": null,
    "last_login_at": null,
    "uid": "1",
    "created_at": null
}

Work on different database:

./snap-auth-cli -j back.json --create -u MimsyBorogove -p 0utgr@b3d

The tool provides interface to delete users, but JsonFile backend in Snap doesn’t support the operation yet.

To do

More fields

Support setting AuthUser’s userMeta and other fields.
Something went wrong with that request. Please try again.