mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-07-07 04:53:25 -05:00
Updated config file documentation for shared storage and While doing save as operation, ensure the error message is shown if access is restricted in shared storage #5014
This commit is contained in:
parent
36d18ba5cb
commit
48839983fd
|
@ -56,7 +56,7 @@ Shared Storage
|
||||||
|
|
||||||
In the storage manager, ``My Storage`` is the pgAdmin user’s storage directory, and other listed directories are shared
|
In the storage manager, ``My Storage`` is the pgAdmin user’s storage directory, and other listed directories are shared
|
||||||
storages set by the pgAdmin server administrator. Using these, pgAdmin users can have common storages to share files.
|
storages set by the pgAdmin server administrator. Using these, pgAdmin users can have common storages to share files.
|
||||||
pgAdmin server administrator can configure the shared storages using the <link>config file</link>. Storages can be
|
pgAdmin server administrator can configure the shared storages using the :ref:`config file <config_py>`. Storages can be
|
||||||
marked as restricted to give read-only access to non-admin pgAdmin users.
|
marked as restricted to give read-only access to non-admin pgAdmin users.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -791,12 +791,9 @@ class Filemanager():
|
||||||
|
|
||||||
if selectedDir:
|
if selectedDir:
|
||||||
if selectedDir[
|
if selectedDir[
|
||||||
'restricted_access'] and not current_user.has_role(
|
'restricted_access'] and not current_user.has_role(
|
||||||
"Administrator"):
|
"Administrator"):
|
||||||
return make_json_response(success=0,
|
raise PermissionError(ACCESS_DENIED_MESSAGE)
|
||||||
errormsg=ACCESS_DENIED_MESSAGE,
|
|
||||||
info='ACCESS_DENIED',
|
|
||||||
status=403)
|
|
||||||
|
|
||||||
def rename(self, old=None, new=None):
|
def rename(self, old=None, new=None):
|
||||||
"""
|
"""
|
||||||
|
@ -1140,7 +1137,8 @@ def file_manager(trans_id):
|
||||||
ss = kwargs['storage_folder'] if 'storage_folder' in kwargs else None
|
ss = kwargs['storage_folder'] if 'storage_folder' in kwargs else None
|
||||||
my_fm = Filemanager(trans_id, ss)
|
my_fm = Filemanager(trans_id, ss)
|
||||||
|
|
||||||
if ss and mode in ['upload', 'rename', 'delete', 'addfolder', 'add']:
|
if ss and mode in ['upload', 'rename', 'delete', 'addfolder', 'add',
|
||||||
|
'permission']:
|
||||||
my_fm.check_access(ss, mode)
|
my_fm.check_access(ss, mode)
|
||||||
func = getattr(my_fm, mode)
|
func = getattr(my_fm, mode)
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -327,11 +327,12 @@ export class FileManagerUtils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkPermission(path) {
|
async checkPermission(path, selectedStorage=MY_STORAGE) {
|
||||||
try {
|
try {
|
||||||
let res = await this.api.post(this.fileConnectorUrl, {
|
let res = await this.api.post(this.fileConnectorUrl, {
|
||||||
'path': path,
|
'path': path,
|
||||||
'mode': 'permission',
|
'mode': 'permission',
|
||||||
|
'storage_folder': selectedStorage
|
||||||
});
|
});
|
||||||
if (res.data.data.result.Code === 1) {
|
if (res.data.data.result.Code === 1) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -589,7 +590,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS
|
||||||
newFileName += `.${fileType}`;
|
newFileName += `.${fileType}`;
|
||||||
}
|
}
|
||||||
onOkPath = fmUtilsObj.join(fmUtilsObj.currPath, newFileName);
|
onOkPath = fmUtilsObj.join(fmUtilsObj.currPath, newFileName);
|
||||||
let error = await fmUtilsObj.checkPermission(onOkPath);
|
let error = await fmUtilsObj.checkPermission(onOkPath, selectedSS);
|
||||||
if(error) {
|
if(error) {
|
||||||
setErrorMsg(error);
|
setErrorMsg(error);
|
||||||
setLoaderText('');
|
setLoaderText('');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user