public inbox for [email protected]help / color / mirror / Atom feed
[pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog 5+ messages / 2 participants [nested] [flat]
* [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog @ 2016-04-07 07:45 Surinder Kumar <[email protected]> 2016-04-07 10:14 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> 0 siblings, 1 reply; 5+ messages in thread From: Surinder Kumar @ 2016-04-07 07:45 UTC (permalink / raw) To: pgadmin-hackers Hi, PFA minor patch for PrivilegeRoleModel *Change*: Add check to disable PrivilegeRoleModel fields for nodes visible under catalog. Please review the patch. Thanks, Surinder Kumar -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] disable_privilege_control_for_nodes_under_catalog.patch (1.2K, 3-disable_privilege_control_for_nodes_under_catalog.patch) download | inline diff: diff --git a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js index 0a99fa3..6f0fc68 100644 --- a/web/pgadmin/browser/server_groups/servers/static/js/privilege.js +++ b/web/pgadmin/browser/server_groups/servers/static/js/privilege.js @@ -78,6 +78,10 @@ // This has been called during generating the header cell return false; } + if (m.top.node_info && 'catalog' in m.top.node_info) { + // Disable the control if it is under catalog + return true; + } return !( m.top && m.top.node_info && m.top.node_info.server.user.name == m.get('grantor') @@ -172,6 +176,10 @@ // This has been called during generating the header cell return false; } + if (column.handler.node_info && 'catalog' in column.handler.node_info) { + // Disable the control if it is under catalog + return true; + } return !(this.node_info && this.node_info.server.user.name == column.get('grantor') || this.attributes.node_info.server.user.name == column.get('grantor')); } ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog 2016-04-07 07:45 [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> @ 2016-04-07 10:14 ` Dave Page <[email protected]> 2016-04-07 10:22 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 2016-04-07 10:23 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> 0 siblings, 2 replies; 5+ messages in thread From: Dave Page @ 2016-04-07 10:14 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers Hi On Thu, Apr 7, 2016 at 8:45 AM, Surinder Kumar <[email protected]> wrote: > Hi, > > PFA minor patch for PrivilegeRoleModel > > Change: Add check to disable PrivilegeRoleModel fields for nodes visible > under catalog. > > Please review the patch. I'm unclear what this is supposed to do: - Those fields already seem to be disabled under catalog nodes (though - the Add button on subnode grids is still active, but doesn't do anything) - Shouldn't we just hide privilege info on those nodes directly? Why break modularity for this? - I'm seeing weird effects after applying this patch - see the attached screenshot. However, that issue remains even after I remove it again (and restart the server, and hard-reload). It does seem to fix itself eventually, but I'm not sure what causes that. If I try to refresh the Functions node, I get: jquery.contextMenu.js:309 No items specified to show in contextMenuhandle.contextmenu @ jquery.contextMenu.js:309jQuery.event.dispatch @ jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 jquery.contextMenu.js:312 Uncaught Error: No Items specifiedhandle.contextmenu @ jquery.contextMenu.js:312jQuery.event.dispatch @ jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog 2016-04-07 07:45 [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 2016-04-07 10:14 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> @ 2016-04-07 10:22 ` Surinder Kumar <[email protected]> 1 sibling, 0 replies; 5+ messages in thread From: Surinder Kumar @ 2016-04-07 10:22 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers It seems you forgot to attach screenshot. Please send. On Thu, Apr 7, 2016 at 3:44 PM, Dave Page <[email protected]> wrote: > Hi > > On Thu, Apr 7, 2016 at 8:45 AM, Surinder Kumar > <[email protected]> wrote: > > Hi, > > > > PFA minor patch for PrivilegeRoleModel > > > > Change: Add check to disable PrivilegeRoleModel fields for nodes visible > > under catalog. > > > > Please review the patch. > > I'm unclear what this is supposed to do: > > - Those fields already seem to be disabled under catalog nodes (though > - the Add button on subnode grids is still active, but doesn't do > anything) > > - Shouldn't we just hide privilege info on those nodes directly? Why > break modularity for this? > > - I'm seeing weird effects after applying this patch - see the > attached screenshot. However, that issue remains even after I remove > it again (and restart the server, and hard-reload). It does seem to > fix itself eventually, but I'm not sure what causes that. If I try to > refresh the Functions node, I get: > > jquery.contextMenu.js:309 No items specified to show in > contextMenuhandle.contextmenu @ > jquery.contextMenu.js:309jQuery.event.dispatch @ > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > jquery.contextMenu.js:312 Uncaught Error: No Items > specifiedhandle.contextmenu @ > jquery.contextMenu.js:312jQuery.event.dispatch @ > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog 2016-04-07 07:45 [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 2016-04-07 10:14 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> @ 2016-04-07 10:23 ` Dave Page <[email protected]> 2016-04-11 07:41 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 1 sibling, 1 reply; 5+ messages in thread From: Dave Page @ 2016-04-07 10:23 UTC (permalink / raw) To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers This time, with the screenshot... On Thu, Apr 7, 2016 at 11:14 AM, Dave Page <[email protected]> wrote: > Hi > > On Thu, Apr 7, 2016 at 8:45 AM, Surinder Kumar > <[email protected]> wrote: >> Hi, >> >> PFA minor patch for PrivilegeRoleModel >> >> Change: Add check to disable PrivilegeRoleModel fields for nodes visible >> under catalog. >> >> Please review the patch. > > I'm unclear what this is supposed to do: > > - Those fields already seem to be disabled under catalog nodes (though > - the Add button on subnode grids is still active, but doesn't do > anything) > > - Shouldn't we just hide privilege info on those nodes directly? Why > break modularity for this? > > - I'm seeing weird effects after applying this patch - see the > attached screenshot. However, that issue remains even after I remove > it again (and restart the server, and hard-reload). It does seem to > fix itself eventually, but I'm not sure what causes that. If I try to > refresh the Functions node, I get: > > jquery.contextMenu.js:309 No items specified to show in > contextMenuhandle.contextmenu @ > jquery.contextMenu.js:309jQuery.event.dispatch @ > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > jquery.contextMenu.js:312 Uncaught Error: No Items > specifiedhandle.contextmenu @ > jquery.contextMenu.js:312jQuery.event.dispatch @ > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [image/png] Screen Shot 2016-04-07 at 11.08.04.png (59.4K, 2-Screen%20Shot%202016-04-07%20at%2011.08.04.png) download | view image ^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog 2016-04-07 07:45 [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 2016-04-07 10:14 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> 2016-04-07 10:23 ` Re: [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Dave Page <[email protected]> @ 2016-04-11 07:41 ` Surinder Kumar <[email protected]> 0 siblings, 0 replies; 5+ messages in thread From: Surinder Kumar @ 2016-04-11 07:41 UTC (permalink / raw) To: Dave Page <[email protected]>; +Cc: pgadmin-hackers Hi Dave, Please ignore the above patch because instead of disabling fields, now we are hiding the control. As per my conversation with Ashesh, In some cases we need not to show "Group Tab" if its all fields are set to visible = false. For example: In case of view, "privilege info and security labels" need not to show under catalogs. so Its group tab "Security" should also disappear. Please find attached patch and review it. On Thu, Apr 7, 2016 at 3:53 PM, Dave Page <[email protected]> wrote: > This time, with the screenshot... > > On Thu, Apr 7, 2016 at 11:14 AM, Dave Page <[email protected]> wrote: > > Hi > > > > On Thu, Apr 7, 2016 at 8:45 AM, Surinder Kumar > > <[email protected]> wrote: > >> Hi, > >> > >> PFA minor patch for PrivilegeRoleModel > >> > >> Change: Add check to disable PrivilegeRoleModel fields for nodes visible > >> under catalog. > >> > >> Please review the patch. > > > > I'm unclear what this is supposed to do: > > > > - Those fields already seem to be disabled under catalog nodes (though > > - the Add button on subnode grids is still active, but doesn't do > > anything) > > > > - Shouldn't we just hide privilege info on those nodes directly? Why > > break modularity for this? > Yes instead of disabling privilege info, it is better to hide privilege info. I have attached the patch for it. > > > > - I'm seeing weird effects after applying this patch - see the > > attached screenshot. However, that issue remains even after I remove > > it again (and restart the server, and hard-reload). It does seem to > > fix itself eventually, but I'm not sure what causes that. If I try to > > refresh the Functions node, I get: > > > > jquery.contextMenu.js:309 No items specified to show in > > contextMenuhandle.contextmenu @ > > jquery.contextMenu.js:309jQuery.event.dispatch @ > > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > > jquery.contextMenu.js:312 Uncaught Error: No Items > > specifiedhandle.contextmenu @ > > jquery.contextMenu.js:312jQuery.event.dispatch @ > > jquery-1.11.2.js:4665elemData.handle @ jquery-1.11.2.js:4333 > > > I have applied the same patch but functions node under schema and catalogs are working fine. > > -- > > Dave Page > > Blog: http://pgsnake.blogspot.com > > Twitter: @pgsnake > > > > EnterpriseDB UK: http://www.enterprisedb.com > > The Enterprise PostgreSQL Company > > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Sent via pgadmin-hackers mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers Attachments: [application/octet-stream] hide_group_tab.patch (1.6K, 3-hide_group_tab.patch) download | inline diff: diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index e30a278..263c6a9 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -1606,13 +1606,18 @@ (_.isUndefined(s.min_version) ? true : (server_info.version >= s.min_version)) && (_.isUndefined(s.max_version) ? true : - (server_info.version <= s.max_version)))); + (server_info.version <= s.max_version)))), + visible = true; + + if (s.mode && _.isObject(s.mode)) + visible = (_.indexOf(s.mode, mode) > -1); + if (visible) + visible = evalASFunc(s.visible); + groupInfo[s.id] = { label: s.label || s.id, version_compatible: ver_in_limit, - visible: !s.mode || ( - s && s.mode && _.isObject(s.mode) && - _.indexOf(s.mode, mode) != -1) && evalASFunc(s.visible) || true + visible: visible }; return; } @@ -1706,9 +1711,13 @@ // Create an array from the dictionary with proper required // structure. _.each(groups, function(val, key) { - fields.push(_.extend({ - label: key, fields: val - }, (groupInfo[key] || {version_compatible: true, visible: true}))); + fields.push( + _.extend( + _.defaults( + groupInfo[key] || {label: key}, + {version_compatible: true, visible: true} + ), {fields: val}) + ); }); } ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2016-04-11 07:41 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-04-07 07:45 [pgAdmin4][Patch] - Disable PrivilegeControl for nodes visible under catalog Surinder Kumar <[email protected]> 2016-04-07 10:14 ` Dave Page <[email protected]> 2016-04-07 10:22 ` Surinder Kumar <[email protected]> 2016-04-07 10:23 ` Dave Page <[email protected]> 2016-04-11 07:41 ` Surinder Kumar <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox