@grantjs/schema 1.1.7 → 1.3.0
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 +7 -7
- package/src/generated/graphql.ts +1617 -126
- package/src/generated/resolvers.ts +505 -0
- package/src/generated/schema-types.ts +268 -0
- package/src/index.ts +2 -0
- package/src/operations/groups/getGroupsList.graphql +38 -0
- package/src/operations/groups/updateGroup.graphql +6 -0
- package/src/operations/me/me.graphql +4 -0
- package/src/operations/permissions/getPermissionsList.graphql +45 -0
- package/src/operations/permissions/updatePermission.graphql +6 -0
- package/src/operations/resources/updateResource.graphql +6 -0
- package/src/operations/role-permissions/role-permissions.graphql +39 -0
- package/src/operations/roles/getRoles.graphql +12 -0
- package/src/operations/roles/getRolesList.graphql +38 -0
- package/src/operations/roles/updateRole.graphql +6 -0
- package/src/operations/user-permissions/user-permissions.graphql +39 -0
- package/src/operations/users/getUsers.graphql +26 -0
- package/src/operations/users/getUsersList.graphql +43 -0
- package/src/operations/users/updateUser.graphql +6 -0
- package/src/schema/auth/inputs/is-authorized.graphql +7 -0
- package/src/schema/auth/queries/is-authorized.graphql +3 -0
- package/src/schema/groups/types/group-searchable-field.graphql +1 -0
- package/src/schema/groups/types/group.graphql +3 -0
- package/src/schema/permissions/types/permission.graphql +2 -0
- package/src/schema/project-role-permissions/types/project-role-permission.graphql +27 -0
- package/src/schema/project-user-groups/types/project-user-group.graphql +27 -0
- package/src/schema/project-user-permissions/types/project-user-permission.graphql +27 -0
- package/src/schema/projects/inputs/sync-project-cdm.graphql +27 -0
- package/src/schema/role-permissions/inputs/assign-role-permission.graphql +5 -0
- package/src/schema/role-permissions/inputs/query-role-permissions.graphql +4 -0
- package/src/schema/role-permissions/inputs/revoke-role-permission.graphql +6 -0
- package/src/schema/role-permissions/mutations/assign-role-permission.graphql +3 -0
- package/src/schema/role-permissions/mutations/revoke-role-permission.graphql +3 -0
- package/src/schema/role-permissions/types/role-permission.graphql +10 -0
- package/src/schema/roles/inputs/create-role.graphql +1 -0
- package/src/schema/roles/types/role-searchable-field.graphql +1 -0
- package/src/schema/roles/types/role.graphql +5 -0
- package/src/schema/user-groups/inputs/add-user-group.graphql +4 -0
- package/src/schema/user-groups/inputs/query-user-groups.graphql +4 -0
- package/src/schema/user-groups/inputs/remove-user-group.graphql +4 -0
- package/src/schema/user-groups/types/user-group.graphql +10 -0
- package/src/schema/user-permissions/inputs/assign-user-permission.graphql +5 -0
- package/src/schema/user-permissions/inputs/query-user-permissions.graphql +4 -0
- package/src/schema/user-permissions/inputs/revoke-user-permission.graphql +6 -0
- package/src/schema/user-permissions/mutations/assign-user-permission.graphql +3 -0
- package/src/schema/user-permissions/mutations/revoke-user-permission.graphql +3 -0
- package/src/schema/user-permissions/types/user-permission.graphql +10 -0
- package/src/schema/users/inputs/create-user.graphql +2 -0
- package/src/schema/users/inputs/update-user.graphql +1 -0
- package/src/schema/users/types/user.graphql +7 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
mutation AssignRolePermission($input: AssignRolePermissionInput!) {
|
|
2
|
+
assignRolePermission(input: $input) {
|
|
3
|
+
id
|
|
4
|
+
roleId
|
|
5
|
+
permissionId
|
|
6
|
+
createdAt
|
|
7
|
+
updatedAt
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
mutation RevokeRolePermission($input: RevokeRolePermissionInput!) {
|
|
12
|
+
revokeRolePermission(input: $input) {
|
|
13
|
+
id
|
|
14
|
+
roleId
|
|
15
|
+
permissionId
|
|
16
|
+
deletedAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
query GetRoleDirectPermissions($scope: Scope!, $roleId: ID!) {
|
|
21
|
+
roles(scope: $scope, ids: [$roleId], limit: 1) {
|
|
22
|
+
roles {
|
|
23
|
+
id
|
|
24
|
+
permissionCount
|
|
25
|
+
rolePermissions {
|
|
26
|
+
id
|
|
27
|
+
permissionId
|
|
28
|
+
permission(scope: $scope) {
|
|
29
|
+
id
|
|
30
|
+
name
|
|
31
|
+
action
|
|
32
|
+
resource {
|
|
33
|
+
slug
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
query GetRolesList(
|
|
2
|
+
$scope: Scope!
|
|
3
|
+
$page: Int
|
|
4
|
+
$limit: Int
|
|
5
|
+
$sort: RoleSortInput
|
|
6
|
+
$search: String
|
|
7
|
+
$ids: [ID!]
|
|
8
|
+
$tagIds: [ID!]
|
|
9
|
+
) {
|
|
10
|
+
roles(
|
|
11
|
+
scope: $scope
|
|
12
|
+
page: $page
|
|
13
|
+
limit: $limit
|
|
14
|
+
sort: $sort
|
|
15
|
+
search: $search
|
|
16
|
+
ids: $ids
|
|
17
|
+
tagIds: $tagIds
|
|
18
|
+
) {
|
|
19
|
+
roles {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
description
|
|
23
|
+
metadata
|
|
24
|
+
createdAt
|
|
25
|
+
updatedAt
|
|
26
|
+
primaryTag {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
color
|
|
30
|
+
isPrimary
|
|
31
|
+
}
|
|
32
|
+
groupCount
|
|
33
|
+
tagCount
|
|
34
|
+
}
|
|
35
|
+
totalCount
|
|
36
|
+
hasNextPage
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
mutation AssignUserPermission($input: AssignUserPermissionInput!) {
|
|
2
|
+
assignUserPermission(input: $input) {
|
|
3
|
+
id
|
|
4
|
+
userId
|
|
5
|
+
permissionId
|
|
6
|
+
createdAt
|
|
7
|
+
updatedAt
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
mutation RevokeUserPermission($input: RevokeUserPermissionInput!) {
|
|
12
|
+
revokeUserPermission(input: $input) {
|
|
13
|
+
id
|
|
14
|
+
userId
|
|
15
|
+
permissionId
|
|
16
|
+
deletedAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
query GetUserDirectPermissions($scope: Scope!, $userId: ID!) {
|
|
21
|
+
users(scope: $scope, ids: [$userId], limit: 1) {
|
|
22
|
+
users {
|
|
23
|
+
id
|
|
24
|
+
permissionCount
|
|
25
|
+
userPermissions {
|
|
26
|
+
id
|
|
27
|
+
permissionId
|
|
28
|
+
permission(scope: $scope) {
|
|
29
|
+
id
|
|
30
|
+
name
|
|
31
|
+
action
|
|
32
|
+
resource {
|
|
33
|
+
slug
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -33,6 +33,32 @@ query GetUsers(
|
|
|
33
33
|
isPrimary
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
userGroups {
|
|
37
|
+
id
|
|
38
|
+
groupId
|
|
39
|
+
group(scope: $scope) {
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
tags {
|
|
43
|
+
id
|
|
44
|
+
name
|
|
45
|
+
color
|
|
46
|
+
isPrimary
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
userPermissions {
|
|
51
|
+
id
|
|
52
|
+
permissionId
|
|
53
|
+
permission(scope: $scope) {
|
|
54
|
+
id
|
|
55
|
+
name
|
|
56
|
+
action
|
|
57
|
+
resource {
|
|
58
|
+
slug
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
36
62
|
tags {
|
|
37
63
|
id
|
|
38
64
|
name
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
query GetUsersList(
|
|
2
|
+
$scope: Scope!
|
|
3
|
+
$page: Int
|
|
4
|
+
$limit: Int
|
|
5
|
+
$sort: UserSortInput
|
|
6
|
+
$search: String
|
|
7
|
+
$ids: [ID!]
|
|
8
|
+
$tagIds: [ID!]
|
|
9
|
+
) {
|
|
10
|
+
users(
|
|
11
|
+
scope: $scope
|
|
12
|
+
page: $page
|
|
13
|
+
limit: $limit
|
|
14
|
+
sort: $sort
|
|
15
|
+
search: $search
|
|
16
|
+
ids: $ids
|
|
17
|
+
tagIds: $tagIds
|
|
18
|
+
) {
|
|
19
|
+
users {
|
|
20
|
+
id
|
|
21
|
+
name
|
|
22
|
+
pictureUrl
|
|
23
|
+
metadata
|
|
24
|
+
createdAt
|
|
25
|
+
updatedAt
|
|
26
|
+
primaryTag {
|
|
27
|
+
id
|
|
28
|
+
name
|
|
29
|
+
color
|
|
30
|
+
isPrimary
|
|
31
|
+
}
|
|
32
|
+
roleCount
|
|
33
|
+
projectUserApiKeyCount
|
|
34
|
+
tagCount
|
|
35
|
+
authenticationMethods {
|
|
36
|
+
provider
|
|
37
|
+
providerId
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
totalCount
|
|
41
|
+
hasNextPage
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Check whether the authenticated principal may perform an action on a resource.
|
|
3
|
+
|
|
4
|
+
Unions Role → Group → Permission, User → Group → Permission, Role → Permission,
|
|
5
|
+
and User → Permission before matching the requested resource and action.
|
|
6
|
+
Conditional permissions are evaluated against role/group/user execution context.
|
|
7
|
+
"""
|
|
1
8
|
input IsAuthorizedInput {
|
|
2
9
|
permission: IsAuthorizedPermissionInput!
|
|
3
10
|
context: IsAuthorizedContextInput!
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ProjectRolePermission implements Auditable {
|
|
2
|
+
id: ID!
|
|
3
|
+
projectId: ID!
|
|
4
|
+
roleId: ID!
|
|
5
|
+
permissionId: ID!
|
|
6
|
+
createdAt: Date!
|
|
7
|
+
updatedAt: Date!
|
|
8
|
+
deletedAt: Date
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
input AddProjectRolePermissionInput {
|
|
12
|
+
projectId: ID!
|
|
13
|
+
roleId: ID!
|
|
14
|
+
permissionId: ID!
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input RemoveProjectRolePermissionInput {
|
|
18
|
+
projectId: ID!
|
|
19
|
+
roleId: ID!
|
|
20
|
+
permissionId: ID!
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input QueryProjectRolePermissionsInput {
|
|
24
|
+
projectId: ID
|
|
25
|
+
roleId: ID
|
|
26
|
+
permissionId: ID
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ProjectUserGroup implements Auditable {
|
|
2
|
+
id: ID!
|
|
3
|
+
projectId: ID!
|
|
4
|
+
userId: ID!
|
|
5
|
+
groupId: ID!
|
|
6
|
+
createdAt: Date!
|
|
7
|
+
updatedAt: Date!
|
|
8
|
+
deletedAt: Date
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
input AddProjectUserGroupInput {
|
|
12
|
+
projectId: ID!
|
|
13
|
+
userId: ID!
|
|
14
|
+
groupId: ID!
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input RemoveProjectUserGroupInput {
|
|
18
|
+
projectId: ID!
|
|
19
|
+
userId: ID!
|
|
20
|
+
groupId: ID!
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input QueryProjectUserGroupsInput {
|
|
24
|
+
projectId: ID
|
|
25
|
+
userId: ID
|
|
26
|
+
groupId: ID
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type ProjectUserPermission implements Auditable {
|
|
2
|
+
id: ID!
|
|
3
|
+
projectId: ID!
|
|
4
|
+
userId: ID!
|
|
5
|
+
permissionId: ID!
|
|
6
|
+
createdAt: Date!
|
|
7
|
+
updatedAt: Date!
|
|
8
|
+
deletedAt: Date
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
input AddProjectUserPermissionInput {
|
|
12
|
+
projectId: ID!
|
|
13
|
+
userId: ID!
|
|
14
|
+
permissionId: ID!
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
input RemoveProjectUserPermissionInput {
|
|
18
|
+
projectId: ID!
|
|
19
|
+
userId: ID!
|
|
20
|
+
permissionId: ID!
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
input QueryProjectUserPermissionsInput {
|
|
24
|
+
projectId: ID
|
|
25
|
+
userId: ID
|
|
26
|
+
permissionId: ID
|
|
27
|
+
}
|
|
@@ -79,6 +79,11 @@ input GroupCdmInput {
|
|
|
79
79
|
permissions: [String!]
|
|
80
80
|
tags: [String!]
|
|
81
81
|
primaryTag: String
|
|
82
|
+
"""
|
|
83
|
+
Denormalized search tokens for list views (email, legacy ids, etc.).
|
|
84
|
+
Also persisted under metadata.cdmSource.searchable on import.
|
|
85
|
+
"""
|
|
86
|
+
searchable: JSON
|
|
82
87
|
metadata: JSON
|
|
83
88
|
}
|
|
84
89
|
|
|
@@ -86,10 +91,19 @@ input RoleCdmInput {
|
|
|
86
91
|
key: String!
|
|
87
92
|
name: String!
|
|
88
93
|
description: String
|
|
94
|
+
"""
|
|
95
|
+
Group keys from the `groups` section. When set, permissions are linked via
|
|
96
|
+
Role → Group → Permission. Omit to use direct `permissions` on the role.
|
|
97
|
+
"""
|
|
89
98
|
groups: [String!]
|
|
99
|
+
"""
|
|
100
|
+
Permission document keys or catalog refs (`resourceSlug:action`). Used for
|
|
101
|
+
direct Role → Permission when `groups` is empty.
|
|
102
|
+
"""
|
|
90
103
|
permissions: [String!]
|
|
91
104
|
tags: [String!]
|
|
92
105
|
primaryTag: String
|
|
106
|
+
searchable: JSON
|
|
93
107
|
metadata: JSON
|
|
94
108
|
}
|
|
95
109
|
|
|
@@ -106,12 +120,25 @@ input UserApiKeyCdmInput {
|
|
|
106
120
|
input UserCdmInput {
|
|
107
121
|
key: CdmKeyResolverInput!
|
|
108
122
|
name: String!
|
|
123
|
+
"""
|
|
124
|
+
Role template keys from the `roles` section.
|
|
125
|
+
"""
|
|
109
126
|
roles: [String!]
|
|
127
|
+
"""
|
|
128
|
+
Direct group assignment. Each key must appear in the document `groups` section.
|
|
129
|
+
"""
|
|
110
130
|
groups: [String!]
|
|
131
|
+
"""
|
|
132
|
+
Direct user → permission grants (document keys or catalog `resourceSlug:action` refs).
|
|
133
|
+
"""
|
|
111
134
|
permissions: [String!]
|
|
112
135
|
tags: [String!]
|
|
113
136
|
primaryTag: String
|
|
114
137
|
apiKeys: [UserApiKeyCdmInput!]
|
|
138
|
+
"""
|
|
139
|
+
Denormalized search tokens for project-scoped user list views.
|
|
140
|
+
"""
|
|
141
|
+
searchable: JSON
|
|
115
142
|
metadata: JSON
|
|
116
143
|
}
|
|
117
144
|
|
|
@@ -4,7 +4,12 @@ type Role implements Auditable {
|
|
|
4
4
|
description: String
|
|
5
5
|
metadata: JSON!
|
|
6
6
|
groups: [Group!]
|
|
7
|
+
rolePermissions: [RolePermission!]
|
|
7
8
|
tags: [Tag!]
|
|
9
|
+
primaryTag: Tag
|
|
10
|
+
groupCount: Int!
|
|
11
|
+
permissionCount: Int!
|
|
12
|
+
tagCount: Int!
|
|
8
13
|
createdAt: Date!
|
|
9
14
|
updatedAt: Date!
|
|
10
15
|
deletedAt: Date
|
|
@@ -4,7 +4,14 @@ type User implements Auditable {
|
|
|
4
4
|
pictureUrl: String
|
|
5
5
|
metadata: JSON!
|
|
6
6
|
roles: [Role!]
|
|
7
|
+
userGroups: [UserGroup!]
|
|
8
|
+
userPermissions: [UserPermission!]
|
|
7
9
|
tags: [Tag!]
|
|
10
|
+
primaryTag: Tag
|
|
11
|
+
roleCount: Int!
|
|
12
|
+
permissionCount: Int!
|
|
13
|
+
projectUserApiKeyCount: Int!
|
|
14
|
+
tagCount: Int!
|
|
8
15
|
authenticationMethods: [UserAuthenticationMethod!]
|
|
9
16
|
accounts: [Account!]
|
|
10
17
|
createdAt: Date!
|