@contember/engine-tenant-api 1.4.0-rc.5 → 1.4.0-rc.7

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": "@contember/engine-tenant-api",
3
- "version": "1.4.0-rc.5",
3
+ "version": "1.4.0-rc.7",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/src/index.js",
6
6
  "typings": "dist/src/index.d.ts",
@@ -13,16 +13,16 @@
13
13
  "test": "vitest --dir ./tests/cases --no-threads"
14
14
  },
15
15
  "dependencies": {
16
- "@contember/authorization": "1.4.0-rc.5",
17
- "@contember/config-loader": "1.4.0-rc.5",
18
- "@contember/database": "1.4.0-rc.5",
19
- "@contember/database-migrations": "1.4.0-rc.5",
20
- "@contember/dic": "1.4.0-rc.5",
21
- "@contember/graphql-utils": "1.4.0-rc.5",
22
- "@contember/logger": "1.4.0-rc.5",
23
- "@contember/schema": "1.4.0-rc.5",
24
- "@contember/schema-utils": "1.4.0-rc.5",
25
- "@contember/typesafe": "1.4.0-rc.5",
16
+ "@contember/authorization": "1.4.0-rc.7",
17
+ "@contember/config-loader": "1.4.0-rc.7",
18
+ "@contember/database": "1.4.0-rc.7",
19
+ "@contember/database-migrations": "1.4.0-rc.7",
20
+ "@contember/dic": "1.4.0-rc.7",
21
+ "@contember/graphql-utils": "1.4.0-rc.7",
22
+ "@contember/logger": "1.4.0-rc.7",
23
+ "@contember/schema": "1.4.0-rc.7",
24
+ "@contember/schema-utils": "1.4.0-rc.7",
25
+ "@contember/typesafe": "1.4.0-rc.7",
26
26
  "@graphql-tools/utils": "^10.0.8",
27
27
  "graphql-tag": "^2.12.6",
28
28
  "jose": "^5.1.1",
@@ -32,7 +32,7 @@
32
32
  "otpauth": "^9.1.5"
33
33
  },
34
34
  "devDependencies": {
35
- "@contember/database-tester": "1.4.0-rc.5",
35
+ "@contember/database-tester": "1.4.0-rc.7",
36
36
  "@graphql-codegen/cli": "^5.0.0",
37
37
  "@graphql-codegen/typescript": "^4.0.1",
38
38
  "@graphql-codegen/typescript-operations": "^4.0.1",
@@ -24,9 +24,9 @@ namespace PermissionActions {
24
24
  export const PERSON_SIGN_UP = (roles?: readonly string[]) => Authorizator.createAction(Resources.person, 'signUp', { roles })
25
25
  export const PERSON_SIGN_OUT = Authorizator.createAction(Resources.person, 'signOut')
26
26
  export const PERSON_SETUP_OTP = Authorizator.createAction(Resources.person, 'setupOtp')
27
- export const PERSON_CHANGE_PROFILE = Authorizator.createAction(Resources.person, 'changeProfile')
27
+ export const PERSON_CHANGE_PROFILE = (roles?: readonly string[]) => Authorizator.createAction(Resources.person, 'changeProfile', { roles })
28
28
  export const PERSON_CHANGE_MY_PROFILE = Authorizator.createAction(Resources.person, 'changeMyProfile')
29
- export const PERSON_CHANGE_PASSWORD = Authorizator.createAction(Resources.person, 'changePassword')
29
+ export const PERSON_CHANGE_PASSWORD = (roles?: readonly string[]) => Authorizator.createAction(Resources.person, 'changePassword', { roles })
30
30
  export const PERSON_CHANGE_MY_PASSWORD = Authorizator.createAction(Resources.person, 'changeMyPassword')
31
31
  export const PERSON_RESET_PASSWORD = Authorizator.createAction(Resources.person, 'resetPassword')
32
32
  export const PERSON_CREATE_IDP_URL = Authorizator.createAction(Resources.person, 'createIdPUrl')
@@ -43,6 +43,8 @@ class PermissionsFactory {
43
43
  permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.IDENTITY_REMOVE_GLOBAL_ROLES(), projectAdminAllowedInputRoles)
44
44
  permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PERSON_CREATE_SESSION_KEY(), projectAdminUseRolesVerifier)
45
45
  permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PERSON_DISABLE(), projectAdminUseRolesVerifier)
46
+ permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PERSON_CHANGE_PROFILE(), projectAdminUseRolesVerifier)
47
+ permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PERSON_CHANGE_PASSWORD(), projectAdminUseRolesVerifier)
46
48
 
47
49
  permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PROJECT_VIEW_MEMBER([]))
48
50
  permissions.allow(TenantRole.PROJECT_ADMIN, PermissionActions.PROJECT_ADD_MEMBER([]))
@@ -30,7 +30,7 @@ export class ChangePasswordMutationResolver implements MutationResolvers {
30
30
 
31
31
  await context.requireAccess({
32
32
  scope: new IdentityScope(person.identity_id),
33
- action: PermissionActions.PERSON_CHANGE_PASSWORD,
33
+ action: PermissionActions.PERSON_CHANGE_PASSWORD(person.roles),
34
34
  message: 'You are not allowed to change password',
35
35
  })
36
36
  const result = await this.passwordChangeManager.changePassword(context.db, args.personId, args.password)
@@ -31,7 +31,7 @@ export class ChangeProfileMutationResolver implements Pick<MutationResolvers, 'c
31
31
 
32
32
  await context.requireAccess({
33
33
  scope: new IdentityScope(person.identity_id),
34
- action: PermissionActions.PERSON_CHANGE_PROFILE,
34
+ action: PermissionActions.PERSON_CHANGE_PROFILE(person.roles),
35
35
  message: 'You are not allowed to change a profile',
36
36
  })
37
37
  const result = await this.personManager.changeProfile(context.db, person, {