Show default database privileges in properties mode. Fixes #1538

This commit is contained in:
Harshal Dhumal 2016-08-17 14:22:56 +01:00 committed by Dave Page
parent 91e3d3267f
commit 1056e9553f
4 changed files with 23 additions and 0 deletions

View File

@ -230,6 +230,18 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
},{
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
},{
id: 'tblacl', label: '{{ _('Default TABLE Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
},{
id: 'seqacl', label: '{{ _('Default SEQUENCE Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
},{
id: 'funcacl', label: '{{ _('Default FUNCTION Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true
},{
id: 'typeacl', label: '{{ _('Default TYPE Privileges') }}', type: 'text',
group: '{{ _('Security') }}', mode: ['properties'], disabled: true, min_version: 90200
},{
id: 'comments', label:'{{ _('Comment') }}',
editable: false, type: 'multiline'

View File

@ -5,6 +5,9 @@ SELECT
has_database_privilege(db.oid, 'CREATE') as cancreate,
current_setting('default_tablespace') AS default_tablespace,
descr.description as comments,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = 0::OID) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = 0::OID) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = 0::OID) AS funcacl,
array_to_string(datacl::text[], ', ') AS acl
FROM pg_database db
LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace=ta.OID

View File

@ -5,6 +5,10 @@ SELECT
has_database_privilege(db.oid, 'CREATE') as cancreate,
current_setting('default_tablespace') AS default_tablespace,
descr.description as comments,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = 0::OID) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = 0::OID) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = 0::OID) AS funcacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = 0::OID) AS typeacl,
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels,
array_to_string(datacl::text[], ', ') AS acl
FROM pg_database db

View File

@ -5,6 +5,10 @@ SELECT
has_database_privilege(db.oid, 'CREATE') as cancreate,
current_setting('default_tablespace') AS default_tablespace,
descr.description as comments,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'r' AND defaclnamespace = 0::OID) AS tblacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'S' AND defaclnamespace = 0::OID) AS seqacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'f' AND defaclnamespace = 0::OID) AS funcacl,
(SELECT array_to_string(defaclacl::text[], ', ') FROM pg_default_acl WHERE defaclobjtype = 'T' AND defaclnamespace = 0::OID) AS typeacl,
(SELECT array_agg(provider || '=' || label) FROM pg_shseclabel sl1 WHERE sl1.objoid=db.oid) AS seclabels,
array_to_string(datacl::text[], ', ') AS acl
FROM pg_database db