@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.
@@ -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.split(',')
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
- const permissions = args.options.permission.split(',');
133
- for (let i = 0; i < permissions.length; i++) {
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.split(',')
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
- const permissions = args.options.permission.split(',');
126
- for (let i = 0; i < permissions.length; i++) {
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 `name`, but not all. e.g `7`
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. Specify either `id` or `name` but not both e.g `Team Site Members`
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`, `read,write`). If multiple permissions have to be granted, they have to be comma separated ex. `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`, `read,write`). If multiple permissions have to be granted, they have to be comma separated ex. `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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.6.0-beta.3d0b974",
3
+ "version": "5.6.0-beta.8b9dde0",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",