mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
bug fix remote access
This commit is contained in:
@@ -16,6 +16,7 @@ import argparse
|
||||
from loginSystem.models import Administrator
|
||||
import plogical.randomPassword as randomPassword
|
||||
from plogical.httpProc import httpProc
|
||||
from backup.models import DBUsers
|
||||
|
||||
class DatabaseManager:
|
||||
|
||||
@@ -250,12 +251,17 @@ class DatabaseManager:
|
||||
db = Databases.objects.filter(dbUser=userName)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if ACLManager.checkOwnership(db[0].website.domain, admin, currentACL) == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
mysqlUtilities.allowRemoteAccess(db[0].dbName, userName, remoteIP)
|
||||
# mysqlUtilities.allowRemoteAccess(db[0].dbName, userName, remoteIP)
|
||||
|
||||
mysqlUtilities.createDatabase(db[0].dbName, userName, 'cyberpanel', 0, remoteIP)
|
||||
dbUserInMysql = DBUsers.objects.get(user=userName, host='localhost')
|
||||
mysqlUtilities.changePassword(userName, dbUserInMysql.password, 1, remoteIP)
|
||||
|
||||
metaData = {'remoteIP': remoteIP}
|
||||
|
||||
|
||||
@@ -804,6 +804,7 @@ class backupUtilities:
|
||||
|
||||
if float(version) > 2.0 or float(build) > 0:
|
||||
if path.find('/home/%s/public_html' % masterDomain) == -1:
|
||||
|
||||
#copy_tree('%s/%s-docroot' % (completPath, domain), path)
|
||||
|
||||
## First remove if already exists
|
||||
@@ -899,8 +900,10 @@ class backupUtilities:
|
||||
if mysqlUtilities.mysqlUtilities.restoreDatabaseBackup(dbName, completPath, password, 1) == 0:
|
||||
raise BaseException
|
||||
|
||||
mysqlUtilities.mysqlUtilities.createDatabase(dbName, dbUser, password, 0, dbHost)
|
||||
|
||||
### This function will not create database, only database user is created as third value is 0 for createDB
|
||||
|
||||
mysqlUtilities.mysqlUtilities.createDatabase(dbName, dbUser, password, 0, dbHost)
|
||||
mysqlUtilities.mysqlUtilities.changePassword(dbUser, password, 1, dbHost)
|
||||
|
||||
# UserInMySQLTable = DBUsers.objects.get(user=dbUser, host=dbHost)
|
||||
|
||||
@@ -840,8 +840,6 @@ password=%s
|
||||
return 0
|
||||
cursor.execute("use mysql")
|
||||
|
||||
|
||||
|
||||
if host != None:
|
||||
LOCALHOST = host
|
||||
else:
|
||||
@@ -916,18 +914,6 @@ password=%s
|
||||
execPath = "/usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/mysqlUtilities.py enableRemoteMYSQL"
|
||||
ProcessUtilities.executioner(execPath)
|
||||
|
||||
connection, cursor = mysqlUtilities.setupConnection()
|
||||
|
||||
if connection == 0:
|
||||
return 0
|
||||
cursor.execute("use mysql")
|
||||
|
||||
cursor.execute("update db set Host='%s' where Db='%s'" % (remoteIP, dbName))
|
||||
cursor.execute("update user set Host='%s' where user='%s'" % (remoteIP, userName))
|
||||
cursor.execute("FLUSH PRIVILEGES")
|
||||
|
||||
connection.close()
|
||||
|
||||
return 1
|
||||
|
||||
except BaseException as msg:
|
||||
|
||||
Reference in New Issue
Block a user