@pnp/cli-microsoft365 5.6.0-beta.3d0b974 → 5.6.0-beta.8b9dde0
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/dist/m365/spo/commands/group/group-get.js +26 -6
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -6
- package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -6
- package/docs/docs/cmd/spo/group/group-get.md +12 -3
- package/docs/docs/cmd/spo/site/site-apppermission-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-set.md +1 -1
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
15
15
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
16
|
telemetryProps.id = (!(!args.options.id)).toString();
|
|
17
17
|
telemetryProps.name = (!(!args.options.name)).toString();
|
|
18
|
+
telemetryProps.associatedGroup = args.options.associatedGroup;
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
20
21
|
commandAction(logger, args, cb) {
|
|
@@ -28,6 +29,19 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
28
29
|
else if (args.options.name) {
|
|
29
30
|
requestUrl = `${args.options.webUrl}/_api/web/sitegroups/GetByName('${encodeURIComponent(args.options.name)}')`;
|
|
30
31
|
}
|
|
32
|
+
else if (args.options.associatedGroup) {
|
|
33
|
+
switch (args.options.associatedGroup.toLowerCase()) {
|
|
34
|
+
case 'owner':
|
|
35
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedOwnerGroup`;
|
|
36
|
+
break;
|
|
37
|
+
case 'member':
|
|
38
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedMemberGroup`;
|
|
39
|
+
break;
|
|
40
|
+
case 'visitor':
|
|
41
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedVisitorGroup`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
const requestOptions = {
|
|
32
46
|
url: requestUrl,
|
|
33
47
|
method: 'GET',
|
|
@@ -53,21 +67,27 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
53
67
|
},
|
|
54
68
|
{
|
|
55
69
|
option: '--name [name]'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
option: '--associatedGroup [associatedGroup]',
|
|
73
|
+
autocomplete: ['Owner', 'Member', 'Visitor']
|
|
56
74
|
}
|
|
57
75
|
];
|
|
58
76
|
const parentOptions = super.options();
|
|
59
77
|
return options.concat(parentOptions);
|
|
60
78
|
}
|
|
79
|
+
optionSets() {
|
|
80
|
+
return [
|
|
81
|
+
['id', 'name', 'associatedGroup']
|
|
82
|
+
];
|
|
83
|
+
}
|
|
61
84
|
validate(args) {
|
|
62
|
-
if (args.options.id && args.options.name) {
|
|
63
|
-
return 'Use either "id" or "name", but not all.';
|
|
64
|
-
}
|
|
65
|
-
if (!args.options.id && !args.options.name) {
|
|
66
|
-
return 'Specify id or name, one is required';
|
|
67
|
-
}
|
|
68
85
|
if (args.options.id && isNaN(args.options.id)) {
|
|
69
86
|
return `Specified id ${args.options.id} is not a number`;
|
|
70
87
|
}
|
|
88
|
+
if (args.options.associatedGroup && ['owner', 'member', 'visitor'].indexOf(args.options.associatedGroup.toLowerCase()) === -1) {
|
|
89
|
+
return `${args.options.associatedGroup} is not a valid associatedGroup value. Allowed values are Owner|Member|Visitor.`;
|
|
90
|
+
}
|
|
71
91
|
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
72
92
|
}
|
|
73
93
|
}
|
|
@@ -73,7 +73,7 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
73
73
|
}
|
|
74
74
|
mapRequestBody(permission, appInfo) {
|
|
75
75
|
const requestBody = {
|
|
76
|
-
roles: permission
|
|
76
|
+
roles: [permission]
|
|
77
77
|
};
|
|
78
78
|
requestBody.grantedToIdentities = [];
|
|
79
79
|
requestBody.grantedToIdentities.push({ application: { "id": appInfo.appId, "displayName": appInfo.displayName } });
|
|
@@ -129,11 +129,8 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
129
129
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
130
130
|
return `${args.options.appId} is not a valid GUID`;
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
135
|
-
return `${permissions[i]} is not a valid permission value. Allowed values read|write|read,write`;
|
|
136
|
-
}
|
|
132
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
133
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
137
134
|
}
|
|
138
135
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
139
136
|
}
|
|
@@ -83,7 +83,7 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
83
83
|
'content-type': 'application/json;odata=nometadata'
|
|
84
84
|
},
|
|
85
85
|
data: {
|
|
86
|
-
roles: args.options.permission
|
|
86
|
+
roles: [args.options.permission]
|
|
87
87
|
},
|
|
88
88
|
responseType: 'json'
|
|
89
89
|
};
|
|
@@ -122,11 +122,8 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
122
122
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
123
123
|
return `${args.options.appId} is not a valid GUID`;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
128
|
-
return `${permissions[i]} is not a valid permission value. Allowed values are read|write|read,write`;
|
|
129
|
-
}
|
|
125
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
126
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
130
127
|
}
|
|
131
128
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
132
129
|
}
|
|
@@ -11,13 +11,16 @@ m365 spo group get [options]
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
13
|
`-u, --webUrl <webUrl>`
|
|
14
|
-
: URL of the site where the group is located
|
|
14
|
+
: URL of the site where the group is located.
|
|
15
15
|
|
|
16
16
|
`-i, --id [id]`
|
|
17
|
-
: ID of the site group to get. Use either `id` or `
|
|
17
|
+
: ID of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
18
18
|
|
|
19
19
|
`--name [name]`
|
|
20
|
-
: Name of the site group to get.
|
|
20
|
+
: Name of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
|
+
|
|
22
|
+
`--associatedGroup [associatedGroup]`
|
|
23
|
+
: Type of the associated group to get. Available values: `Owner`, `Member`, `Visitor`. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
24
|
|
|
22
25
|
--8<-- "docs/cmd/_global.md"
|
|
23
26
|
|
|
@@ -34,3 +37,9 @@ Get group with name _Team Site Members_ for web _https://contoso.sharepoint.com/
|
|
|
34
37
|
```sh
|
|
35
38
|
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --name "Team Site Members"
|
|
36
39
|
```
|
|
40
|
+
|
|
41
|
+
Get the associated owner group of a specified site
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --associatedGroup Owner
|
|
45
|
+
```
|
|
@@ -14,7 +14,7 @@ m365 spo site apppermission add [options]
|
|
|
14
14
|
: URL of the site collection to add the permission
|
|
15
15
|
|
|
16
16
|
`-p, --permission <permission>`
|
|
17
|
-
: Permission to site (`read`, `write`, `
|
|
17
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
18
18
|
|
|
19
19
|
`-i, --appId [appId]`
|
|
20
20
|
: Client ID of the Azure AD app for which to grant permissions
|
|
@@ -23,7 +23,7 @@ m365 spo site apppermission set [options]
|
|
|
23
23
|
: Display name of the Azure AD app for which to update permissions. Specify `permissionId`, `appId` or `appDisplayName`
|
|
24
24
|
|
|
25
25
|
`-p, --permission <permission>`
|
|
26
|
-
: Permission to site (`read`, `write`, `
|
|
26
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
27
27
|
|
|
28
28
|
--8<-- "docs/cmd/_global.md"
|
|
29
29
|
|
package/package.json
CHANGED