Fixed directory owner update & UI issues. #8034

This commit is contained in:
Rohit Bhati authored and GitHub committed 2025-03-17 12:22:06 +05:30
1 parent c80be9b3a3
commit 797bdb8696
7 files changed
+18 -27

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
`Directory Dialog`:index:
*************************
Use the Directory dialog to Create an alias for a file system directory path.
Use the Directory dialog to create an alias for a file system directory path.
To create directories, you must have the CREATE ANY DIRECTORY system privilege.
When you create a directory, you are automatically granted READ and WRITE privileges
on the directory, and you can grant READ and WRITE privileges to other users and roles.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 44 KiB

@@ -316,26 +316,9 @@ class DirectoryView(PGChildNodeView):
"/".join([self.template_path, self._ALTER_SQL]),
data=data, conn=self.conn
)
# Checking if we are not executing empty query
if SQL and SQL.strip('\n') and SQL.strip(' '):
status, res = self.conn.execute_scalar(SQL)
if not status:
return jsonify(
node=self.blueprint.generate_browser_node(
dr_id,
sid,
data['name'],
icon="icon-directory"
),
success=0,
errormsg=gettext(
'Directory created successfully.'
),
info=gettext(
res
)
)
status, res = self.conn.execute_scalar(SQL)
if not status:
return internal_server_error(errormsg=res)
return jsonify(
node=self.blueprint.generate_browser_node(
@@ -14,8 +14,8 @@ import { isEmptyString } from '../../../../../../static/js/validators';
export default class DirectorySchema extends BaseUISchema {
constructor(getPrivilegeRoleSchema, treeNodeInfo, fieldOptions={}, initValues={}) {
super({
diruser: undefined,
name: undefined,
owner: undefined,
path: undefined,
diracl: [],
...initValues,
@@ -1,11 +1,6 @@
{### SQL to alter directory ###}
{% import 'macros/privilege.macros' as PRIVILEGE %}
{% if data %}
{### Owner on directory ###}
{% if data.diruser %}
ALTER DIRECTORY {{ conn|qtIdent(data.name) }}
OWNER TO {{ conn|qtIdent(data.diruser) }};
{% endif %}
{### ACL on directory ###}
{% if data.diracl %}
@@ -1,4 +1,17 @@
{### SQL to create directory object ###}
{% if data %}
CREATE DIRECTORY {{ conn|qtIdent(data.name) }} AS {{ data.path|qtLiteral(conn) }};
{### Owner on directory ###}
{% if data.diruser %}
ALTER DIRECTORY {{ conn|qtIdent(data.name) }}
OWNER TO {{ conn|qtIdent(data.diruser) }};
{% endif %}
{% endif %}
{# ======== The SQl Below will fetch id for given directory ======== #}
{% if directory %}
SELECT dir.oid FROM pg_catalog.edb_dir dir WHERE dirname = {{directory|qtLiteral(conn)}};
{% endif %}