chiark / gitweb /
c8f0aed3f46d0e7aa9052f30a12954470817e7c4
[chopwood] / cmd-remote.py
1 ### -*-python-*-
2 ###
3 ### Remote service commands
4 ###
5 ### (c) 2013 Mark Wooding
6 ###
7
8 ###----- Licensing notice ---------------------------------------------------
9 ###
10 ### This file is part of Chopwood: a password-changing service.
11 ###
12 ### Chopwood is free software; you can redistribute it and/or modify
13 ### it under the terms of the GNU Affero General Public License as
14 ### published by the Free Software Foundation; either version 3 of the
15 ### License, or (at your option) any later version.
16 ###
17 ### Chopwood is distributed in the hope that it will be useful,
18 ### but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 ### GNU Affero General Public License for more details.
21 ###
22 ### You should have received a copy of the GNU Affero General Public
23 ### License along with Chopwood; if not, see
24 ### <http://www.gnu.org/licenses/>.
25
26 import cmdutil as CU
27 import subcommand as SC
28 import util as U
29
30 @SC.subcommand(
31   'set', ['remote'], 'Set password for remote service',
32   params = [SC.Arg('service'), SC.Arg('user')])
33 def cmd_set_svc(service, user):
34   new = U.readline('new password')
35   svc = CU.check_service(service)
36   svc.setpasswd(user, new)
37
38 @SC.subcommand(
39   'clear', ['remote'], 'Clear password for remote service',
40   params = [SC.Arg('service'), SC.Arg('user')])
41 def cmd_set_svc(service, user):
42   svc = CU.check_service(service)
43   svc.clearpasswd(user)
44
45 ###----- That's all, folks --------------------------------------------------