|
24 | 24 | from plogical.sslUtilities import sslUtilities |
25 | 25 | from plogical.processUtilities import ProcessUtilities |
26 | 26 | from plogical.backupSchedule import backupSchedule |
| 27 | +from django.http import HttpRequest |
27 | 28 |
|
28 | 29 | # All that we see or seem is but a dream within a dream. |
29 | 30 |
|
@@ -1323,6 +1324,61 @@ def main(): |
1323 | 1324 | currentversion = version + '.' + build |
1324 | 1325 | print (currentversion) |
1325 | 1326 |
|
| 1327 | + ### User Functions |
| 1328 | + |
| 1329 | + elif args.function == "createUser": |
| 1330 | + |
| 1331 | + completeCommandExample = 'cyberpanel createUser --firstName Cyber --lastName Panel --email email@cyberpanel.net --userName cyberpanel --password securepassword --websitesLimit 10 --selectedACL user --securityLevel HIGH' |
| 1332 | + |
| 1333 | + if not args.firstName: |
| 1334 | + print("\n\nPlease enter First Name. For example:\n\n" + completeCommandExample + "\n\n") |
| 1335 | + return |
| 1336 | + |
| 1337 | + if not args.lastName: |
| 1338 | + print("\n\nPlease enter Last Name. For example:\n\n" + completeCommandExample + "\n\n") |
| 1339 | + return |
| 1340 | + |
| 1341 | + if not args.email: |
| 1342 | + print("\n\nPlease enter Email. For example:\n\n" + completeCommandExample + "\n\n") |
| 1343 | + return |
| 1344 | + |
| 1345 | + if not args.userName: |
| 1346 | + print("\n\nPlease enter User name. For example:\n\n" + completeCommandExample + "\n\n") |
| 1347 | + return |
| 1348 | + |
| 1349 | + if not args.password: |
| 1350 | + print("\n\nPlease enter password. For example:\n\n" + completeCommandExample + "\n\n") |
| 1351 | + return |
| 1352 | + |
| 1353 | + if not args.websitesLimit: |
| 1354 | + print("\n\nPlease enter website limit. For example:\n\n" + completeCommandExample + "\n\n") |
| 1355 | + return |
| 1356 | + |
| 1357 | + if not args.selectedACL: |
| 1358 | + print("\n\nPlease enter select acl. For example:\n\n" + completeCommandExample + "\n\n") |
| 1359 | + return |
| 1360 | + |
| 1361 | + if not args.securityLevel: |
| 1362 | + print("\n\nPlease set security level. For example:\n\n" + completeCommandExample + "\n\n") |
| 1363 | + return |
| 1364 | + |
| 1365 | + from userManagment.views import submitUserCreation |
| 1366 | + |
| 1367 | + data = {} |
| 1368 | + data['firstName'] = args.firstName |
| 1369 | + data['lastName'] = args.lastName |
| 1370 | + data['email'] = args.email |
| 1371 | + data['userName'] = args.userName |
| 1372 | + data['password'] = args.password |
| 1373 | + data['websitesLimit'] = args.websitesLimit |
| 1374 | + data['selectedACL'] = args.selectedACL |
| 1375 | + data['securityLevel'] = args.securityLevel |
| 1376 | + data['userID'] = 1 |
| 1377 | + |
| 1378 | + response = submitUserCreation(data) |
| 1379 | + |
| 1380 | + print(response.content.decode()) |
| 1381 | + |
1326 | 1382 |
|
1327 | 1383 |
|
1328 | 1384 | if __name__ == "__main__": |
|
0 commit comments