mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-25 17:46:00 +00:00
connections per role
This commit is contained in:
@@ -71,6 +71,7 @@ module.exports = {
|
|||||||
{
|
{
|
||||||
login: 'superadmin',
|
login: 'superadmin',
|
||||||
permissions: await storage.loadSuperadminPermissions(),
|
permissions: await storage.loadSuperadminPermissions(),
|
||||||
|
roleId: -3,
|
||||||
},
|
},
|
||||||
getTokenSecret(),
|
getTokenSecret(),
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ module.exports = {
|
|||||||
async list(_params, req) {
|
async list(_params, req) {
|
||||||
const storage = require('./storage');
|
const storage = require('./storage');
|
||||||
|
|
||||||
const storageConnections = await storage.connections();
|
const storageConnections = await storage.connections(req);
|
||||||
if (storageConnections) {
|
if (storageConnections) {
|
||||||
return storageConnections;
|
return storageConnections;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
connections_meta: true,
|
connections_meta: true,
|
||||||
async connections() {
|
async connections(req) {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -101,11 +101,11 @@ export function testSubPermission(
|
|||||||
export function getPredefinedPermissions(predefinedRoleName: string) {
|
export function getPredefinedPermissions(predefinedRoleName: string) {
|
||||||
switch (predefinedRoleName) {
|
switch (predefinedRoleName) {
|
||||||
case 'superadmin':
|
case 'superadmin':
|
||||||
return ['*', '~widgets/*', 'widgets/admin'];
|
return ['*', '~widgets/*', 'widgets/admin', '~all-connections'];
|
||||||
case 'logged-user':
|
case 'logged-user':
|
||||||
return ['*', '~widgets/admin', '~admin/*'];
|
return ['*', '~widgets/admin', '~admin/*', '~internal-storage', '~all-connections'];
|
||||||
case 'anonymous-user':
|
case 'anonymous-user':
|
||||||
return ['*', '~widgets/admin', '~admin/*'];
|
return ['*', '~widgets/admin', '~admin/*', '~internal-storage', '~all-connections'];
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ registerCommand({
|
|||||||
category: 'New',
|
category: 'New',
|
||||||
toolbarOrder: 1,
|
toolbarOrder: 1,
|
||||||
name: 'Connection',
|
name: 'Connection',
|
||||||
testEnabled: () => !getCurrentConfig()?.runAsPortal,
|
testEnabled: () => !getCurrentConfig()?.runAsPortal && !getCurrentConfig()?.storageDatabase,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
openNewTab({
|
openNewTab({
|
||||||
title: 'New Connection',
|
title: 'New Connection',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import _ from 'lodash';
|
|||||||
import { openedConnections, currentDatabase, openedConnectionsWithTemporary, getCurrentConfig } from '../stores';
|
import { openedConnections, currentDatabase, openedConnectionsWithTemporary, getCurrentConfig } from '../stores';
|
||||||
import { apiCall, strmid } from './api';
|
import { apiCall, strmid } from './api';
|
||||||
import { getConnectionList } from './metadataLoaders';
|
import { getConnectionList } from './metadataLoaders';
|
||||||
|
import hasPermission from '../utility/hasPermission';
|
||||||
|
|
||||||
// const doServerPing = async value => {
|
// const doServerPing = async value => {
|
||||||
// const connectionList = getConnectionList();
|
// const connectionList = getConnectionList();
|
||||||
@@ -11,7 +12,8 @@ import { getConnectionList } from './metadataLoaders';
|
|||||||
|
|
||||||
const doServerPing = value => {
|
const doServerPing = value => {
|
||||||
apiCall('server-connections/ping', {
|
apiCall('server-connections/ping', {
|
||||||
conidArray: getCurrentConfig().storageDatabase ? ['__storage', ...value] : value,
|
conidArray:
|
||||||
|
getCurrentConfig().storageDatabase && hasPermission('internal-storage') ? ['__storage', ...value] : value,
|
||||||
strmid,
|
strmid,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user