How to remove "SQL query console" menu item from System Designer, while keeping access to SQL Executor?

In the cloud version, is it possible to remove "SQL query console" menu item from System Designer without losing the ability to use SQL Executor? I mean setting Access to “SQL query console” section permission to No won't solve the question, because it will deny access to SQL Executor, while I want just to remove the link from UI, keeping the ability to use the tool in requests.

Like 1

Like

1 comments
Best reply

If you want to remove it completely:

1) Make sure your package has Samarasoft.SqlConsole as a dependency (or add this in Custom package)

2) Create a replacing view model and select parent "SystemDesigner"

3) Add this code:

define("SystemDesigner", [], function() {
	return {
		diff: [
			{
				"operation": "remove",
				"name": "SqlConsoleLink"
			}
		]
	};
});

If you want to only show it for the Supervisor user, do steps 1 & 2 above, but use this code instead:

define("SystemDesigner", [], function() {
	return {
		attributes: {
			"IsSqlConsoleVisible": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN
			}
		},
		methods: {
			init: function() {
				this.callParent(arguments);
				this.set("IsSqlConsoleVisible", 
					Terrasoft.SysValue.CURRENT_USER_CONTACT.displayValue === "Supervisor"
				);
			}
		},
		diff: [
			{
				"operation": "merge",
				"name": "SqlConsoleLink",
				"values": {
					"visible": { "bindTo": "IsSqlConsoleVisible" }
				}
			}
		]
	};
});

Ryan

If you want to remove it completely:

1) Make sure your package has Samarasoft.SqlConsole as a dependency (or add this in Custom package)

2) Create a replacing view model and select parent "SystemDesigner"

3) Add this code:

define("SystemDesigner", [], function() {
	return {
		diff: [
			{
				"operation": "remove",
				"name": "SqlConsoleLink"
			}
		]
	};
});

If you want to only show it for the Supervisor user, do steps 1 & 2 above, but use this code instead:

define("SystemDesigner", [], function() {
	return {
		attributes: {
			"IsSqlConsoleVisible": {
				dataValueType: Terrasoft.DataValueType.BOOLEAN
			}
		},
		methods: {
			init: function() {
				this.callParent(arguments);
				this.set("IsSqlConsoleVisible", 
					Terrasoft.SysValue.CURRENT_USER_CONTACT.displayValue === "Supervisor"
				);
			}
		},
		diff: [
			{
				"operation": "merge",
				"name": "SqlConsoleLink",
				"values": {
					"visible": { "bindTo": "IsSqlConsoleVisible" }
				}
			}
		]
	};
});

Ryan

Show all comments