1 | import { _Web, Web } from "../webs/types.js";
|
2 | import { SharingRole } from "./types.js";
|
3 | import { shareObject } from "./funcs.js";
|
4 | import { combine } from "@pnp/core";
|
5 | import { body } from "@pnp/queryable";
|
6 | import { spPost } from "../operations.js";
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | _Web.prototype.shareWith = async function (loginNames, role = SharingRole.View, emailData) {
|
14 | const url = await this.select("Url")();
|
15 | return this.shareObject(combine(url.Url, "/_layouts/15/aclinv.aspx?forSharing=1&mbypass=1"), loginNames, role, emailData);
|
16 | };
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | _Web.prototype.shareObject = function (url, loginNames, role, emailData, group, propagateAcl = false, includeAnonymousLinkInEmail = false, useSimplifiedRoles = true) {
|
30 | return shareObject(this, {
|
31 | emailData: emailData,
|
32 | group: group,
|
33 | includeAnonymousLinkInEmail: includeAnonymousLinkInEmail,
|
34 | loginNames: loginNames,
|
35 | propagateAcl: propagateAcl,
|
36 | role: role,
|
37 | url: url,
|
38 | useSimplifiedRoles: useSimplifiedRoles,
|
39 | });
|
40 | };
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | _Web.prototype.shareObjectRaw = function (options) {
|
47 | return shareObject(this, options, true);
|
48 | };
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | _Web.prototype.unshareObject = function (url) {
|
55 | return spPost(Web(this, "unshareObject"), body({ url }));
|
56 | };
|
57 |
|
\ | No newline at end of file |