@things-factory/operato-board 6.0.49 → 6.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/operato-board",
3
- "version": "6.0.49",
3
+ "version": "6.0.53",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -79,39 +79,39 @@
79
79
  "@operato/styles": "^1.0.0",
80
80
  "@operato/utils": "^1.0.1",
81
81
  "@things-factory/apptool-ui": "^6.0.49",
82
- "@things-factory/auth-ui": "^6.0.49",
83
- "@things-factory/board-service": "^6.0.49",
82
+ "@things-factory/auth-ui": "^6.0.53",
83
+ "@things-factory/board-service": "^6.0.53",
84
84
  "@things-factory/board-ui": "^6.0.49",
85
85
  "@things-factory/context-ui": "^6.0.49",
86
86
  "@things-factory/export-ui": "^6.0.49",
87
- "@things-factory/fav-base": "^6.0.49",
88
- "@things-factory/font-base": "^6.0.49",
87
+ "@things-factory/fav-base": "^6.0.53",
88
+ "@things-factory/font-base": "^6.0.53",
89
89
  "@things-factory/form-ui": "^6.0.49",
90
90
  "@things-factory/help": "^6.0.49",
91
91
  "@things-factory/i18n-base": "^6.0.49",
92
92
  "@things-factory/import-ui": "^6.0.49",
93
- "@things-factory/integration-base": "^6.0.49",
94
- "@things-factory/integration-msgraph": "^6.0.49",
95
- "@things-factory/integration-notification": "^6.0.49",
96
- "@things-factory/integration-openai": "^6.0.49",
97
- "@things-factory/integration-ui": "^6.0.49",
93
+ "@things-factory/integration-base": "^6.0.53",
94
+ "@things-factory/integration-msgraph": "^6.0.53",
95
+ "@things-factory/integration-notification": "^6.0.53",
96
+ "@things-factory/integration-openai": "^6.0.53",
97
+ "@things-factory/integration-ui": "^6.0.53",
98
98
  "@things-factory/layout-ui": "^6.0.49",
99
99
  "@things-factory/more-ui": "^6.0.49",
100
- "@things-factory/notification": "^6.0.49",
101
- "@things-factory/oauth2-client": "^6.0.49",
100
+ "@things-factory/notification": "^6.0.53",
101
+ "@things-factory/oauth2-client": "^6.0.53",
102
102
  "@things-factory/offline-ui": "^6.0.49",
103
103
  "@things-factory/operato-license-checker": "^3.1.0",
104
104
  "@things-factory/pdf": "^6.0.49",
105
105
  "@things-factory/print-service": "^6.0.49",
106
106
  "@things-factory/print-ui": "^6.0.49",
107
- "@things-factory/resource-ui": "^6.0.49",
107
+ "@things-factory/resource-ui": "^6.0.53",
108
108
  "@things-factory/scene-google-map": "^6.0.49",
109
- "@things-factory/setting-ui": "^6.0.49",
109
+ "@things-factory/setting-ui": "^6.0.53",
110
110
  "@things-factory/system-ui": "^6.0.49"
111
111
  },
112
112
  "devDependencies": {
113
- "@things-factory/board-test": "^6.0.49",
113
+ "@things-factory/board-test": "^6.0.53",
114
114
  "@things-factory/builder": "^6.0.49"
115
115
  },
116
- "gitHead": "e107d6f692d008add950e000d2653bcbbd711a24"
116
+ "gitHead": "1b60f52b7e043286423881b8fb41f1fa08f9ba6d"
117
117
  }
package/schema.gql CHANGED
@@ -1362,6 +1362,9 @@ type Mutation {
1362
1362
 
1363
1363
  """To start new scenario instance"""
1364
1364
  stopScenario(instanceName: String): ScenarioInstance
1365
+
1366
+ """To synchronize privilege master from API schema."""
1367
+ synchronizePrivilegeMaster(privilege: NewPrivilege!): Boolean!
1365
1368
  terminateContract(partnerName: String!): Boolean!
1366
1369
 
1367
1370
  """To transfer owner of domain"""
@@ -2196,6 +2199,9 @@ type Query {
2196
2199
 
2197
2200
  """To fetch multiple Groups"""
2198
2201
  groups(filters: [Filter!], pagination: Pagination, sortings: [Sorting!]): GroupList!
2202
+
2203
+ """To query whether I have the given permission"""
2204
+ hasPrivilege(category: String!, name: String!): Boolean!
2199
2205
  invitation(email: String!, reference: String!, type: String!): Invitation!
2200
2206
  invitations(reference: String!, type: String!): InvitationList!
2201
2207
 
package/server/index.ts CHANGED
@@ -8,12 +8,13 @@ export * from './service'
8
8
  import './routes'
9
9
 
10
10
  process.on('bootstrap-module-start' as any, async ({ app, config, client }: any) => {
11
- console.log('%%%%%%%%%%%%%%%% SCENARIO ENGINE - BEGIN %%%%%%%%%%%%%%%%')
12
11
  try {
13
12
  await ConnectionManager.ready()
14
13
  await ScenarioEngine.loadAll()
14
+
15
+ console.log('[operato-board:bootstrap] Scenario Engine has just started.')
15
16
  } catch (ex) {
16
17
  ConnectionManager.logger.error(ex)
18
+ console.log('[operato-board:bootstrap] Just has failed to start Scenario Engine.')
17
19
  }
18
- console.log('%%%%%%%%%%%%%%%% SCENARIO ENGINE - END %%%%%%%%%%%%%%%%')
19
20
  })
@@ -1,4 +1,4 @@
1
- import { Arg, Ctx, Query, Resolver } from 'type-graphql'
1
+ import { Arg, Ctx, Directive, Query, Resolver } from 'type-graphql'
2
2
 
3
3
  import { Board } from '@things-factory/board-service'
4
4
  import { checkTarget, doSomething, getPermission } from '@things-factory/operato-license-checker'
@@ -7,16 +7,34 @@ import { getRepository } from '@things-factory/shell'
7
7
  import { LicenseError } from '../../errors/license-error'
8
8
  import { DomainSecret } from '../domain-secret/domain-secret'
9
9
  import { BoardSecret } from './board-secret'
10
+ import { User } from '@things-factory/auth-base'
10
11
 
11
12
  const crypto = require('crypto')
12
13
 
13
14
  @Resolver(Board)
14
15
  export class BoardResolver {
15
16
  @Query(returns => [String], { description: 'Board Usage Permissions' })
16
- boardPermissions(@Ctx() context: ResolverContext): string[] {
17
- return (getPermission('Permissions For Board Usage') || 'Modeller, Viewer').split(',').map(p => p.trim())
17
+ async boardPermissions(@Ctx() context: ResolverContext): Promise<string[]> {
18
+ const { user, domain } = context.state
19
+
20
+ const licensedPermissions = (getPermission('Permissions For Board Usage') || 'Modeller, Viewer')
21
+ .split(',')
22
+ .map(p => p.trim())
23
+
24
+ var permissions = []
25
+
26
+ licensedPermissions.includes('Modeller') &&
27
+ (await User.hasPrivilege('mutation', 'board', domain, user)) &&
28
+ permissions.push('Modeller')
29
+
30
+ licensedPermissions.includes('Viewer') &&
31
+ (await User.hasPrivilege('query', 'board', domain, user)) &&
32
+ permissions.push('Viewer')
33
+
34
+ return permissions
18
35
  }
19
36
 
37
+ @Directive('@privilege(category: "board", privilege: "query")')
20
38
  @Query(returns => Board, { description: 'To fetch a board' })
21
39
  async board(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Board> {
22
40
  const { domain } = context.state