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