1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
effitool - use effireg from the command line
=============================================================================
effitool is a command line tool to use the API of the effireg
membership register for the Effi association.
Installation
-----------------------------------------------------------------------------
effitool is a single-file Python3 program. Get a copy from anywhere,
and run it.
./effitool
Configuration
-----------------------------------------------------------------------------
In order to access the API, effitool needs API client credentials.
Specifically, it needs a client id and a client secret. These are
stored in the `~/.config/effitool/credentials.conf` file, which is an
INI format file:
[effi]
url = https://effi-reg.vm.liw.fi
client_id = tapani
client_secret = YOUWISH
The file may specify credentials for any number of instances of the
membership regiester. This is handy for the developers. If only one is
specified, effitool will use it automatically. If more than one server
is specified, the `--api` (`-a`) option is used to pick one.
./effitool -a effi ...
The list of known servers can be listed:
./effitool list-servers
Usage:
-----------------------------------------------------------------------------
To check the status of the membership register:
./effitool status
To register a new API client:
./effitool register-admin-client ID SECRET
where `ID` is the client id and `SECRET` is the client secret. The new
client will automatically be allowed the scopes. Note that the
`credentials.conf` file is NOT updated: this command is for
registering API clients for other people, who do not have access to
the config file.
To list all known clients:
./effitool list-clients
To show the allowed scopes for a specific client:
./effitool show-client tomjon
To add to the allowed scopes for a specific client:
./effitool allow-scope tomjon create
To remove from the allowed scopes for a specific client:
./effitool deny-scope tomjon create
To list all members (database ids):
./effitool list-members
To add a member to the database:
./effitool add-member foo.json
where foo.json contains the members' record. It can currently be any
JSON file, such as:
{
"fullname": "Tomjon of Lancre",
"member-number": 42,
"member-years": [2019],
"paid-years": [],
}
To show a member:
./effitool show-member 2f02bf0e-7380-45bf-86ad-ba8dd332304a
To update a member:
./effitool update-member 2f02bf0e-7380-45bf-86ad-ba8dd332304a foo.json
To delete a member:
./effitool delete-member 2f02bf0e-7380-45bf-86ad-ba8dd332304a
Legalese
-----------------------------------------------------------------------------
Copyright 2019 Lars Wirzenius
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
|