Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/en_US/directory_dialog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file modified docs/en_US/images/directory_definition.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/en_US/images/directory_general.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 3 additions & 20 deletions web/pgadmin/browser/server_groups/servers/directories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,26 +316,9 @@ def create(self, gid, sid):
"/".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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 %}