Command to remove groups

main2
Bob Mottram 2019-10-04 13:59:31 +01:00
parent 12873db070
commit 43cdb1e4be
1 changed files with 11 additions and 2 deletions

View File

@ -115,6 +115,9 @@ parser.add_argument('-g','--addgroup', dest='addgroup', \
parser.add_argument('-r','--rmaccount', dest='rmaccount', \ parser.add_argument('-r','--rmaccount', dest='rmaccount', \
type=str,default=None, \ type=str,default=None, \
help='Remove an account') help='Remove an account')
parser.add_argument('--rmgroup', dest='rmgroup', \
type=str,default=None, \
help='Remove a group')
parser.add_argument('--pass','--password', dest='password', \ parser.add_argument('--pass','--password', dest='password', \
type=str,default=None, \ type=str,default=None, \
help='Set a password for an account') help='Set a password for an account')
@ -955,6 +958,9 @@ if args.addgroup:
print('Group creation failed') print('Group creation failed')
sys.exit() sys.exit()
if args.rmgroup:
args.rmaccount=args.rmgroup
if args.rmaccount: if args.rmaccount:
if '@' in args.rmaccount: if '@' in args.rmaccount:
nickname=args.rmaccount.split('@')[0] nickname=args.rmaccount.split('@')[0]
@ -965,7 +971,10 @@ if args.rmaccount:
print('Use the --domain option to set the domain name') print('Use the --domain option to set the domain name')
sys.exit() sys.exit()
if removeAccount(baseDir,nickname,domain,port): if removeAccount(baseDir,nickname,domain,port):
if not args.rmgroup:
print('Account for '+handle+' was removed') print('Account for '+handle+' was removed')
else:
print('Group '+handle+' was removed')
sys.exit() sys.exit()
if args.changepassword: if args.changepassword: