@astrale-domains/shell 0.1.0-beta.23 → 0.1.0-beta.24
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/CHANGELOG.md +12 -0
- package/README.md +83 -79
- package/dist/application.d.ts +6 -5
- package/dist/application.js +20 -51
- package/dist/functions/group/assign-user-to-group.d.ts +27 -0
- package/dist/functions/group/assign-user-to-group.js +4 -0
- package/dist/functions/group/change-user-group-membership.d.ts +7 -0
- package/dist/functions/group/change-user-group-membership.js +34 -0
- package/dist/functions/group/group-membership-errors.d.ts +28 -0
- package/dist/functions/group/group-membership-errors.js +23 -0
- package/dist/functions/group/index.d.ts +2 -3
- package/dist/functions/group/index.js +2 -3
- package/dist/functions/group/unassign-user-from-group.d.ts +27 -0
- package/dist/functions/group/unassign-user-from-group.js +4 -0
- package/dist/functions/user/index.d.ts +1 -3
- package/dist/functions/user/index.js +1 -3
- package/dist/functions/user/invite-user.d.ts +30 -0
- package/dist/functions/user/invite-user.js +39 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/index.d.ts +1 -0
- package/dist/integrations/index.js +1 -0
- package/dist/integrations/integrations.d.ts +9 -0
- package/dist/integrations/integrations.js +2 -0
- package/dist/integrations/user-invitation/index.d.ts +4 -0
- package/dist/integrations/user-invitation/index.js +3 -0
- package/dist/integrations/user-invitation/invitation-request-failure.d.ts +5 -0
- package/dist/integrations/user-invitation/invitation-request-failure.js +9 -0
- package/dist/integrations/user-invitation/invite-user-request.d.ts +6 -0
- package/dist/integrations/user-invitation/invite-user-request.js +1 -0
- package/dist/integrations/user-invitation/request-user-invitation.d.ts +8 -0
- package/dist/integrations/user-invitation/request-user-invitation.js +9 -0
- package/dist/mutations/group/index.d.ts +1 -1
- package/dist/mutations/group/index.js +1 -1
- package/dist/mutations/group/set-user-group-membership.d.ts +26 -0
- package/dist/mutations/group/set-user-group-membership.js +29 -0
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.d.ts +7 -0
- package/dist/providers/admin-enrollment/create-admin-enrollment-provider.js +78 -0
- package/dist/providers/admin-enrollment/decode-admin-invitation-response.d.ts +7 -0
- package/dist/providers/admin-enrollment/decode-admin-invitation-response.js +20 -0
- package/dist/providers/admin-enrollment/index.d.ts +1 -0
- package/dist/providers/admin-enrollment/index.js +1 -0
- package/dist/providers/admin-enrollment/read-enrollment-response.d.ts +1 -0
- package/dist/providers/admin-enrollment/read-enrollment-response.js +34 -0
- package/dist/queries/group/index.d.ts +2 -0
- package/dist/queries/group/index.js +2 -0
- package/dist/queries/group/read-group-membership-endpoints.d.ts +13 -0
- package/dist/queries/group/read-group-membership-endpoints.js +18 -0
- package/dist/queries/group/read-user-group-membership.d.ts +15 -0
- package/dist/queries/group/read-user-group-membership.js +35 -0
- package/dist/runtime.d.ts +94 -9
- package/dist/runtime.js +9 -5
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +3 -4
- package/dist/schema/modules/group/classes/group.d.ts +4 -6
- package/dist/schema/modules/group/classes/group.js +4 -6
- package/dist/schema/modules/group/classes/index.d.ts +2 -0
- package/dist/schema/modules/group/classes/index.js +2 -0
- package/dist/schema/modules/group/classes/member-of-group.js +2 -3
- package/dist/schema/modules/group/core/administrators-group.js +6 -0
- package/dist/schema/modules/group/core/index.d.ts +2 -0
- package/dist/schema/modules/group/core/index.js +2 -0
- package/dist/schema/modules/group/core/members-group.js +6 -0
- package/dist/schema/modules/group/functions/assign-user-to-group.d.ts +7 -0
- package/dist/schema/modules/group/functions/assign-user-to-group.js +11 -0
- package/dist/schema/modules/group/functions/index.d.ts +2 -0
- package/dist/schema/modules/group/functions/index.js +2 -0
- package/dist/schema/modules/group/functions/unassign-user-from-group.d.ts +7 -0
- package/dist/schema/modules/group/functions/unassign-user-from-group.js +11 -0
- package/dist/schema/modules/group/index.d.ts +3 -9
- package/dist/schema/modules/group/index.js +3 -9
- package/dist/schema/modules/group/policies/belongs-to-group.d.ts +1 -0
- package/dist/schema/modules/group/policies/belongs-to-group.js +5 -0
- package/dist/schema/modules/group/policies/index.d.ts +1 -0
- package/dist/schema/modules/group/policies/index.js +1 -0
- package/dist/schema/modules/group/types/group-user-reference.d.ts +6 -0
- package/dist/schema/modules/group/types/group-user-reference.js +8 -0
- package/dist/schema/modules/group/types/index.d.ts +1 -0
- package/dist/schema/modules/group/types/index.js +1 -0
- package/dist/schema/modules/user/classes/index.d.ts +1 -0
- package/dist/schema/modules/user/classes/index.js +1 -0
- package/dist/schema/modules/user/classes/user.d.ts +5 -8
- package/dist/schema/modules/user/classes/user.js +7 -7
- package/dist/schema/modules/user/functions/index.d.ts +1 -0
- package/dist/schema/modules/user/functions/index.js +1 -0
- package/dist/schema/modules/user/functions/invite-user.d.ts +11 -0
- package/dist/schema/modules/user/functions/invite-user.js +12 -0
- package/dist/schema/modules/user/index.d.ts +2 -6
- package/dist/schema/modules/user/index.js +2 -6
- package/dist/schema/modules/user/types/index.d.ts +1 -0
- package/dist/schema/modules/user/types/index.js +1 -0
- package/dist/schema/modules/user/types/invitation-summary.d.ts +16 -0
- package/dist/schema/modules/user/types/invitation-summary.js +15 -0
- package/dist/schema/policies/administers-shell-class.d.ts +2 -0
- package/dist/schema/policies/administers-shell-class.js +11 -0
- package/dist/schema/policies/index.d.ts +2 -0
- package/dist/schema/policies/index.js +2 -0
- package/dist/schema/policies/owns-class.d.ts +1 -0
- package/dist/schema/policies/owns-class.js +7 -0
- package/dist/schema/schema.d.ts +14 -69
- package/dist/schema/schema.js +10 -27
- package/dist/schema/views/application-view.d.ts +1 -0
- package/dist/schema/views/application-view.js +4 -0
- package/dist/schema/views/index.d.ts +1 -0
- package/dist/schema/views/index.js +1 -0
- package/dist/utils/canonical-node-path/index.d.ts +1 -0
- package/dist/utils/canonical-node-path/index.js +1 -0
- package/dist/utils/canonical-node-path/parse-canonical-node-path.d.ts +2 -0
- package/dist/utils/canonical-node-path/parse-canonical-node-path.js +8 -0
- package/package.json +16 -7
- package/dist/functions/group/assign.d.ts +0 -3
- package/dist/functions/group/assign.js +0 -3
- package/dist/functions/group/change.d.ts +0 -6
- package/dist/functions/group/change.js +0 -41
- package/dist/functions/group/unassign.d.ts +0 -3
- package/dist/functions/group/unassign.js +0 -3
- package/dist/functions/registry/index.d.ts +0 -12
- package/dist/functions/registry/index.js +0 -12
- package/dist/functions/setup/admin.d.ts +0 -3
- package/dist/functions/setup/admin.js +0 -3
- package/dist/functions/setup/index.d.ts +0 -4
- package/dist/functions/setup/index.js +0 -4
- package/dist/functions/setup/member.d.ts +0 -3
- package/dist/functions/setup/member.js +0 -3
- package/dist/functions/setup/provision.d.ts +0 -5
- package/dist/functions/setup/provision.js +0 -70
- package/dist/functions/setup/run.d.ts +0 -7
- package/dist/functions/setup/run.js +0 -82
- package/dist/functions/space/access.d.ts +0 -7
- package/dist/functions/space/access.js +0 -41
- package/dist/functions/space/add.d.ts +0 -3
- package/dist/functions/space/add.js +0 -3
- package/dist/functions/space/default.d.ts +0 -3
- package/dist/functions/space/default.js +0 -37
- package/dist/functions/space/index.d.ts +0 -4
- package/dist/functions/space/index.js +0 -4
- package/dist/functions/space/remove.d.ts +0 -3
- package/dist/functions/space/remove.js +0 -3
- package/dist/functions/user/resolve-home.d.ts +0 -3
- package/dist/functions/user/resolve-home.js +0 -19
- package/dist/mutations/group/membership.d.ts +0 -23
- package/dist/mutations/group/membership.js +0 -32
- package/dist/mutations/space/access.d.ts +0 -25
- package/dist/mutations/space/access.js +0 -23
- package/dist/mutations/space/default.d.ts +0 -19
- package/dist/mutations/space/default.js +0 -23
- package/dist/mutations/space/index.d.ts +0 -2
- package/dist/mutations/space/index.js +0 -2
- package/dist/mutations/user/index.d.ts +0 -1
- package/dist/mutations/user/index.js +0 -1
- package/dist/mutations/user/repair.d.ts +0 -22
- package/dist/mutations/user/repair.js +0 -104
- package/dist/queries/space/access.d.ts +0 -9
- package/dist/queries/space/access.js +0 -12
- package/dist/queries/space/admin.d.ts +0 -9
- package/dist/queries/space/admin.js +0 -20
- package/dist/queries/space/index.d.ts +0 -3
- package/dist/queries/space/index.js +0 -3
- package/dist/queries/space/member.d.ts +0 -9
- package/dist/queries/space/member.js +0 -17
- package/dist/queries/user/groups.d.ts +0 -10
- package/dist/queries/user/groups.js +0 -41
- package/dist/queries/user/home.d.ts +0 -9
- package/dist/queries/user/home.js +0 -21
- package/dist/queries/user/index.d.ts +0 -5
- package/dist/queries/user/index.js +0 -5
- package/dist/queries/user/owned-spaces.d.ts +0 -9
- package/dist/queries/user/owned-spaces.js +0 -17
- package/dist/queries/user/profile.d.ts +0 -4
- package/dist/queries/user/profile.js +0 -16
- package/dist/queries/user/setup.d.ts +0 -13
- package/dist/queries/user/setup.js +0 -16
- package/dist/rules/user/index.d.ts +0 -1
- package/dist/rules/user/index.js +0 -1
- package/dist/rules/user/setup.d.ts +0 -38
- package/dist/rules/user/setup.js +0 -95
- package/dist/schema/modules/group/core/admin-group.js +0 -2
- package/dist/schema/modules/group/core/core.d.ts +0 -8
- package/dist/schema/modules/group/core/core.js +0 -6
- package/dist/schema/modules/group/core/identity.d.ts +0 -1
- package/dist/schema/modules/group/core/identity.js +0 -10
- package/dist/schema/modules/group/core/member-group.js +0 -2
- package/dist/schema/modules/group/functions/assign-user.d.ts +0 -7
- package/dist/schema/modules/group/functions/assign-user.js +0 -12
- package/dist/schema/modules/group/functions/unassign-user.d.ts +0 -7
- package/dist/schema/modules/group/functions/unassign-user.js +0 -12
- package/dist/schema/modules/group/policies/may-setup-users.d.ts +0 -1
- package/dist/schema/modules/group/policies/may-setup-users.js +0 -6
- package/dist/schema/modules/group/types/membership.d.ts +0 -276
- package/dist/schema/modules/group/types/membership.js +0 -5
- package/dist/schema/modules/group/views/group.d.ts +0 -1
- package/dist/schema/modules/group/views/group.js +0 -6
- package/dist/schema/modules/space/classes/administers-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/administers-space.js +0 -9
- package/dist/schema/modules/space/classes/default-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/default-space.js +0 -8
- package/dist/schema/modules/space/classes/member-of-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/member-of-space.js +0 -9
- package/dist/schema/modules/space/classes/owns-space.d.ts +0 -16
- package/dist/schema/modules/space/classes/owns-space.js +0 -9
- package/dist/schema/modules/space/classes/space.d.ts +0 -15
- package/dist/schema/modules/space/classes/space.js +0 -15
- package/dist/schema/modules/space/core/core.d.ts +0 -7
- package/dist/schema/modules/space/core/core.js +0 -12
- package/dist/schema/modules/space/core/default-space.d.ts +0 -1
- package/dist/schema/modules/space/core/default-space.js +0 -6
- package/dist/schema/modules/space/functions/add-user.d.ts +0 -8
- package/dist/schema/modules/space/functions/add-user.js +0 -12
- package/dist/schema/modules/space/functions/remove-user.d.ts +0 -7
- package/dist/schema/modules/space/functions/remove-user.js +0 -11
- package/dist/schema/modules/space/functions/set-default.d.ts +0 -5
- package/dist/schema/modules/space/functions/set-default.js +0 -11
- package/dist/schema/modules/space/index.d.ts +0 -14
- package/dist/schema/modules/space/index.js +0 -14
- package/dist/schema/modules/space/policies/belongs-to-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/belongs-to-space.js +0 -9
- package/dist/schema/modules/space/policies/may-administer-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/may-administer-space.js +0 -8
- package/dist/schema/modules/space/policies/owns-space.d.ts +0 -1
- package/dist/schema/modules/space/policies/owns-space.js +0 -7
- package/dist/schema/modules/space/types/access.d.ts +0 -280
- package/dist/schema/modules/space/types/access.js +0 -12
- package/dist/schema/modules/space/views/space.d.ts +0 -1
- package/dist/schema/modules/space/views/space.js +0 -6
- package/dist/schema/modules/user/functions/resolve-home.d.ts +0 -7
- package/dist/schema/modules/user/functions/resolve-home.js +0 -11
- package/dist/schema/modules/user/functions/setup-admin.d.ts +0 -15
- package/dist/schema/modules/user/functions/setup-admin.js +0 -11
- package/dist/schema/modules/user/functions/setup-member.d.ts +0 -15
- package/dist/schema/modules/user/functions/setup-member.js +0 -11
- package/dist/schema/modules/user/types/setup-user.d.ts +0 -13
- package/dist/schema/modules/user/types/setup-user.js +0 -14
- package/dist/schema/modules/user/views/home.d.ts +0 -1
- package/dist/schema/modules/user/views/home.js +0 -4
- package/dist/schema/modules/user/views/user.d.ts +0 -1
- package/dist/schema/modules/user/views/user.js +0 -6
- /package/dist/schema/modules/group/core/{admin-group.d.ts → administrators-group.d.ts} +0 -0
- /package/dist/schema/modules/group/core/{member-group.d.ts → members-group.d.ts} +0 -0
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { LocalBinding } from '@astrale-os/sdk/graph';
|
|
2
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
3
|
-
import { defineMutation } from '@astrale-os/sdk/mutation';
|
|
4
|
-
const personalSpace = LocalBinding('personalSpace');
|
|
5
|
-
export const repairUser = defineMutation()((domain) => ({
|
|
6
|
-
id: 'shell.user.repair',
|
|
7
|
-
build(repair, mutation) {
|
|
8
|
-
mutation.expect.query(repair.guards.home);
|
|
9
|
-
mutation.expect.query(repair.guards.ownedSpaces);
|
|
10
|
-
mutation.expect.query(repair.guards.groups);
|
|
11
|
-
mutation.expect.node({
|
|
12
|
-
node: Path.id(repair.userId),
|
|
13
|
-
class: domain.classes.User,
|
|
14
|
-
props: repair.currentDisplayName === undefined
|
|
15
|
-
? { absent: ['displayName'] }
|
|
16
|
-
: { equals: { displayName: repair.currentDisplayName } },
|
|
17
|
-
});
|
|
18
|
-
if (repair.displayName !== undefined) {
|
|
19
|
-
mutation.updateNode({
|
|
20
|
-
node: Path.id(repair.userId),
|
|
21
|
-
class: domain.classes.User,
|
|
22
|
-
props: { set: { displayName: repair.displayName } },
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const home = repair.home.kind === 'create'
|
|
26
|
-
? mutation.createNode({
|
|
27
|
-
as: personalSpace,
|
|
28
|
-
class: domain.classes.Space,
|
|
29
|
-
props: { name: repair.home.name },
|
|
30
|
-
})
|
|
31
|
-
: Path.id(repair.home.id);
|
|
32
|
-
if (repair.home.kind === 'existing' && repair.home.name !== undefined) {
|
|
33
|
-
mutation.expect.node({
|
|
34
|
-
node: Path.id(repair.home.id),
|
|
35
|
-
class: domain.classes.Space,
|
|
36
|
-
props: { equals: { name: repair.home.currentName } },
|
|
37
|
-
});
|
|
38
|
-
mutation.updateNode({
|
|
39
|
-
node: Path.id(repair.home.id),
|
|
40
|
-
class: domain.classes.Space,
|
|
41
|
-
props: { set: { name: repair.home.name } },
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (repair.addOwnership) {
|
|
45
|
-
mutation.createEdge({
|
|
46
|
-
class: domain.classes.owns_space,
|
|
47
|
-
source: Path.id(repair.userId),
|
|
48
|
-
target: home,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
if (repair.addDefault) {
|
|
52
|
-
mutation.createEdge({
|
|
53
|
-
class: domain.classes.default_space,
|
|
54
|
-
source: Path.id(repair.userId),
|
|
55
|
-
target: home,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
if (repair.addMember) {
|
|
59
|
-
mutation.createEdge({
|
|
60
|
-
class: domain.classes.member_of_group,
|
|
61
|
-
source: Path.id(repair.userId),
|
|
62
|
-
target: Path.project(domain.core.nodes.member.ref),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (repair.addMemberAuthority) {
|
|
66
|
-
mutation.createEdge({
|
|
67
|
-
class: domain.dependencies.kernel.classes.extends_with,
|
|
68
|
-
source: Path.id(repair.userId),
|
|
69
|
-
target: Path.project(domain.core.nodes.member.ref),
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
if (repair.addAdmin) {
|
|
73
|
-
mutation.createEdge({
|
|
74
|
-
class: domain.classes.member_of_group,
|
|
75
|
-
source: Path.id(repair.userId),
|
|
76
|
-
target: Path.project(domain.core.nodes.admin.ref),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
if (repair.addAdminAuthority) {
|
|
80
|
-
mutation.createEdge({
|
|
81
|
-
class: domain.dependencies.kernel.classes.extends_with,
|
|
82
|
-
source: Path.id(repair.userId),
|
|
83
|
-
target: Path.project(domain.core.nodes.admin.ref),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (repair.removeAdminAuthority) {
|
|
87
|
-
mutation.deleteEdge({
|
|
88
|
-
class: domain.dependencies.kernel.classes.extends_with,
|
|
89
|
-
source: Path.id(repair.userId),
|
|
90
|
-
target: Path.project(domain.core.nodes.admin.ref),
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
project(result, repair) {
|
|
95
|
-
const personalSpaceId = repair.home.kind === 'existing' ? repair.home.id : result.createdNodes[personalSpace];
|
|
96
|
-
if (personalSpaceId === undefined) {
|
|
97
|
-
throw new TypeError('Shell User repair omitted its created personal Space identity.');
|
|
98
|
-
}
|
|
99
|
-
return Object.freeze({ ok: true, personalSpaceId });
|
|
100
|
-
},
|
|
101
|
-
reject(failure) {
|
|
102
|
-
return Object.freeze({ ok: false, code: failure.code, outcomeKnown: failure.outcomeKnown });
|
|
103
|
-
},
|
|
104
|
-
}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type CompositeQueryDefinition } from '@astrale-os/sdk/query';
|
|
2
|
-
import type { Shell } from '../../schema/index.js';
|
|
3
|
-
import { type AdminSpacesObservation } from './admin.js';
|
|
4
|
-
import { type MemberSpacesObservation } from './member.js';
|
|
5
|
-
export interface DirectSpaceAccessObservation {
|
|
6
|
-
readonly admin: AdminSpacesObservation;
|
|
7
|
-
readonly member: MemberSpacesObservation;
|
|
8
|
-
}
|
|
9
|
-
export declare const observeDirectSpaceAccess: CompositeQueryDefinition<Shell, string, DirectSpaceAccessObservation>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { defineCompositeQuery } from '@astrale-os/sdk/query';
|
|
2
|
-
import { observeAdminSpaces } from './admin.js';
|
|
3
|
-
import { observeMemberSpaces } from './member.js';
|
|
4
|
-
export const observeDirectSpaceAccess = defineCompositeQuery()(() => ({
|
|
5
|
-
id: 'shell.space.direct-access',
|
|
6
|
-
compose({ combine, query }, user) {
|
|
7
|
-
return combine({
|
|
8
|
-
admin: query('admin', observeAdminSpaces, user),
|
|
9
|
-
member: query('member', observeMemberSpaces, user),
|
|
10
|
-
});
|
|
11
|
-
},
|
|
12
|
-
}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
|
|
3
|
-
import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
|
|
4
|
-
import type { Shell } from '../../schema/index.js';
|
|
5
|
-
export interface AdminSpacesObservation {
|
|
6
|
-
readonly spaces: readonly Node[];
|
|
7
|
-
readonly guard: QueryPrecondition<QueryNodeAST>;
|
|
8
|
-
}
|
|
9
|
-
export declare const observeAdminSpaces: SingleQueryDefinition<Shell, string, AdminSpacesObservation>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
export const observeAdminSpaces = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.space.admin-access',
|
|
5
|
-
build(user) {
|
|
6
|
-
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
-
const spaces = source.expand({
|
|
8
|
-
via: [domain.classes.administers_space],
|
|
9
|
-
direction: 'outgoing',
|
|
10
|
-
});
|
|
11
|
-
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
12
|
-
},
|
|
13
|
-
pagination: { maximumPages: 64 },
|
|
14
|
-
project(pages, _user, { ast, complete }) {
|
|
15
|
-
return Object.freeze({
|
|
16
|
-
spaces: queryResult.completeNodeValues(pages, 'direct administered Spaces'),
|
|
17
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
18
|
-
});
|
|
19
|
-
},
|
|
20
|
-
}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
|
|
3
|
-
import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
|
|
4
|
-
import type { Shell } from '../../schema/index.js';
|
|
5
|
-
export interface MemberSpacesObservation {
|
|
6
|
-
readonly spaces: readonly Node[];
|
|
7
|
-
readonly guard: QueryPrecondition<QueryNodeAST>;
|
|
8
|
-
}
|
|
9
|
-
export declare const observeMemberSpaces: SingleQueryDefinition<Shell, string, MemberSpacesObservation>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
export const observeMemberSpaces = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.space.member-access',
|
|
5
|
-
build(user) {
|
|
6
|
-
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
-
const spaces = source.expand({ via: [domain.classes.member_of_space], direction: 'outgoing' });
|
|
8
|
-
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
9
|
-
},
|
|
10
|
-
pagination: { maximumPages: 64 },
|
|
11
|
-
project(pages, _user, { ast, complete }) {
|
|
12
|
-
return Object.freeze({
|
|
13
|
-
spaces: queryResult.completeNodeValues(pages, 'direct member Spaces'),
|
|
14
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
}));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
|
|
3
|
-
import type { QueryEdgeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
|
|
4
|
-
import type { Shell } from '../../schema/index.js';
|
|
5
|
-
export interface UserGroupsObservation {
|
|
6
|
-
readonly groups: readonly Node[];
|
|
7
|
-
readonly authorities: readonly Node[];
|
|
8
|
-
readonly guard: QueryPrecondition<QueryEdgeAST>;
|
|
9
|
-
}
|
|
10
|
-
export declare const observeUserGroups: SingleQueryDefinition<Shell, string, UserGroupsObservation>;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
export const observeUserGroups = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.user.groups',
|
|
5
|
-
build(user) {
|
|
6
|
-
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
-
const relations = source.expand({
|
|
8
|
-
via: [domain.classes.member_of_group, domain.dependencies.kernel.classes.extends_with],
|
|
9
|
-
direction: 'outgoing',
|
|
10
|
-
});
|
|
11
|
-
return relations.select({
|
|
12
|
-
kind: 'edges',
|
|
13
|
-
binding: relations.edge,
|
|
14
|
-
projection: { edge: 'value', source: 'reference', target: 'value' },
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
pagination: { maximumPages: 64 },
|
|
18
|
-
project(pages, _user, { ast, complete }) {
|
|
19
|
-
const groups = [];
|
|
20
|
-
const authorities = [];
|
|
21
|
-
for (const item of pages.flatMap((page) => queryResult.edgeItems(page, 'Shell User Groups'))) {
|
|
22
|
-
if (item.edge.kind !== 'value' || item.target.kind !== 'value') {
|
|
23
|
-
throw new TypeError('Shell User Groups must project Edge and target values.');
|
|
24
|
-
}
|
|
25
|
-
if (item.edge.value.class === domain.classes.member_of_group.key) {
|
|
26
|
-
groups.push(item.target.value);
|
|
27
|
-
}
|
|
28
|
-
else if (item.edge.value.class === domain.dependencies.kernel.classes.extends_with.key) {
|
|
29
|
-
authorities.push(item.target.value);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
throw new TypeError('Shell User Groups returned an unexpected relationship Class.');
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return Object.freeze({
|
|
36
|
-
groups: Object.freeze(groups),
|
|
37
|
-
authorities: Object.freeze(authorities),
|
|
38
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
39
|
-
});
|
|
40
|
-
},
|
|
41
|
-
}));
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
|
|
3
|
-
import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
|
|
4
|
-
import type { Shell } from '../../schema/index.js';
|
|
5
|
-
export interface HomeObservation {
|
|
6
|
-
readonly spaces: readonly Node[];
|
|
7
|
-
readonly guard: QueryPrecondition<QueryNodeAST>;
|
|
8
|
-
}
|
|
9
|
-
export declare const observeHome: SingleQueryDefinition<Shell, string, HomeObservation>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
export const observeHome = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.user.home',
|
|
5
|
-
build(user) {
|
|
6
|
-
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
-
const spaces = source.expand({
|
|
8
|
-
via: [domain.classes.default_space],
|
|
9
|
-
direction: 'outgoing',
|
|
10
|
-
});
|
|
11
|
-
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
12
|
-
},
|
|
13
|
-
page: { size: 2 },
|
|
14
|
-
pagination: { maximumPages: 2 },
|
|
15
|
-
project(pages, _user, { ast, complete }) {
|
|
16
|
-
return Object.freeze({
|
|
17
|
-
spaces: queryResult.completeNodeValues(pages, 'Shell User home'),
|
|
18
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
}));
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { observeUserGroups, type UserGroupsObservation } from './groups.js';
|
|
2
|
-
export { observeHome, type HomeObservation } from './home.js';
|
|
3
|
-
export { observeOwnedSpaces, type OwnedSpacesObservation } from './owned-spaces.js';
|
|
4
|
-
export { readUserProfile } from './profile.js';
|
|
5
|
-
export { observeUserSetup, type UserSetupObservation } from './setup.js';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { QueryPrecondition } from '@astrale-os/sdk/mutation';
|
|
3
|
-
import type { QueryNodeAST, SingleQueryDefinition } from '@astrale-os/sdk/query';
|
|
4
|
-
import type { Shell } from '../../schema/index.js';
|
|
5
|
-
export interface OwnedSpacesObservation {
|
|
6
|
-
readonly spaces: readonly Node[];
|
|
7
|
-
readonly guard: QueryPrecondition<QueryNodeAST>;
|
|
8
|
-
}
|
|
9
|
-
export declare const observeOwnedSpaces: SingleQueryDefinition<Shell, string, OwnedSpacesObservation>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult } from '@astrale-os/sdk/query';
|
|
3
|
-
export const observeOwnedSpaces = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.user.owned-spaces',
|
|
5
|
-
build(user) {
|
|
6
|
-
const source = Query.from({ nodes: [Path.parse(user)] });
|
|
7
|
-
const spaces = source.expand({ via: [domain.classes.owns_space], direction: 'outgoing' });
|
|
8
|
-
return spaces.select({ kind: 'nodes', binding: spaces.node, projection: { kind: 'value' } });
|
|
9
|
-
},
|
|
10
|
-
pagination: { maximumPages: 64 },
|
|
11
|
-
project(pages, _user, { ast, complete }) {
|
|
12
|
-
return Object.freeze({
|
|
13
|
-
spaces: queryResult.completeNodeValues(pages, 'Shell User owned Spaces'),
|
|
14
|
-
guard: Object.freeze({ query: ast, equals: complete }),
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
}));
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Path } from '@astrale-os/sdk/graph/path';
|
|
2
|
-
import { Query, defineQuery, queryResult, } from '@astrale-os/sdk/query';
|
|
3
|
-
export const readUserProfile = defineQuery()((domain) => ({
|
|
4
|
-
id: 'shell.user.profile',
|
|
5
|
-
build(user) {
|
|
6
|
-
return Query.from({ nodes: [Path.parse(user)] })
|
|
7
|
-
.filter({ class: domain.classes.User })
|
|
8
|
-
.select({
|
|
9
|
-
kind: 'nodes',
|
|
10
|
-
projection: { kind: 'value' },
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
project(result) {
|
|
14
|
-
return queryResult.exactlyOneNode(result, 'Shell User profile');
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import { type CompositeQueryDefinition } from '@astrale-os/sdk/query';
|
|
3
|
-
import type { Shell } from '../../schema/index.js';
|
|
4
|
-
import type { UserGroupsObservation } from './groups.js';
|
|
5
|
-
import { type HomeObservation } from './home.js';
|
|
6
|
-
import { type OwnedSpacesObservation } from './owned-spaces.js';
|
|
7
|
-
export interface UserSetupObservation {
|
|
8
|
-
readonly profile: Node;
|
|
9
|
-
readonly home: HomeObservation;
|
|
10
|
-
readonly ownedSpaces: OwnedSpacesObservation;
|
|
11
|
-
readonly groups: UserGroupsObservation;
|
|
12
|
-
}
|
|
13
|
-
export declare const observeUserSetup: CompositeQueryDefinition<Shell, string, UserSetupObservation>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defineCompositeQuery } from '@astrale-os/sdk/query';
|
|
2
|
-
import { observeUserGroups } from './groups.js';
|
|
3
|
-
import { observeHome } from './home.js';
|
|
4
|
-
import { observeOwnedSpaces } from './owned-spaces.js';
|
|
5
|
-
import { readUserProfile } from './profile.js';
|
|
6
|
-
export const observeUserSetup = defineCompositeQuery()(() => ({
|
|
7
|
-
id: 'shell.user.setup',
|
|
8
|
-
compose({ combine, query }, userId) {
|
|
9
|
-
return combine({
|
|
10
|
-
profile: query('profile', readUserProfile, userId),
|
|
11
|
-
home: query('home', observeHome, userId),
|
|
12
|
-
ownedSpaces: query('owned-spaces', observeOwnedSpaces, userId),
|
|
13
|
-
groups: query('groups', observeUserGroups, userId),
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { planUserSetup, type SetupConflictReason, type SetupPlan, type SetupRole, type UserSetupRepair, } from './setup.js';
|
package/dist/rules/user/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { planUserSetup, } from './setup.js';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@astrale-os/sdk/graph/node';
|
|
2
|
-
import type { UserSetupObservation } from '../../queries/user/index.js';
|
|
3
|
-
import type { SetupUserInput, Shell } from '../../schema/index.js';
|
|
4
|
-
export type SetupRole = 'member' | 'admin';
|
|
5
|
-
export type SetupPlan = {
|
|
6
|
-
readonly kind: 'conflict';
|
|
7
|
-
readonly reason: SetupConflictReason;
|
|
8
|
-
readonly message: string;
|
|
9
|
-
} | {
|
|
10
|
-
readonly kind: 'unchanged';
|
|
11
|
-
readonly personalSpaceId: Node['id'];
|
|
12
|
-
} | {
|
|
13
|
-
readonly kind: 'repair';
|
|
14
|
-
readonly repair: UserSetupRepair;
|
|
15
|
-
};
|
|
16
|
-
export interface UserSetupRepair {
|
|
17
|
-
readonly userId: Node['id'];
|
|
18
|
-
readonly currentDisplayName?: string;
|
|
19
|
-
readonly displayName?: string;
|
|
20
|
-
readonly home: {
|
|
21
|
-
readonly kind: 'existing';
|
|
22
|
-
readonly id: Node['id'];
|
|
23
|
-
readonly currentName: string;
|
|
24
|
-
readonly name?: string;
|
|
25
|
-
} | {
|
|
26
|
-
readonly kind: 'create';
|
|
27
|
-
readonly name: string;
|
|
28
|
-
};
|
|
29
|
-
readonly addDefault: boolean;
|
|
30
|
-
readonly addOwnership: boolean;
|
|
31
|
-
readonly addMember: boolean;
|
|
32
|
-
readonly addMemberAuthority: boolean;
|
|
33
|
-
readonly addAdmin: boolean;
|
|
34
|
-
readonly addAdminAuthority: boolean;
|
|
35
|
-
readonly removeAdminAuthority: boolean;
|
|
36
|
-
}
|
|
37
|
-
export type SetupConflictReason = 'IDENTITY_CLASS_CONFLICT' | 'IDENTITY_FACT_CONFLICT' | 'MULTIPLE_DEFAULT_SPACES' | 'DEFAULT_SPACE_CLASS_CONFLICT' | 'AMBIGUOUS_PERSONAL_SPACE';
|
|
38
|
-
export declare function planUserSetup(domain: Shell, input: SetupUserInput, role: SetupRole, observation: UserSetupObservation): SetupPlan;
|
package/dist/rules/user/setup.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
export function planUserSetup(domain, input, role, observation) {
|
|
2
|
-
const profile = observation.profile;
|
|
3
|
-
if (profile.class !== domain.classes.User.key) {
|
|
4
|
-
return conflict('IDENTITY_CLASS_CONFLICT', 'The asserted identity already belongs to a non-Shell User Class.');
|
|
5
|
-
}
|
|
6
|
-
const identityIssuer = profile.props[domain.classes.User.properties.iss.key];
|
|
7
|
-
const identitySubject = profile.props[domain.classes.User.properties.sub.key];
|
|
8
|
-
if (identityIssuer !== input.issuer || identitySubject !== input.subject) {
|
|
9
|
-
return conflict('IDENTITY_FACT_CONFLICT', 'The resolved Shell User does not retain the asserted issuer and subject.');
|
|
10
|
-
}
|
|
11
|
-
if (observation.home.spaces.length > 1) {
|
|
12
|
-
return conflict('MULTIPLE_DEFAULT_SPACES', 'The Shell User has more than one default personal Space.');
|
|
13
|
-
}
|
|
14
|
-
const currentHome = observation.home.spaces[0];
|
|
15
|
-
if (currentHome !== undefined && currentHome.class !== domain.classes.Space.key) {
|
|
16
|
-
return conflict('DEFAULT_SPACE_CLASS_CONFLICT', 'The Shell User default target is not a Shell Space.');
|
|
17
|
-
}
|
|
18
|
-
const candidates = currentHome === undefined
|
|
19
|
-
? observation.ownedSpaces.spaces.filter((space) => space.class === domain.classes.Space.key &&
|
|
20
|
-
space.props[domain.classes.Space.properties.name.key] === input.personalSpaceName)
|
|
21
|
-
: [];
|
|
22
|
-
if (candidates.length > 1) {
|
|
23
|
-
return conflict('AMBIGUOUS_PERSONAL_SPACE', 'More than one owned Space matches the requested personal Space name.');
|
|
24
|
-
}
|
|
25
|
-
const home = currentHome ?? candidates[0];
|
|
26
|
-
const currentDisplayName = profile.props[domain.classes.User.properties.displayName.key];
|
|
27
|
-
if (currentDisplayName !== undefined && typeof currentDisplayName !== 'string') {
|
|
28
|
-
throw new TypeError('Shell User displayName is not a string.');
|
|
29
|
-
}
|
|
30
|
-
const member = hasGroup(domain, observation.groups.groups, 'core.member');
|
|
31
|
-
const memberAuthority = hasGroup(domain, observation.groups.authorities, 'core.member');
|
|
32
|
-
const admin = hasGroup(domain, observation.groups.groups, 'core.admin');
|
|
33
|
-
const adminAuthority = hasGroup(domain, observation.groups.authorities, 'core.admin');
|
|
34
|
-
const ownsHome = home !== undefined && observation.ownedSpaces.spaces.some((space) => space.id === home.id);
|
|
35
|
-
let homeName;
|
|
36
|
-
if (home !== undefined) {
|
|
37
|
-
const value = home.props[domain.classes.Space.properties.name.key];
|
|
38
|
-
if (typeof value !== 'string') {
|
|
39
|
-
throw new TypeError('Shell personal Space name is not a string.');
|
|
40
|
-
}
|
|
41
|
-
homeName = value;
|
|
42
|
-
}
|
|
43
|
-
const displayName = currentDisplayName === input.displayName ? undefined : input.displayName;
|
|
44
|
-
const desiredHomeName = homeName === input.personalSpaceName ? undefined : input.personalSpaceName;
|
|
45
|
-
const addDefault = currentHome === undefined;
|
|
46
|
-
const addOwnership = home === undefined || !ownsHome;
|
|
47
|
-
const addMember = !member;
|
|
48
|
-
const addMemberAuthority = !memberAuthority;
|
|
49
|
-
const addAdmin = role === 'admin' && !admin;
|
|
50
|
-
const preserveAdmin = role === 'admin' || admin;
|
|
51
|
-
const addAdminAuthority = preserveAdmin && !adminAuthority;
|
|
52
|
-
const removeAdminAuthority = !preserveAdmin && adminAuthority;
|
|
53
|
-
if (displayName === undefined &&
|
|
54
|
-
desiredHomeName === undefined &&
|
|
55
|
-
!addDefault &&
|
|
56
|
-
!addOwnership &&
|
|
57
|
-
!addMember &&
|
|
58
|
-
!addMemberAuthority &&
|
|
59
|
-
!addAdmin &&
|
|
60
|
-
!addAdminAuthority &&
|
|
61
|
-
!removeAdminAuthority) {
|
|
62
|
-
return Object.freeze({ kind: 'unchanged', personalSpaceId: home.id });
|
|
63
|
-
}
|
|
64
|
-
return Object.freeze({
|
|
65
|
-
kind: 'repair',
|
|
66
|
-
repair: Object.freeze({
|
|
67
|
-
userId: profile.id,
|
|
68
|
-
...(currentDisplayName === undefined ? {} : { currentDisplayName }),
|
|
69
|
-
...(displayName === undefined ? {} : { displayName }),
|
|
70
|
-
home: home === undefined
|
|
71
|
-
? Object.freeze({ kind: 'create', name: input.personalSpaceName })
|
|
72
|
-
: Object.freeze({
|
|
73
|
-
kind: 'existing',
|
|
74
|
-
id: home.id,
|
|
75
|
-
currentName: homeName,
|
|
76
|
-
...(desiredHomeName === undefined ? {} : { name: desiredHomeName }),
|
|
77
|
-
}),
|
|
78
|
-
addDefault,
|
|
79
|
-
addOwnership,
|
|
80
|
-
addMember,
|
|
81
|
-
addMemberAuthority,
|
|
82
|
-
addAdmin,
|
|
83
|
-
addAdminAuthority,
|
|
84
|
-
removeAdminAuthority,
|
|
85
|
-
}),
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function hasGroup(domain, groups, subject) {
|
|
89
|
-
return groups.some((group) => group.class === domain.classes.Group.key &&
|
|
90
|
-
group.props[domain.classes.Group.properties.iss.key] === domain.origin &&
|
|
91
|
-
group.props[domain.classes.Group.properties.sub.key] === subject);
|
|
92
|
-
}
|
|
93
|
-
function conflict(reason, message) {
|
|
94
|
-
return Object.freeze({ kind: 'conflict', reason, message });
|
|
95
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function groupIdentity(subject: string, name: string, description: string): import("@astrale-os/sdk/schema").CoreNode;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { K, core } from '@astrale-os/sdk/schema';
|
|
2
|
-
import { Group } from '../classes/group.js';
|
|
3
|
-
export function groupIdentity(subject, name, description) {
|
|
4
|
-
return core.node(() => Group, {
|
|
5
|
-
[K.classes.Identity.self.properties.iss.key]: 'shell.astrale.ai',
|
|
6
|
-
[K.classes.Identity.self.properties.sub.key]: subject,
|
|
7
|
-
[K.classes.Named.self.properties.name.key]: name,
|
|
8
|
-
[K.classes.Descriptable.self.properties.description.key]: description,
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
-
import { adminGroup } from '../core/admin-group.js';
|
|
3
|
-
import { maySetupUsers } from '../policies/may-setup-users.js';
|
|
4
|
-
import { membershipInput, membershipOutput } from '../types/membership.js';
|
|
5
|
-
const membershipPolicy = ({ check, ref }) => check(maySetupUsers, ref(adminGroup));
|
|
6
|
-
export const groupAssignUser = method({
|
|
7
|
-
description: 'Assign one User to this Group.',
|
|
8
|
-
input: membershipInput,
|
|
9
|
-
output: membershipOutput,
|
|
10
|
-
auth: 'authorized',
|
|
11
|
-
policy: membershipPolicy,
|
|
12
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type builder } from '@astrale-os/sdk/schema';
|
|
2
|
-
export declare const groupUnassignUser: builder.Method<builder.CallableProjection<{
|
|
3
|
-
user: string;
|
|
4
|
-
}, {
|
|
5
|
-
readonly mode: 'value';
|
|
6
|
-
readonly value: Record<string, never>;
|
|
7
|
-
}, "authorized", false, "default">>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { method } from '@astrale-os/sdk/schema';
|
|
2
|
-
import { adminGroup } from '../core/admin-group.js';
|
|
3
|
-
import { maySetupUsers } from '../policies/may-setup-users.js';
|
|
4
|
-
import { membershipInput, membershipOutput } from '../types/membership.js';
|
|
5
|
-
const membershipPolicy = ({ check, ref }) => check(maySetupUsers, ref(adminGroup));
|
|
6
|
-
export const groupUnassignUser = method({
|
|
7
|
-
description: 'Remove one User from this Group.',
|
|
8
|
-
input: membershipInput,
|
|
9
|
-
output: membershipOutput,
|
|
10
|
-
auth: 'authorized',
|
|
11
|
-
policy: membershipPolicy,
|
|
12
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const maySetupUsers: import("@astrale-os/sdk/schema").Policy;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { policy } from '@astrale-os/sdk/schema';
|
|
2
|
-
import { member_of_group } from '../classes/member-of-group.js';
|
|
3
|
-
export const maySetupUsers = policy({
|
|
4
|
-
description: 'The effective User Grant belongs to the selected Administrators Group.',
|
|
5
|
-
match: ({ edge, object, subject }) => edge({ source: subject, class: member_of_group, target: object }),
|
|
6
|
-
});
|