mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-21 16:27:39 -06: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
|
||||
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.
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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('');
|
||||
|
Loading…
Reference in New Issue
Block a user