mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that the dump servers functionality works from setup.py. Fixes #7644
This commit is contained in:
parent
e58b9c767b
commit
72f819ec67
@ -18,4 +18,5 @@ Housekeeping
|
|||||||
Bug fixes
|
Bug fixes
|
||||||
*********
|
*********
|
||||||
|
|
||||||
|
| `Issue #7644 <https://redmine.postgresql.org/issues/7644>`_ - Ensure that the dump servers functionality works from setup.py.
|
||||||
| `Issue #7646 <https://redmine.postgresql.org/issues/7646>`_ - Ensure that the Import/Export server menu option is visible.
|
| `Issue #7646 <https://redmine.postgresql.org/issues/7646>`_ - Ensure that the Import/Export server menu option is visible.
|
||||||
|
@ -677,8 +677,8 @@ class Filemanager(object):
|
|||||||
return files
|
return files
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_access_permission(in_dir, path):
|
def check_access_permission(in_dir, path, skip_permission_check=False):
|
||||||
if not config.SERVER_MODE:
|
if not config.SERVER_MODE or skip_permission_check:
|
||||||
return
|
return
|
||||||
|
|
||||||
in_dir = '' if in_dir is None else in_dir
|
in_dir = '' if in_dir is None else in_dir
|
||||||
|
@ -443,7 +443,8 @@ def dump_database_servers(output_file, selected_servers,
|
|||||||
|
|
||||||
from pgadmin.misc.file_manager import Filemanager
|
from pgadmin.misc.file_manager import Filemanager
|
||||||
try:
|
try:
|
||||||
Filemanager.check_access_permission(storage_manager_path, file_path)
|
Filemanager.check_access_permission(storage_manager_path, file_path,
|
||||||
|
from_setup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return _handle_error(str(e), from_setup)
|
return _handle_error(str(e), from_setup)
|
||||||
|
|
||||||
@ -732,14 +733,14 @@ def _does_user_exist(user, from_setup):
|
|||||||
if isinstance(user, User):
|
if isinstance(user, User):
|
||||||
user = user.email
|
user = user.email
|
||||||
|
|
||||||
user = User.query.filter_by(email=user).first()
|
new_user = User.query.filter_by(email=user).first()
|
||||||
|
|
||||||
if user is None:
|
if new_user is None:
|
||||||
print(USER_NOT_FOUND % user)
|
print(USER_NOT_FOUND % user)
|
||||||
if from_setup:
|
if from_setup:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return user
|
return new_user
|
||||||
|
|
||||||
|
|
||||||
def _handle_error(error_msg, from_setup):
|
def _handle_error(error_msg, from_setup):
|
||||||
|
@ -150,7 +150,7 @@ describe('SearchObjects', ()=>{
|
|||||||
};
|
};
|
||||||
|
|
||||||
it('search', (done)=>{
|
it('search', (done)=>{
|
||||||
let ctrl = ctrlMount({});
|
let ctrl = ctrlMount();
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
ctrl.update();
|
ctrl.update();
|
||||||
ctrl.find('InputText').find('input').simulate('change', {
|
ctrl.find('InputText').find('input').simulate('change', {
|
||||||
@ -166,7 +166,7 @@ describe('SearchObjects', ()=>{
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('search_on_enter', (done)=>{
|
it('search_on_enter', (done)=>{
|
||||||
let ctrl = ctrlMount({});
|
let ctrl = ctrlMount();
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
ctrl.update();
|
ctrl.update();
|
||||||
ctrl.find('InputText').find('input').simulate('change', {
|
ctrl.find('InputText').find('input').simulate('change', {
|
||||||
|
@ -59,7 +59,7 @@ def dump_servers(args):
|
|||||||
print('----------')
|
print('----------')
|
||||||
|
|
||||||
app = create_app(config.APP_NAME + '-cli')
|
app = create_app(config.APP_NAME + '-cli')
|
||||||
with app.app_context():
|
with app.test_request_context():
|
||||||
dump_database_servers(args.dump_servers, args.servers, dump_user, True)
|
dump_database_servers(args.dump_servers, args.servers, dump_user, True)
|
||||||
|
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ def load_servers(args):
|
|||||||
print('----------')
|
print('----------')
|
||||||
|
|
||||||
app = create_app(config.APP_NAME + '-cli')
|
app = create_app(config.APP_NAME + '-cli')
|
||||||
with app.app_context():
|
with app.test_request_context():
|
||||||
load_database_servers(args.load_servers, None, load_user, True)
|
load_database_servers(args.load_servers, None, load_user, True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user