diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js index 91df7bd..7b6cb73 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/templates/domains/js/domains.js @@ -292,10 +292,13 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { type: 'collection', group: '{{ _('Constraints') }}', mode: ['edit', 'create'], model: ConstraintModel, canAdd: true, canDelete: true, canEdit: false, columns: ['conname','consrc', 'convalidated'] - },{ + },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'seclabels', label: '{{ _('Security Labels') }}', model: SecurityModel, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection', uniqueCol : ['provider'] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js index 2e730f8..3edd1f8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/js/foreign_tables.js @@ -673,17 +673,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { type: 'text', group: '{{ _('Security') }}', mode: ['properties'], min_version: 90200 },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin .Browser.Node.PrivilegeRoleModel.extend( {privileges: ['a','r','w','x']}), uniqueCol : ['grantee', 'grantor'], - editable: false, type: 'collection', group: '{{ _('Security') }}', + editable: false, type: 'collection', group: 'security', mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', min_version: 90200 },{ id: 'seclabels', label: '{{ _('Security Labels') }}', model: SecurityModel, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection', uniqueCol : ['provider'] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js index 39a7bc5..20b06d2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/js/functions.js @@ -323,11 +323,14 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { model: pgAdmin.Browser.Node.VariableModel, mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false, canDelete: true, disabled: 'isDisabled' - },{ + },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'acl', label: '{{ _('Privileges') }}', model: pgAdmin .Browser.Node.PrivilegeRoleModel.extend( {privileges: ['X']}), uniqueCol : ['grantee', 'grantor'], - editable: false, type: 'collection', group: '{{ _('Security') }}', + editable: false, type: 'collection', group: 'security', mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', disabled: 'isDisabled' @@ -335,7 +338,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { { id: 'seclabels', label: '{{ _('Security Labels') }}', model: SecurityModel, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, canEdit: true, canDelete: true, control: 'unique-col-collection', uniqueCol : ['provider'], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js index d070f2b..2791f57 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/sequences/templates/sequence/js/sequence.js @@ -58,7 +58,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { collection_type: 'coll-sequence', hasSQL: true, hasDepends: true, - parent_type: ['schema'], + parent_type: ['schema', 'catalog'], Init: function() { /* Avoid mulitple registration of menus */ if (this.initialized) @@ -203,17 +203,20 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { 'size': 'small' } },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'acl', label: '{{ _('Privileges') }}', type: 'text', - group: '{{ _('Security') }}', mode: ['properties'], disabled: true + group: '{{ _("Security") }}', mode: ['properties'], disabled: true },{ id: 'relacl', label: '{{ _('Privileges') }}', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend( {privileges: ['r', 'w', 'U']}), uniqueCol : ['grantee', 'grantor'], - editable: false, type: 'collection', group: '{{ _('Security') }}', mode: ['edit', 'create'], + editable: false, type: 'collection', group: 'security', mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', },{ id: 'securities', label: '{{ _('Securitiy Labels') }}', model: SecurityModel, editable: false, type: 'collection', canEdit: false, - group: '{{ _('Security') }}', canDelete: true, + group: 'security', canDelete: true, mode: ['edit', 'create'], canAdd: true, control: 'unique-col-collection', uniqueCol : ['provider'], min_version: 90200 diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js index 3c3da63..9949b78 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/table/js/table.js @@ -712,12 +712,15 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { mode: ['edit', 'create'], schema: Backform.VacuumSettingsSchema },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'relacl_str', label:'{{ _('Privileges') }}', cell: 'string', type: 'text', mode: ['properties'], group: '{{ _('Security') }}', disabled: 'inSchema' },{ - id: 'relacl', label: 'Privileges', type: 'collection', - group: '{{ _('Security') }}', control: 'unique-col-collection', + id: 'relacl', label: '{{ _('Privileges') }}', type: 'collection', + group: 'security', control: 'unique-col-collection', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({ privileges: ['a','r','w','d','D','x','t']}), mode: ['edit', 'create'], canAdd: true, canDelete: true, @@ -725,7 +728,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) { },{ id: 'seclabels', label: '{{ _('Security labels') }}', model: pgAdmin.Browser.SecurityModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: 'security', mode: ['edit', 'create'], min_version: 90100, canAdd: true, canEdit: false, canDelete: true, control: 'unique-col-collection' },{ diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js index a22e8d5..d2fd765 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/templates/schema/js/schema.js @@ -6,84 +6,84 @@ define( function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { - // VaccumSettings Collection to display all settings parameters as Grid - var VacuumCollectionControl = Backform.VacuumCollectionControl = - Backform.Control.extend({ - - grid_columns:undefined, - - initialize: function() { - Backform.Control.prototype.initialize.apply(this, arguments); - var self = this, - m = this.model; - url = self.field.get('url'); - - if (url && m.isNew()) { - var node = self.field.get('node'), - node_data = self.field.get('node_data'), - node_info = self.field.get('node_info'), - full_url = node.generate_url.apply( - node, [ - null, url, node_data, false, node_info - ]), - data; - m.trigger('pgadmin-view:fetching', m, self.field); - - // fetch default values for autovacuum fields - $.ajax({ - async: false, - url: full_url, - success: function (res) { - data = res; - }, - error: function() { - m.trigger('pgadmin-view:fetch:error', m, self.field); - } - }); - m.trigger('pgadmin-view:fetched', m, self.field); - - // Add fetched models into collection - if (data && _.isArray(data)) { - m.get(self.field.get('name')).reset(data, {silent: true}); + // VaccumSettings Collection to display all settings parameters as Grid + var VacuumCollectionControl = Backform.VacuumCollectionControl = + Backform.Control.extend({ + + grid_columns:undefined, + + initialize: function() { + Backform.Control.prototype.initialize.apply(this, arguments); + var self = this, + m = this.model; + url = self.field.get('url'); + + if (url && m.isNew()) { + var node = self.field.get('node'), + node_data = self.field.get('node_data'), + node_info = self.field.get('node_info'), + full_url = node.generate_url.apply( + node, [ + null, url, node_data, false, node_info + ]), + data; + m.trigger('pgadmin-view:fetching', m, self.field); + + // fetch default values for autovacuum fields + $.ajax({ + async: false, + url: full_url, + success: function (res) { + data = res; + }, + error: function() { + m.trigger('pgadmin-view:fetch:error', m, self.field); } + }); + m.trigger('pgadmin-view:fetched', m, self.field); + + // Add fetched models into collection + if (data && _.isArray(data)) { + m.get(self.field.get('name')).reset(data, {silent: true}); } - }, + } + }, - render: function() { - var self = this, - m = this.model, - attributes = self.field.attributes; + render: function() { + var self = this, + m = this.model, + attributes = self.field.attributes; - // remove grid - if(self.grid) { - self.grid.remove(); - delete self.grid; - self.grid = undefined; - } + // remove grid + if(self.grid) { + self.grid.remove(); + delete self.grid; + self.grid = undefined; + } - self.$el.empty(); - - var gridHeader = _.template([ - '
', - ' ', - '
'].join("\n")), - gridBody = $('
').append( - gridHeader(attributes) - ); - - // Initialize a new Grid instance - var grid = self.grid = new Backgrid.Grid({ - columns: self.grid_columns, - collection: self.model.get(self.field.get('name')), - className: "backgrid table-bordered" - }); + self.$el.empty(); + + var gridHeader = _.template([ + '
', + ' ', + '
'].join("\n")), + gridBody = $('
').append( + gridHeader(attributes) + ); + + // Initialize a new Grid instance + var grid = self.grid = new Backgrid.Grid({ + columns: self.grid_columns, + collection: self.model.get(self.field.get('name')), + className: "backgrid table-bordered" + }); - // render grid - self.$el.append($(gridBody).append(grid.render().$el)); + // render grid + self.$el.append($(gridBody).append(grid.render().$el)); - return self; - } - }); + return self; + } + }); // We will use this function in VacuumSettings Control // to convert data type on the fly @@ -255,7 +255,7 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { ]; // Extend the browser's collection class for SecurityLabel control - var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({ + var SecurityModel = Backform.SecurityModel = pgAdmin.Browser.Node.Model.extend({ defaults: { provider: null, security_label: null @@ -504,7 +504,15 @@ function($, _, S, pgAdmin, pgBrowser, Backform, alertify) { return this; }, remove: Backgrid.Extension.DependentCell.prototype.remove - }); + }); + + // Show/hide security group for nodes under catalog + var is_security_group_under_catalog = pgAdmin.is_security_group_under_catalog = function(args) { + if (args && 'node_info' in args && 'catalog' in args.node_info) { + return false; + } + return true; + } return pgBrowser.Nodes['schema']; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js index c91bdf5..a9c845c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/type/js/type.js @@ -747,8 +747,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { type: 'text', mode: ['properties'], disabled: 'inSchema' },{ + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + },{ id: 'type_acl', label:'{{ _('Privileges') }}', cell: 'string', - type: 'text', mode: ['properties'], group: '{{ _('Security') }}', + type: 'text', mode: ['properties'], group: '{{ _('security') }}', disabled: 'inSchema' },{ id: 'member_list', label:'{{ _('Members') }}', cell: 'string', @@ -777,8 +780,8 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { type: 'multiline', mode: ['properties', 'create', 'edit'], disabled: 'inSchema' },{ - id: 'typacl', label: 'Privileges', type: 'collection', - group: '{{ _('Security') }}', control: 'unique-col-collection', + id: 'typacl', label:'{{ _('Privileges') }}', type: 'collection', + group: 'security', control: 'unique-col-collection', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['U']}), mode: ['edit', 'create'], canDelete: true, uniqueCol : ['grantee'], deps: ['typtype'], @@ -789,7 +792,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify, Backgrid) { },{ id: 'seclabels', label: '{{ _('Security Labels') }}', model: SecurityModel, editable: false, type: 'collection', - group: '{{ _('Security') }}', mode: ['edit', 'create'], + group: 'security', mode: ['edit', 'create'], min_version: 90100, canEdit: false, canDelete: true, control: 'unique-col-collection', deps: ['typtype'], canAdd: function(m) { diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js index f47e5b1..00a7623 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mview/js/mview.js @@ -137,8 +137,8 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { type: 'switch', disabled: true, mode: ['properties'], }, { - id: 'acl', label: '{{ _("ACL") }}', - mode: ['properties'], type: 'text' + id: 'acl', label: '{{ _("Privileges") }}', + mode: ['properties'], type: 'text', group: '{{ _("Security") }}' }, { id: 'comment', label:'{{ _("Comment") }}', cell: 'string', @@ -174,12 +174,16 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { group: '{{ _("Auto vacuum") }}', schema: Backform.VacuumSettingsSchema }, + { + id: 'security', label: '{{ _("Security") }}', + type: 'group', visible: pgAdmin.is_security_group_under_catalog + }, // Add Privilege Control { id: 'datacl', label: '{{ _("Privileges") }}', model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend( {privileges: ['a', 'r', 'w', 'd', 'D', 'x', 't']}), uniqueCol : ['grantee'], - editable: false, type: 'collection', group: '{{ _("Security") }}', + editable: false, type: 'collection', group: "security", mode: ['edit', 'create'], canAdd: true, canDelete: true, control: 'unique-col-collection', priority: 3 }, @@ -188,7 +192,7 @@ function($, _, S, pgAdmin, alertify, pgBrowser, CodeMirror) { { id: 'seclabels', label: '{{ _("Security Labels") }}', model: Backform.SecurityModel, editable: false, type: 'collection', - canEdit: false, group: '{{ _("Security") }}', canDelete: true, + canEdit: false, group: "security", canDelete: true, mode: ['edit', 'create'], canAdd: true, control: 'unique-col-collection', uniqueCol : ['provider'] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js index 745afb5..7b44a75 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/view/js/view.js @@ -123,7 +123,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { }, { id: 'acl', label: '{{ _("Privileges") }}', - mode: ['properties'], type: 'text' + mode: ['properties'], type: 'text', group: '{{ _("Security") }}' }, { id: 'comment', label:'{{ _("Comment") }}', cell: 'string', @@ -158,13 +158,7 @@ function($, _, S, pgAdmin, pgBrowser, CodeMirror) { }, { id: 'security', label: '{{ _("Security") }}', - type: 'group', - visible: function(m) { - if (m.top && 'catalog' in m.top.node_info) { - return false; - } - return true; - } + type: 'group', visible: pgAdmin.is_security_group_under_catalog }, // Add Privilege Control