Browse Source

fix: allow hmList permission for commenter/viewer role

re #1693

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1697/head
Pranav C 3 years ago
parent
commit
3d9125f971
  1. 20
      packages/nc-gui/plugins/tele.js
  2. 14
      packages/nocodb/package-lock.json
  3. 4
      packages/nocodb/package.json
  4. 15
      packages/nocodb/src/lib/noco/meta/api/index.ts
  5. 1
      packages/nocodb/src/lib/utils/projectAcl.ts

20
packages/nc-gui/plugins/tele.js

@ -23,7 +23,8 @@ export default function({
socket.disconnect()
socket = null
})
} catch { }
} catch {
}
}
app.router.onReady(() => {
@ -32,13 +33,11 @@ export default function({
return
}
socket.emit('page', {
id: store.state.users.user && store.state.users.user.id,
path: to.matched[0].path + (to.query && to.query.type ? `?type=${to.query.type}` : '')
})
})
if (socket) {
socket.emit('page', {
id: store.state.users.user && store.state.users.user.id,
path: route.matched[0].path + (route.query && route.query.type ? `?type=${route.query.type}` : '')
})
}
@ -49,9 +48,8 @@ export default function({
if (socket) {
socket.emit('event', {
event: evt,
id: store.state.users.user && store.state.users.user.id,
...(data || {}),
$current_url: gatPath(app)
path: gatPath(app)
})
}
}
@ -61,14 +59,14 @@ export default function({
function getListener(binding) {
return function(e) {
if (!socket) { return }
const cat = window.location.hash.replace(/\d+\/(?=dashboard)/, '')
if (!socket) {
return
}
const event = binding.value && binding.value[0]
const data = binding.value && binding.value[1]
const extra = binding.value && binding.value.slice(2)
tele.emit(event,
{
cat,
data,
extra
})
@ -87,14 +85,16 @@ export default function({
store.watch(state => state.project.projectInfo && state.project.projectInfo.teleEnabled && state.users.token, (token) => {
if (token) {
init(token).then(() => {})
init(token).then(() => {
})
} else if (socket) {
socket.disconnect()
socket = null
}
})
if (store.state.project.projectInfo && store.state.project.projectInfo.teleEnabled && store.state.users.token) {
init(store.state.users.token).then(() => {})
init(store.state.users.token).then(() => {
})
}
}

14
packages/nocodb/package-lock.json generated

@ -68,7 +68,7 @@
"mysql2": "^2.2.5",
"nanoid": "^3.1.20",
"nc-common": "0.0.6",
"nc-help": "^0.2.31",
"nc-help": "^0.2.44",
"nc-lib-gui": "0.84.15",
"nc-plugin": "^0.1.1",
"ncp": "^2.0.0",
@ -16034,9 +16034,9 @@
}
},
"node_modules/nc-help": {
"version": "0.2.42",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.42.tgz",
"integrity": "sha512-qRQ9ijK3K5HfEp4LUJekk/EerNAa4YgM+jRtNLL1RMv+4IPAMO6NsXvdxNOW6h3robdY+xcWuaNqekXqGn1FXA==",
"version": "0.2.44",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.44.tgz",
"integrity": "sha512-AAcMIh2Nhzm7iFQSaTOu27W4KU5eOAbPrGQLND+VAmdQurXACuHMCN6y7IZR3cPZMM1H7GQ0JmxVYzZ+S49MzQ==",
"dependencies": {
"axios": "^0.21.1",
"boxen": "^4.2.0",
@ -37473,9 +37473,9 @@
"integrity": "sha512-3AryS9uwa5NfISLxMciUonrH7YfXp+nlahB9T7girXIsLQrmwX4MdnuKs32akduCOGpKmjTJSWmATULbuMkbfw=="
},
"nc-help": {
"version": "0.2.42",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.42.tgz",
"integrity": "sha512-qRQ9ijK3K5HfEp4LUJekk/EerNAa4YgM+jRtNLL1RMv+4IPAMO6NsXvdxNOW6h3robdY+xcWuaNqekXqGn1FXA==",
"version": "0.2.44",
"resolved": "https://registry.npmjs.org/nc-help/-/nc-help-0.2.44.tgz",
"integrity": "sha512-AAcMIh2Nhzm7iFQSaTOu27W4KU5eOAbPrGQLND+VAmdQurXACuHMCN6y7IZR3cPZMM1H7GQ0JmxVYzZ+S49MzQ==",
"requires": {
"axios": "^0.21.1",
"boxen": "^4.2.0",

4
packages/nocodb/package.json

@ -67,7 +67,7 @@
"help:c": "ts-node ./help/a",
"watch:build": "nodemon -e ts,js -w ./src -x npm run build",
"watch:serve": "nodemon -e ts -w ./build -x npm run debug-local ",
"watch:run": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/docker --log-error --project tsconfig.json\"",
"watch:run": "cross-env NC_DISABLE_TELE1=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/docker --log-error --project tsconfig.json\"",
"watch:run:cypress": "cross-env EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/example/dockerRunMysql --log-error --project tsconfig.json\"",
"run": "ts-node src/example/docker",
@ -150,7 +150,7 @@
"mysql2": "^2.2.5",
"nanoid": "^3.1.20",
"nc-common": "0.0.6",
"nc-help": "^0.2.31",
"nc-help": "^0.2.44",
"nc-lib-gui": "0.84.15",
"nc-plugin": "^0.1.1",
"ncp": "^2.0.0",

15
packages/nocodb/src/lib/noco/meta/api/index.ts

@ -44,6 +44,8 @@ import { Tele } from 'nc-help';
import { Server } from 'socket.io';
import passport from 'passport';
import crypto from 'crypto';
export default function(router: Router, server) {
initStrategies(router);
projectApis(router);
@ -106,11 +108,20 @@ export default function(router: Router, server) {
}
)(socket.handshake, {}, next);
}).on('connection', socket => {
const id = getHash(Tele.id + (socket?.handshake as any)?.user?.id);
socket.on('page', args => {
Tele.page(args);
Tele.page({ ...args, id });
});
socket.on('event', args => {
Tele.event(args);
Tele.event({ ...args, id });
});
});
}
function getHash(str) {
return crypto
.createHash('md5')
.update(str)
.digest('hex');
}

1
packages/nocodb/src/lib/utils/projectAcl.ts

@ -139,6 +139,7 @@ export default {
columnList: true,
mmList: true,
hmList: true,
commentList: true,
commentRow: true,

Loading…
Cancel
Save