centralized execution ph2

This commit is contained in:
usmannasir
2019-03-26 16:19:03 +05:00
parent cc6b52fa71
commit 3dd0969350
70 changed files with 2485 additions and 2189 deletions

View File

@@ -9,12 +9,13 @@ from django.shortcuts import render, redirect
from django.http import HttpResponse
import json
from plogical.acl import ACLManager
import subprocess, shlex
import plogical.CyberCPLogFileWriter as logging
from plogical.mysqlUtilities import mysqlUtilities
from websiteFunctions.models import Websites
from databases.models import Databases
from plogical.processUtilities import ProcessUtilities
import argparse
from loginSystem.models import Administrator
import plogical.randomPassword as randomPassword
class DatabaseManager:
@@ -24,6 +25,12 @@ class DatabaseManager:
except BaseException, msg:
return HttpResponse(str(msg))
def phpMyAdmin(self, request = None, userID = None):
try:
return render(request, 'databases/phpMyAdmin.html')
except BaseException, msg:
return HttpResponse(str(msg))
def createDatabase(self, request = None, userID = None):
try:
currentACL = ACLManager.loadedACL(userID)
@@ -165,19 +172,10 @@ class DatabaseManager:
userName = data['dbUserName']
dbPassword = data['dbPassword']
passFile = "/etc/cyberpanel/mysqlPassword"
f = open(passFile)
data = f.read()
password = data.split('\n', 1)[0]
res = mysqlUtilities.changePassword(userName, dbPassword)
passwordCMD = "use mysql;SET PASSWORD FOR '" + userName + "'@'localhost' = PASSWORD('" + dbPassword + "');FLUSH PRIVILEGES;"
command = 'sudo mysql -u root -p' + password + ' -e "' + passwordCMD + '"'
cmd = shlex.split(command)
res = ProcessUtilities.executioner(cmd)
if res == 1:
if res == 0:
data_ret = {'status': 0, 'changePasswordStatus': 0,'error_message': "Please see CyberPanel main log file."}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
@@ -189,4 +187,49 @@ class DatabaseManager:
except BaseException, msg:
data_ret = {'status': 0, 'changePasswordStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
return HttpResponse(json_data)
@staticmethod
def generatePHPMYAdminData(userID):
try:
admin = Administrator.objects.get(id=userID)
path = '/etc/cyberpanel/' + admin.userName
currentACL = ACLManager.loadedACL(userID)
websiteOBJs = ACLManager.findWebsiteObjects(currentACL, userID)
finalUserPassword = randomPassword.generate_pass()
writeToFile = open(path, 'w')
writeToFile.write(finalUserPassword)
writeToFile.close()
mysqlUtilities.createDBUser(admin.userName, finalUserPassword)
mysqlUtilities.changePassword(admin.userName, finalUserPassword)
for webs in websiteOBJs:
for db in webs.databases_set.all():
mysqlUtilities.allowGlobalUserAccess(admin.userName, db.dbName)
print "1," + finalUserPassword
except BaseException, msg:
print "0," + str(msg)
def main():
parser = argparse.ArgumentParser(description='CyberPanel Installer')
parser.add_argument('function', help='Specific a function to call!')
parser.add_argument('--userID', help='Logged in user ID')
args = parser.parse_args()
if args.function == "generatePHPMYAdminData":
DatabaseManager.generatePHPMYAdminData(int(args.userID))
if __name__ == "__main__":
main()

View File

@@ -4,7 +4,7 @@
/* Java script code to create database */
app.controller('createDatabase', function($scope,$http) {
app.controller('createDatabase', function ($scope, $http) {
$scope.createDatabaseLoading = true;
$scope.dbDetails = true;
@@ -14,103 +14,99 @@ app.controller('createDatabase', function($scope,$http) {
$scope.generatedPasswordView = true;
$scope.showDetailsBoxes = function(){
$scope.showDetailsBoxes = function () {
$scope.dbDetails = false;
};
$scope.createDatabase = function(){
$scope.createDatabase = function () {
$scope.createDatabaseLoading = false;
$scope.createDatabaseLoading = false;
$scope.dbDetails = false;
$scope.databaseCreationFailed = true;
$scope.databaseCreated = true;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
var dbName = $scope.dbName;
var dbUsername = $scope.dbUsername;
var dbPassword = $scope.dbPassword;
var webUserName = "";
// getting website username
webUserName = databaseWebsite.replace(/-/g, '');
webUserName = webUserName.split(".")[0];
if (webUserName.length > 5) {
webUserName = webUserName.substring(0, 4);
}
var url = "/dataBases/submitDBCreation";
var data = {
webUserName: webUserName,
databaseWebsite: databaseWebsite,
dbName: dbName,
dbUsername: dbUsername,
dbPassword: dbPassword
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.createDBStatus == 1) {
$scope.createDatabaseLoading = true;
$scope.dbDetails = false;
$scope.databaseCreationFailed = true;
$scope.databaseCreated = true;
$scope.databaseCreated = false;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
var dbName = $scope.dbName;
var dbUsername = $scope.dbUsername;
var dbPassword = $scope.dbPassword;
var webUserName = "";
}
// getting website username
webUserName = databaseWebsite.replace(/-/g, '');
webUserName = webUserName.split(".")[0];
if(webUserName.length > 5){
webUserName = webUserName.substring(0,4);
}
var url = "/dataBases/submitDBCreation";
else {
var data = {
webUserName:webUserName,
databaseWebsite:databaseWebsite,
dbName:dbName,
dbUsername:dbUsername,
dbPassword:dbPassword
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$scope.createDatabaseLoading = true;
$scope.dbDetails = false;
$scope.databaseCreationFailed = false;
$scope.databaseCreated = true;
$scope.couldNotConnect = true;
$scope.errorMessage = response.data.error_message;
function ListInitialDatas(response) {
}
if(response.data.createDBStatus == 1){
$scope.createDatabaseLoading = true;
$scope.dbDetails = false;
$scope.databaseCreationFailed = true;
$scope.databaseCreated = false;
$scope.couldNotConnect = true;
}
else
{
$scope.createDatabaseLoading = true;
$scope.dbDetails = false;
$scope.databaseCreationFailed = false;
$scope.databaseCreated = true;
$scope.couldNotConnect = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.createDatabaseLoading = true;
$scope.dbDetails = true;
$scope.databaseCreationFailed = true;
$scope.databaseCreated = true;
$scope.couldNotConnect = false;
}
}
function cantLoadInitialDatas(response) {
$scope.createDatabaseLoading = true;
$scope.dbDetails = true;
$scope.databaseCreationFailed = true;
$scope.databaseCreated = true;
$scope.couldNotConnect = false;
}
};
$scope.generatePassword = function () {
$scope.generatedPasswordView = false;
$scope.dbPassword = randomPassword(12);
$scope.generatedPasswordView = false;
$scope.dbPassword = randomPassword(12);
};
$scope.usePassword = function () {
@@ -122,7 +118,7 @@ app.controller('createDatabase', function($scope,$http) {
/* Java script code to delete database */
app.controller('deleteDatabase', function($scope,$http) {
app.controller('deleteDatabase', function ($scope, $http) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
@@ -131,153 +127,147 @@ app.controller('deleteDatabase', function($scope,$http) {
$scope.couldNotConnect = true;
$scope.fetchDatabases = function(){
$scope.fetchDatabases = function () {
$scope.deleteDatabaseLoading = false;
$scope.fetchedDatabases = true;
$scope.deleteDatabaseLoading = false;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
var url = "/dataBases/fetchDatabases";
var data = {
databaseWebsite: databaseWebsite,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.fetchStatus == 1) {
$scope.dbnames = JSON.parse(response.data.data);
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = false;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
}
var url = "/dataBases/fetchDatabases";
else {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = false;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
var data = {
databaseWebsite:databaseWebsite,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$scope.errorMessage = response.data.error_message;
function ListInitialDatas(response) {
}
if(response.data.fetchStatus == 1){
}
function cantLoadInitialDatas(response) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = false;
$scope.dbnames = JSON.parse(response.data.data);
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = false;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
}
else
{
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = false;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = false;
}
}
};
$scope.deleteDatabase = function(){
$scope.deleteDatabase = function () {
$scope.deleteDatabaseLoading = false;
$scope.fetchedDatabases = true;
$scope.deleteDatabaseLoading = false;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
var url = "/dataBases/submitDatabaseDeletion";
var data = {
dbName: $scope.selectedDB,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.deleteStatus == 1) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = false;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = false;
$scope.couldNotConnect = true;
}
else {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = false;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
var databaseWebsite = $scope.databaseWebsite;
var url = "/dataBases/submitDatabaseDeletion";
$scope.errorMessage = response.data.error_message;
var data = {
dbName:$scope.selectedDB,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
}
function ListInitialDatas(response) {
}
function cantLoadInitialDatas(response) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = false;
if(response.data.deleteStatus == 1){
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = false;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = false;
$scope.couldNotConnect = true;
}
else
{
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = false;
$scope.databaseDeleted = true;
$scope.couldNotConnect = true;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.deleteDatabaseLoading = true;
$scope.fetchedDatabases = true;
$scope.databaseDeletionFailed = true;
$scope.databaseDeleted = true;
$scope.couldNotConnect = false;
}
}
};
@@ -289,7 +279,7 @@ app.controller('deleteDatabase', function($scope,$http) {
/* Java script code to list databases */
app.controller('listDBs', function($scope,$http) {
app.controller('listDBs', function ($scope, $http) {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
@@ -303,161 +293,161 @@ app.controller('listDBs', function($scope,$http) {
var globalDBUsername = "";
$scope.fetchDBs = function () {
populateCurrentRecords();
populateCurrentRecords();
};
$scope.changePassword = function (dbUsername) {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = false;
$scope.changePasswordBox = false;
$scope.notificationsBox = true;
$scope.dbUsername = dbUsername;
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = false;
$scope.changePasswordBox = false;
$scope.notificationsBox = true;
$scope.dbUsername = dbUsername;
globalDBUsername = dbUsername;
globalDBUsername = dbUsername;
};
$scope.changePasswordBtn = function () {
$scope.dbLoading = false;
$scope.passwordChanged = true;
$scope.dbLoading = false;
$scope.passwordChanged = true;
url = "/dataBases/changePassword";
url = "/dataBases/changePassword";
var data = {
dbUserName:globalDBUsername,
dbPassword: $scope.dbPassword,
};
var data = {
dbUserName: globalDBUsername,
dbPassword: $scope.dbPassword,
};
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
function ListInitialDatas(response) {
if(response.data.changePasswordStatus == 1){
$scope.notificationsBox = false;
$scope.passwordChanged = false;
$scope.dbLoading = true;
$scope.domainFeteched = $scope.selectedDomain;
if (response.data.changePasswordStatus == 1) {
$scope.notificationsBox = false;
$scope.passwordChanged = false;
$scope.dbLoading = true;
$scope.domainFeteched = $scope.selectedDomain;
}
else{
$scope.notificationsBox = false;
$scope.canNotChangePassword = false;
$scope.dbLoading = true;
$scope.canNotChangePassword = false;
$scope.errorMessage = response.data.error_message;
}
}
else {
$scope.notificationsBox = false;
$scope.canNotChangePassword = false;
$scope.dbLoading = true;
$scope.canNotChangePassword = false;
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.notificationsBox = false;
$scope.couldNotConnect = false;
$scope.dbLoading = true;
}
}
function cantLoadInitialDatas(response) {
$scope.notificationsBox = false;
$scope.couldNotConnect = false;
$scope.dbLoading = true;
};
}
function populateCurrentRecords(){
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = false;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
};
var selectedDomain = $scope.selectedDomain;
function populateCurrentRecords() {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = false;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
url = "/dataBases/fetchDatabases";
var selectedDomain = $scope.selectedDomain;
var data = {
databaseWebsite:selectedDomain,
};
url = "/dataBases/fetchDatabases";
var config = {
headers : {
'X-CSRFToken': getCookie('csrftoken')
}
};
var data = {
databaseWebsite: selectedDomain,
};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data,config).then(ListInitialDatas, cantLoadInitialDatas);
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
function ListInitialDatas(response) {
if(response.data.fetchStatus == 1){
if (response.data.fetchStatus == 1) {
$scope.records = JSON.parse(response.data.data);
$scope.records = JSON.parse(response.data.data);
$scope.recordsFetched = false;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = false;
$scope.changePasswordBox = true;
$scope.notificationsBox = false;
$scope.recordsFetched = false;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = false;
$scope.changePasswordBox = true;
$scope.notificationsBox = false;
$scope.domainFeteched = $scope.selectedDomain;
$scope.domainFeteched = $scope.selectedDomain;
}
else{
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
}
else {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = true;
$scope.dbLoading = true;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
$scope.errorMessage = response.data.error_message;
}
$scope.errorMessage = response.data.error_message;
}
}
function cantLoadInitialDatas(response) {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = false;
$scope.dbLoading = true;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
}
}
function cantLoadInitialDatas(response) {
$scope.recordsFetched = true;
$scope.passwordChanged = true;
$scope.canNotChangePassword = true;
$scope.couldNotConnect = false;
$scope.dbLoading = true;
$scope.dbAccounts = true;
$scope.changePasswordBox = true;
$scope.notificationsBox = true;
}
}
}
////
$scope.generatedPasswordView = true;
$scope.generatePassword = function () {
$scope.generatedPasswordView = false;
$scope.dbPassword = randomPassword(12);
$scope.generatedPasswordView = false;
$scope.dbPassword = randomPassword(12);
};
$scope.usePassword = function () {
@@ -467,4 +457,40 @@ app.controller('listDBs', function($scope,$http) {
});
/* Java script code to list database ends here */
/* Java script code to list database ends here */
app.controller('phpMyAdmin', function ($scope, $http, $window) {
function setupPHPMYAdminSession() {
url = "/dataBases/setupPHPMYAdminSession";
var data = {};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.status === 1) {
$window.location.href = '/phpmyadmin';
}
else {}
}
function cantLoadInitialDatas(response) {}
}
setupPHPMYAdminSession();
});

View File

@@ -0,0 +1,73 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "phpMyAdmin - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<div class="container">
<div id="page-title">
<h2>{% trans "Create Database" %}</h2>
<p>{% trans "Create a new database on this page." %}</p>
</div>
<div ng-controller="phpMyAdmin" class="panel">
<div class="panel-body">
<h3 class="content-box-header">
{% trans "Create Database" %} <img ng-hide="createDatabaseLoading" src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper">
<form class="form-horizontal bordered-row panel-body">
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Website" %}</label>
<div class="col-sm-6">
<select ng-change="showDetailsBoxes()" ng-model="databaseWebsite" class="form-control">
{% for items in websitesList %}
<option>{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<div ng-hide="databaseCreationFailed" class="alert alert-danger">
<p>{% trans "Cannot create database. Error message:" %} {$ errorMessage $}</p>
</div>
<div ng-hide="databaseCreated" class="alert alert-success">
<p>{% trans "Database created successfully." %}</p>
</div>
<div ng-hide="couldNotConnect" class="alert alert-danger">
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View File

@@ -14,4 +14,6 @@ urlpatterns = [
url(r'^listDBs', views.listDBs, name='listDBs'),
url(r'^changePassword', views.changePassword, name='changePassword'),
url(r'^phpMyAdmin$', views.phpMyAdmin, name='phpMyAdmin'),
url(r'^setupPHPMYAdminSession$', views.setupPHPMYAdminSession, name='setupPHPMYAdminSession'),
]

View File

@@ -1,11 +1,14 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import redirect
from django.shortcuts import redirect, HttpResponse
from loginSystem.views import loadLoginPage
from databaseManager import DatabaseManager
from pluginManager import pluginManager
import json
from plogical.processUtilities import ProcessUtilities
from loginSystem.models import Administrator
import CyberCP.settings as settings
# Create your views here.
def loadDatabaseHome(request):
@@ -116,3 +119,39 @@ def changePassword(request):
return coreResult
except KeyError:
return redirect(loadLoginPage)
def phpMyAdmin(request):
try:
userID = request.session['userID']
dm = DatabaseManager()
return dm.phpMyAdmin(request, userID)
except KeyError:
return redirect(loadLoginPage)
def setupPHPMYAdminSession(request):
try:
userID = request.session['userID']
admin = Administrator.objects.get(id = userID)
execPath = "sudo python /usr/local/CyberCP/databases/databaseManager.py"
execPath = execPath + " generatePHPMYAdminData --userID " + str(userID)
output = ProcessUtilities.outputExecutioner(execPath)
if output.find("1,") > -1:
request.session['PMA_single_signon_user'] = admin.userName
request.session['PMA_single_signon_password'] = output.split(',')[1]
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
else:
data_ret = {'status': 1}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)
except BaseException, msg:
data_ret = {'status': 0, 'createDBStatus': 0, 'error_message': str(msg)}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)