1 | import { __decorate } from "tslib";
|
2 | import { _SPCollection, spInvokableFactory, _SPInstance, } from "../spqueryable.js";
|
3 | import { SiteUsers } from "../site-users/types.js";
|
4 | import { body } from "@pnp/queryable";
|
5 | import { defaultPath } from "../decorators.js";
|
6 | import { spPost, spPostMerge } from "../operations.js";
|
7 | let _SiteGroups = class _SiteGroups extends _SPCollection {
|
8 | |
9 |
|
10 |
|
11 |
|
12 |
|
13 | getById(id) {
|
14 | return SiteGroup(this).concat(`(${id})`);
|
15 | }
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | async add(properties) {
|
22 | const data = await spPost(this, body(properties));
|
23 | return {
|
24 | data,
|
25 | group: this.getById(data.Id),
|
26 | };
|
27 | }
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 | getByName(groupName) {
|
34 | return SiteGroup(this, `getByName('${groupName}')`);
|
35 | }
|
36 | |
37 |
|
38 |
|
39 |
|
40 |
|
41 | removeById(id) {
|
42 | return spPost(SiteGroups(this, `removeById('${id}')`));
|
43 | }
|
44 | |
45 |
|
46 |
|
47 |
|
48 |
|
49 | removeByLoginName(loginName) {
|
50 | return spPost(SiteGroups(this, `removeByLoginName('${loginName}')`));
|
51 | }
|
52 | };
|
53 | _SiteGroups = __decorate([
|
54 | defaultPath("sitegroups")
|
55 | ], _SiteGroups);
|
56 | export { _SiteGroups };
|
57 | export const SiteGroups = spInvokableFactory(_SiteGroups);
|
58 | export class _SiteGroup extends _SPInstance {
|
59 | |
60 |
|
61 |
|
62 |
|
63 | get users() {
|
64 | return SiteUsers(this, "users");
|
65 | }
|
66 | |
67 |
|
68 |
|
69 | async update(props) {
|
70 | const data = await spPostMerge(this, body(props));
|
71 | return {
|
72 | data,
|
73 | group: this,
|
74 | };
|
75 | }
|
76 | |
77 |
|
78 |
|
79 |
|
80 | setUserAsOwner(userId) {
|
81 | return spPost(SiteGroup(this, `SetUserAsOwner(${userId})`));
|
82 | }
|
83 | }
|
84 | export const SiteGroup = spInvokableFactory(_SiteGroup);
|
85 |
|
\ | No newline at end of file |