diff --git a/docs/en_US/storage_manager.rst b/docs/en_US/storage_manager.rst index 4fecf1e93..ae0bbbe2f 100644 --- a/docs/en_US/storage_manager.rst +++ b/docs/en_US/storage_manager.rst @@ -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 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 config file. Storages can be +pgAdmin server administrator can configure the shared storages using the :ref:`config file `. Storages can be marked as restricted to give read-only access to non-admin pgAdmin users. diff --git a/web/pgadmin/misc/file_manager/__init__.py b/web/pgadmin/misc/file_manager/__init__.py index 3b34bf968..aaa428a1e 100644 --- a/web/pgadmin/misc/file_manager/__init__.py +++ b/web/pgadmin/misc/file_manager/__init__.py @@ -791,12 +791,9 @@ class Filemanager(): if selectedDir: if selectedDir[ - 'restricted_access'] and not current_user.has_role( + 'restricted_access'] and not current_user.has_role( "Administrator"): - return make_json_response(success=0, - errormsg=ACCESS_DENIED_MESSAGE, - info='ACCESS_DENIED', - status=403) + raise PermissionError(ACCESS_DENIED_MESSAGE) 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 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) func = getattr(my_fm, mode) try: diff --git a/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx b/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx index 837d5c95d..28f211315 100644 --- a/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx +++ b/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx @@ -327,11 +327,12 @@ export class FileManagerUtils { }); } - async checkPermission(path) { + async checkPermission(path, selectedStorage=MY_STORAGE) { try { let res = await this.api.post(this.fileConnectorUrl, { 'path': path, 'mode': 'permission', + 'storage_folder': selectedStorage }); if (res.data.data.result.Code === 1) { return null; @@ -589,7 +590,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS newFileName += `.${fileType}`; } onOkPath = fmUtilsObj.join(fmUtilsObj.currPath, newFileName); - let error = await fmUtilsObj.checkPermission(onOkPath); + let error = await fmUtilsObj.checkPermission(onOkPath, selectedSS); if(error) { setErrorMsg(error); setLoaderText('');