Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 87 lines (62 sloc) 2.543 kB
b1b77e3 @dzhus README added
authored
1 * Overview
2 This tool provides command-line interface to Snap AuthManager to
3 create, view and delete users in database. Currently only JsonFile
4 backend is supported.
5
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
6 Passwords for new users are provided in plain text.
7
8 By default the database resides in current directory in `users.json`
9 file.
10
11 Note that if database file doesn't exist, it will be created from
b1b77e3 @dzhus README added
authored
12 scratch. A different db may be specified using `-j` flag.
13
14
15 ** Basic operations
16 Type `./snap-auth-cli --help` to get usage help.
17
18 Create a user:
19
20 : ./snap-auth-cli --create -u TwasBrillig -p SlithyToves1855
21
8f975b7 @dzhus Support user roles
authored
22 User roles may be set when creating account:
23
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
24 : ./snap-auth-cli --create -u TwasBrillig2 -p SlithyToves1855 -r gyre -r gimble
25
26 A user may have arbitary number of key-value pairs attached in meta
27 field (currently all fields are stored in Strings):
28
29 : ./snap-auth-cli --create -u AlexP -p 1234 -k number -v 3214 -k foo -v bar -r admin
8f975b7 @dzhus Support user roles
authored
30
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
31 Read the user from DB (`--read` flag may be omitted):
b1b77e3 @dzhus README added
authored
32
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
33 : ./snap-auth-cli --read -u AlexP
b1b77e3 @dzhus README added
authored
34 : {
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
35 : "meta": {
36 : "number": "3214",
37 : "foo": "bar"
38 : },
b1b77e3 @dzhus README added
authored
39 : "suspended_at": null,
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
40 : "roles": [
41 : "admin"
42 : ],
43 : "pw": "sha256|12|VpUGBg2O/NBkDTVTSqqYuA==|TIDuc3ToAPmALXCHBxTA8SjlUBztPS8nH6qiV63a+f4=",
b1b77e3 @dzhus README added
authored
44 : "activated_at": null,
45 : "current_ip": null,
46 : "locked_until": null,
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
47 : "updated_at": "2012-02-22T09:00:29.377Z",
b1b77e3 @dzhus README added
authored
48 : "login_count": 0,
49 : "current_login_at": null,
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
50 : "login": "AlexP",
b1b77e3 @dzhus README added
authored
51 : "remember_token": null,
52 : "failed_login_count": 0,
53 : "last_ip": null,
54 : "last_login_at": null,
55 : "uid": "1",
56 : "created_at": null
57 : }
58
59 Work on different database:
60
61 : ./snap-auth-cli -j back.json --create -u MimsyBorogove -p 0utgr@b3d
62
31084e3 @dzhus Implement choosing between old/new data with Monoids
authored
63 Existing users can be modified using the `-m` option. User is
64 selected by login. Any of `-p`, `-o` or `-k/-v` flags may be
65 specified to set new value for user password, roles or meta. If no
66 new value is provided, old field is preserved.
67
68 Set new password for user:
69
70 : ./snap-auth-cli -m -u Mome -p r@th$$
71
72 Set new role:
73
74 : ./snap-auth-cli -m -u Mome -o foobarer
75
76 Replace user meta:
77
78 : ./snap-auth-cli -m -u BG -k tel -v 2-12-85-06
79
b1b77e3 @dzhus README added
authored
80 The tool provides interface to delete users, but JsonFile backend
81 in Snap doesn't support the operation yet.
82
83 * To do
92e1e2c @dzhus Support meta fields (+unordered-containers dep)
authored
84 ** DONE More fields
85 CLOSED: [2012-02-22 Срд 12:53]
8f975b7 @dzhus Support user roles
authored
86 Support setting AuthUser's userMeta and other fields.
Something went wrong with that request. Please try again.