Skip to content

Commit 1ec06ed

Browse files
feat: add notebooks and annotations to list of permissions for OSS (#3019)
* feat: add notebooks and annotations resource types to OSS permissions for token generation * chore: update tests for permissions
1 parent ac1bae8 commit 1ec06ed

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"cy": "CYPRESS_dexUrl=https://$INGRESS_HOST:$PORT_HTTPS CYPRESS_baseUrl=http://localhost:9999 cypress open",
5353
"cy:dev": "source ../monitor-ci/.env && CYPRESS_dexUrl=CLOUD CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{cloud,shared}/**/*.*'",
5454
"cy:dev-oss": "source ../monitor-ci/.env && CYPRESS_dexUrl=OSS CYPRESS_baseUrl=https://$INGRESS_HOST:$PORT_HTTPS cypress open --config testFiles='{oss,shared}/**/*.*'",
55-
"generate": "export SHA=653a3ddf1991968b898bc1cc3e5e329833cac01a && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
55+
"generate": "export SHA=ecdcd4b1baace6942e567771518ba19caf381652 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5656
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5757
"generate-meta": "if [ -z \"${CLOUD_URL}\" ]; then yarn generate-meta-oss; else yarn generate-meta-cloud; fi",
5858
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn cloudPriv",

src/authorizations/utils/permissions.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ import {generateDescription} from 'src/authorizations/utils/permissions'
44

55
// TODO remove all of this when we move to server side authority
66
const ossHvhs = [
7+
{
8+
action: 'read',
9+
resource: {
10+
orgID: 'bulldogs',
11+
type: 'annotations',
12+
},
13+
},
14+
{
15+
action: 'write',
16+
resource: {
17+
orgID: 'bulldogs',
18+
type: 'annotations',
19+
},
20+
},
721
{
822
action: 'read',
923
resource: {
@@ -102,6 +116,20 @@ const ossHvhs = [
102116
type: 'labels',
103117
},
104118
},
119+
{
120+
action: 'read',
121+
resource: {
122+
orgID: 'bulldogs',
123+
type: 'notebooks',
124+
},
125+
},
126+
{
127+
action: 'write',
128+
resource: {
129+
orgID: 'bulldogs',
130+
type: 'notebooks',
131+
},
132+
},
105133
{
106134
action: 'read',
107135
resource: {

src/authorizations/utils/permissions.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {capitalize} from 'lodash'
55
type PermissionTypes = Permission['resource']['type']
66

77
const sharedPermissionTypes: PermissionTypes[] = [
8+
'annotations',
89
'authorizations',
910
'buckets',
1011
'checks',
@@ -23,9 +24,9 @@ const sharedPermissionTypes: PermissionTypes[] = [
2324
'views',
2425
]
2526

26-
const cloudPermissionTypes = ['annotations', 'flows', 'functions']
27+
const cloudPermissionTypes = ['flows', 'functions']
2728

28-
const ossPermissionTypes = ['scrapers', 'sources']
29+
const ossPermissionTypes = ['notebooks', 'scrapers', 'sources']
2930

3031
// TODO: replace this with some server side mechanism
3132
const allPermissionTypes: PermissionTypes[] = sharedPermissionTypes.concat(

0 commit comments

Comments
 (0)