Commit | Line | Data |
---|---|---|
a2916c06 MW |
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'], | |
32 | 'Set password for remote service', | |
33 | params = [SC.Arg('service'), SC.Arg('user')]) | |
34 | def cmd_set_svc(service, user): | |
35 | new = readline() | |
36 | svc = CU.check_service(service) | |
37 | svc.setpasswd(user, new) | |
38 | ||
39 | @SC.subcommand( | |
40 | 'clear', ['remote'], | |
41 | 'Clear password for remote service', | |
42 | params = [SC.Arg('service'), SC.Arg('user')]) | |
43 | def cmd_set_svc(service, user): | |
44 | svc = CU.check_service(service) | |
45 | svc.clearpasswd(user) | |
46 | ||
47 | ###----- That's all, folks -------------------------------------------------- |