mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Disable the menu to create database and tablespace, if:
* Database server is not connected. * Do not have adequate permission to create.
This commit is contained in:
@@ -62,20 +62,29 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
||||
name: 'create_tablespace_on_server', node: 'server', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
||||
icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}
|
||||
icon: 'wcTabIcon icon-tablespace', data: {action: 'create'},
|
||||
enable: 'can_create_tablespace'
|
||||
},{
|
||||
name: 'create_tablespace_on_coll', node: 'coll-tablespace', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
||||
icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'}
|
||||
icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'},
|
||||
enable: 'can_create_tablespace'
|
||||
},{
|
||||
name: 'create_tablespace', node: 'tablespace', module: this,
|
||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
||||
icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'}
|
||||
icon: 'wcTabIcon pg-icon-tablespace', data: {action: 'create'},
|
||||
enable: 'can_create_tablespace'
|
||||
}
|
||||
]);
|
||||
},
|
||||
can_create_tablespace: function(node, item) {
|
||||
var treeData = this.getTreeNodeHierarchy(item),
|
||||
server = treeData['server'];
|
||||
|
||||
return server.connected && server.user.is_superuser;
|
||||
},
|
||||
model: pgAdmin.Browser.Node.Model.extend({
|
||||
defaults: {
|
||||
name: undefined,
|
||||
|
||||
Reference in New Issue
Block a user