@pnp/cli-microsoft365 5.8.0-beta.5250f08 → 5.8.0-beta.bc15f2b
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/onenote/commands/notebook/notebook-list.js +139 -0
- package/dist/m365/onenote/commands.js +7 -0
- package/dist/m365/planner/commands/task/task-get.js +7 -0
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +1 -1
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +9 -0
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +57 -28
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +206 -0
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +187 -0
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +170 -0
- package/dist/m365/spo/commands.js +3 -0
- package/docs/docs/cmd/adaptivecard/adaptivecard-send.md +0 -20
- package/docs/docs/cmd/onenote/notebook/notebook-list.md +70 -0
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +2 -2
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.md +3 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.md +67 -0
- package/docs/docs/cmd/spo/web/web-roleassignment-add.md +57 -0
- package/docs/docs/cmd/spo/web/web-roleassignment-remove.md +54 -0
- package/package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const utils_1 = require("../../../../utils");
|
|
20
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
21
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
class OneNoteNotebookListCommand extends GraphCommand_1.default {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
_OneNoteNotebookListCommand_instances.add(this);
|
|
27
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initTelemetry).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initOptions).call(this);
|
|
29
|
+
__classPrivateFieldGet(this, _OneNoteNotebookListCommand_instances, "m", _OneNoteNotebookListCommand_initValidators).call(this);
|
|
30
|
+
}
|
|
31
|
+
get name() {
|
|
32
|
+
return commands_1.default.NOTEBOOK_LIST;
|
|
33
|
+
}
|
|
34
|
+
get description() {
|
|
35
|
+
return 'Retrieve a list of notebooks';
|
|
36
|
+
}
|
|
37
|
+
getEndpointUrl(args) {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
let endpoint = `${this.resource}/v1.0/me/onenote/notebooks`;
|
|
40
|
+
if (args.options.userId) {
|
|
41
|
+
endpoint = `${this.resource}/v1.0/users/${args.options.userId}/onenote/notebooks`;
|
|
42
|
+
return resolve(endpoint);
|
|
43
|
+
}
|
|
44
|
+
else if (args.options.userName) {
|
|
45
|
+
endpoint = `${this.resource}/v1.0/users/${args.options.userName}/onenote/notebooks`;
|
|
46
|
+
return resolve(endpoint);
|
|
47
|
+
}
|
|
48
|
+
else if (args.options.groupId) {
|
|
49
|
+
endpoint = `${this.resource}/v1.0/groups/${args.options.groupId}/onenote/notebooks`;
|
|
50
|
+
return resolve(endpoint);
|
|
51
|
+
}
|
|
52
|
+
else if (args.options.groupName) {
|
|
53
|
+
this
|
|
54
|
+
.getGroupId(args)
|
|
55
|
+
.then((retrievedgroupId) => {
|
|
56
|
+
endpoint = `${this.resource}/v1.0/groups/${retrievedgroupId}/onenote/notebooks`;
|
|
57
|
+
return resolve(endpoint);
|
|
58
|
+
})
|
|
59
|
+
.catch((err) => {
|
|
60
|
+
reject(err);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
else if (args.options.webUrl) {
|
|
64
|
+
this
|
|
65
|
+
.getSpoSiteId(args)
|
|
66
|
+
.then((siteId) => {
|
|
67
|
+
endpoint = `${this.resource}/v1.0/sites/${siteId}/onenote/notebooks`;
|
|
68
|
+
return resolve(endpoint);
|
|
69
|
+
})
|
|
70
|
+
.catch((err) => {
|
|
71
|
+
reject(err);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return resolve(endpoint);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
defaultProperties() {
|
|
80
|
+
return ['createdDateTime', 'displayName', 'id'];
|
|
81
|
+
}
|
|
82
|
+
getGroupId(args) {
|
|
83
|
+
return aadGroup_1.aadGroup
|
|
84
|
+
.getGroupByDisplayName(args.options.groupName)
|
|
85
|
+
.then(group => group.id);
|
|
86
|
+
}
|
|
87
|
+
getSpoSiteId(args) {
|
|
88
|
+
const url = new URL(args.options.webUrl);
|
|
89
|
+
const requestOptions = {
|
|
90
|
+
url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
|
|
91
|
+
headers: {
|
|
92
|
+
accept: 'application/json;odata.metadata=none'
|
|
93
|
+
},
|
|
94
|
+
responseType: 'json'
|
|
95
|
+
};
|
|
96
|
+
return request_1.default
|
|
97
|
+
.get(requestOptions)
|
|
98
|
+
.then((site) => site.id);
|
|
99
|
+
}
|
|
100
|
+
commandAction(logger, args, cb) {
|
|
101
|
+
this
|
|
102
|
+
.getEndpointUrl(args)
|
|
103
|
+
.then(endpoint => utils_1.odata.getAllItems(endpoint))
|
|
104
|
+
.then((items) => {
|
|
105
|
+
return Promise.resolve(items);
|
|
106
|
+
})
|
|
107
|
+
.then((items) => {
|
|
108
|
+
logger.log(items);
|
|
109
|
+
cb();
|
|
110
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_OneNoteNotebookListCommand_instances = new WeakSet(), _OneNoteNotebookListCommand_initTelemetry = function _OneNoteNotebookListCommand_initTelemetry() {
|
|
114
|
+
this.telemetry.push((args) => {
|
|
115
|
+
Object.assign(this.telemetryProperties, {
|
|
116
|
+
joined: args.options.joined
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}, _OneNoteNotebookListCommand_initOptions = function _OneNoteNotebookListCommand_initOptions() {
|
|
120
|
+
this.options.unshift({ option: '--userId [userId]' }, { option: '--userName [userName]' }, { option: '--groupId [groupId]' }, { option: '--groupName [groupName]' }, { option: '-u, --webUrl [webUrl]' });
|
|
121
|
+
}, _OneNoteNotebookListCommand_initValidators = function _OneNoteNotebookListCommand_initValidators() {
|
|
122
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
if (args.options.userId && !utils_1.validation.isValidGuid(args.options.userId)) {
|
|
124
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
125
|
+
}
|
|
126
|
+
if (args.options.groupId && !utils_1.validation.isValidGuid(args.options.groupId)) {
|
|
127
|
+
return `${args.options.groupId} is not a valid GUID`;
|
|
128
|
+
}
|
|
129
|
+
if (args.options.userId && args.options.userName) {
|
|
130
|
+
return 'Specify either userId or userName, but not both';
|
|
131
|
+
}
|
|
132
|
+
if (args.options.groupId && args.options.groupName) {
|
|
133
|
+
return 'Specify either groupId or groupName, but not both';
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
module.exports = new OneNoteNotebookListCommand();
|
|
139
|
+
//# sourceMappingURL=notebook-list.js.map
|
|
@@ -180,6 +180,13 @@ _PlannerTaskGetCommand_instances = new WeakSet(), _PlannerTaskGetCommand_initTel
|
|
|
180
180
|
{ option: '-i, --id [id]' }, { option: '-t, --title [title]' }, { option: '--bucketId [bucketId]' }, { option: '--bucketName [bucketName]' }, { option: '--planId [planId]' }, { option: '--planName [planName]' }, { option: '--planTitle [planTitle]' }, { option: '--ownerGroupId [ownerGroupId]' }, { option: '--ownerGroupName [ownerGroupName]' });
|
|
181
181
|
}, _PlannerTaskGetCommand_initValidators = function _PlannerTaskGetCommand_initValidators() {
|
|
182
182
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
183
|
+
if (args.options.id) {
|
|
184
|
+
if (args.options.bucketId || args.options.bucketName ||
|
|
185
|
+
args.options.planId || args.options.planName || args.options.planTitle ||
|
|
186
|
+
args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
187
|
+
return 'Don\'t specify bucketId, bucketName, planId, planTitle, ownerGroupId or ownerGroupName when using id';
|
|
188
|
+
}
|
|
189
|
+
}
|
|
183
190
|
if (args.options.title && !args.options.bucketId && !args.options.bucketName) {
|
|
184
191
|
return 'Specify either bucketId or bucketName when using title';
|
|
185
192
|
}
|
|
@@ -32,7 +32,7 @@ class SpoHubSiteUnregisterCommand extends SpoCommand_1.default {
|
|
|
32
32
|
return commands_1.default.HUBSITE_UNREGISTER;
|
|
33
33
|
}
|
|
34
34
|
get description() {
|
|
35
|
-
return 'Unregisters the
|
|
35
|
+
return 'Unregisters the specified site collection as a hub site';
|
|
36
36
|
}
|
|
37
37
|
commandAction(logger, args, cb) {
|
|
38
38
|
const unregisterHubSite = () => {
|
|
@@ -193,14 +193,23 @@ _SpoListRoleAssignmentAddCommand_instances = new WeakSet(), _SpoListRoleAssignme
|
|
|
193
193
|
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
194
194
|
return `Specify either list id or title or list url`;
|
|
195
195
|
}
|
|
196
|
+
if (listOptions.filter(item => item !== undefined).length === 0) {
|
|
197
|
+
return `Specify at least list id or title or list url`;
|
|
198
|
+
}
|
|
196
199
|
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
197
200
|
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
198
201
|
return `Specify either principalId id or upn or groupName`;
|
|
199
202
|
}
|
|
203
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
204
|
+
return `Specify at least principalId id or upn or groupName`;
|
|
205
|
+
}
|
|
200
206
|
const roleDefinitionOptions = [args.options.roleDefinitionId, args.options.roleDefinitionName];
|
|
201
207
|
if (roleDefinitionOptions.some(item => item !== undefined) && roleDefinitionOptions.filter(item => item !== undefined).length > 1) {
|
|
202
208
|
return `Specify either roleDefinitionId id or roleDefinitionName`;
|
|
203
209
|
}
|
|
210
|
+
if (roleDefinitionOptions.filter(item => item !== undefined).length === 0) {
|
|
211
|
+
return `Specify at least roleDefinitionId id or roleDefinitionName`;
|
|
212
|
+
}
|
|
204
213
|
return true;
|
|
205
214
|
}));
|
|
206
215
|
};
|
|
@@ -37,36 +37,56 @@ class SpoListRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
|
37
37
|
return 'Removes a role assignment from list permissions';
|
|
38
38
|
}
|
|
39
39
|
commandAction(logger, args, cb) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
.
|
|
64
|
-
|
|
40
|
+
const removeRoleAssignment = () => {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
logger.logToStderr(`Removing role assignment from list in site at ${args.options.webUrl}...`);
|
|
43
|
+
}
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
45
|
+
if (args.options.listId) {
|
|
46
|
+
requestUrl += `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
47
|
+
}
|
|
48
|
+
else if (args.options.listTitle) {
|
|
49
|
+
requestUrl += `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.listUrl) {
|
|
52
|
+
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
53
|
+
requestUrl += `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
54
|
+
}
|
|
55
|
+
if (args.options.upn) {
|
|
56
|
+
this.GetUserPrincipalId(args.options)
|
|
57
|
+
.then((userPrincipalId) => {
|
|
58
|
+
args.options.principalId = userPrincipalId;
|
|
59
|
+
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
60
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
61
|
+
}
|
|
62
|
+
else if (args.options.groupName) {
|
|
63
|
+
this.GetGroupPrincipalId(args.options)
|
|
64
|
+
.then((groupPrincipalId) => {
|
|
65
|
+
args.options.principalId = groupPrincipalId;
|
|
66
|
+
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
67
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
65
70
|
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
66
|
-
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
if (args.options.confirm) {
|
|
74
|
+
removeRoleAssignment();
|
|
67
75
|
}
|
|
68
76
|
else {
|
|
69
|
-
|
|
77
|
+
cli_1.Cli.prompt({
|
|
78
|
+
type: 'confirm',
|
|
79
|
+
name: 'continue',
|
|
80
|
+
default: false,
|
|
81
|
+
message: `Are you sure you want to remove role assignment from list ${args.options.listId || args.options.listTitle} from site ${args.options.webUrl}?`
|
|
82
|
+
}, (result) => {
|
|
83
|
+
if (!result.continue) {
|
|
84
|
+
cb();
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
removeRoleAssignment();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
70
90
|
}
|
|
71
91
|
}
|
|
72
92
|
RemoveRoleAssignment(requestUrl, logger, options, cb) {
|
|
@@ -125,7 +145,8 @@ _SpoListRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoListRoleAssig
|
|
|
125
145
|
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
126
146
|
principalId: typeof args.options.principalId !== 'undefined',
|
|
127
147
|
upn: typeof args.options.upn !== 'undefined',
|
|
128
|
-
groupName: typeof args.options.groupName !== 'undefined'
|
|
148
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
149
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
129
150
|
});
|
|
130
151
|
});
|
|
131
152
|
}, _SpoListRoleAssignmentRemoveCommand_initOptions = function _SpoListRoleAssignmentRemoveCommand_initOptions() {
|
|
@@ -143,6 +164,8 @@ _SpoListRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoListRoleAssig
|
|
|
143
164
|
option: '--upn [upn]'
|
|
144
165
|
}, {
|
|
145
166
|
option: '--groupName [groupName]'
|
|
167
|
+
}, {
|
|
168
|
+
option: '--confirm'
|
|
146
169
|
});
|
|
147
170
|
}, _SpoListRoleAssignmentRemoveCommand_initValidators = function _SpoListRoleAssignmentRemoveCommand_initValidators() {
|
|
148
171
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -160,10 +183,16 @@ _SpoListRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoListRoleAssig
|
|
|
160
183
|
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
161
184
|
return `Specify either list id or title or list url`;
|
|
162
185
|
}
|
|
186
|
+
if (listOptions.filter(item => item !== undefined).length === 0) {
|
|
187
|
+
return `Specify at least list id or title or list url`;
|
|
188
|
+
}
|
|
163
189
|
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
164
190
|
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
165
191
|
return `Specify either principalId id or upn or groupName`;
|
|
166
192
|
}
|
|
193
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
194
|
+
return `Specify at least principalId id or upn or groupName`;
|
|
195
|
+
}
|
|
167
196
|
return true;
|
|
168
197
|
}));
|
|
169
198
|
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoListItemRoleAssignmentRemoveCommand_instances, _SpoListItemRoleAssignmentRemoveCommand_initTelemetry, _SpoListItemRoleAssignmentRemoveCommand_initOptions, _SpoListItemRoleAssignmentRemoveCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const utils_1 = require("../../../../utils");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
24
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
25
|
+
class SpoListItemRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
_SpoListItemRoleAssignmentRemoveCommand_instances.add(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentRemoveCommand_instances, "m", _SpoListItemRoleAssignmentRemoveCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentRemoveCommand_instances, "m", _SpoListItemRoleAssignmentRemoveCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoListItemRoleAssignmentRemoveCommand_instances, "m", _SpoListItemRoleAssignmentRemoveCommand_initValidators).call(this);
|
|
32
|
+
}
|
|
33
|
+
get name() {
|
|
34
|
+
return commands_1.default.LISTITEM_ROLEASSIGNMENT_REMOVE;
|
|
35
|
+
}
|
|
36
|
+
get description() {
|
|
37
|
+
return 'Removes a role assignment from list item permissions';
|
|
38
|
+
}
|
|
39
|
+
commandAction(logger, args, cb) {
|
|
40
|
+
const removeRoleAssignment = () => {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
logger.logToStderr(`Removing role assignment from listitem in site at ${args.options.webUrl}...`);
|
|
43
|
+
}
|
|
44
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
45
|
+
if (args.options.listId) {
|
|
46
|
+
requestUrl += `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
47
|
+
}
|
|
48
|
+
else if (args.options.listTitle) {
|
|
49
|
+
requestUrl += `lists/getByTitle('${utils_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.listUrl) {
|
|
52
|
+
const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
53
|
+
requestUrl += `GetList('${utils_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
54
|
+
}
|
|
55
|
+
requestUrl += `items(${args.options.listItemId})/`;
|
|
56
|
+
if (args.options.upn) {
|
|
57
|
+
this.GetUserPrincipalId(args.options)
|
|
58
|
+
.then((userPrincipalId) => {
|
|
59
|
+
args.options.principalId = userPrincipalId;
|
|
60
|
+
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
61
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
62
|
+
}
|
|
63
|
+
else if (args.options.groupName) {
|
|
64
|
+
this.GetGroupPrincipalId(args.options)
|
|
65
|
+
.then((groupPrincipalId) => {
|
|
66
|
+
args.options.principalId = groupPrincipalId;
|
|
67
|
+
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
68
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.RemoveRoleAssignment(requestUrl, logger, args.options, cb);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
if (args.options.confirm) {
|
|
75
|
+
removeRoleAssignment();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
cli_1.Cli.prompt({
|
|
79
|
+
type: 'confirm',
|
|
80
|
+
name: 'continue',
|
|
81
|
+
default: false,
|
|
82
|
+
message: `Are you sure you want to remove role assignment from listitem ${args.options.listItemId} from list ${args.options.listId || args.options.listTitle} from site ${args.options.webUrl}?`
|
|
83
|
+
}, (result) => {
|
|
84
|
+
if (!result.continue) {
|
|
85
|
+
cb();
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
removeRoleAssignment();
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
RemoveRoleAssignment(requestUrl, logger, options, cb) {
|
|
94
|
+
const requestOptions = {
|
|
95
|
+
url: `${requestUrl}roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: {
|
|
98
|
+
'accept': 'application/json;odata=nometadata',
|
|
99
|
+
'content-type': 'application/json'
|
|
100
|
+
},
|
|
101
|
+
responseType: 'json'
|
|
102
|
+
};
|
|
103
|
+
request_1.default
|
|
104
|
+
.post(requestOptions)
|
|
105
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
106
|
+
}
|
|
107
|
+
GetGroupPrincipalId(options) {
|
|
108
|
+
const groupGetCommandOptions = {
|
|
109
|
+
webUrl: options.webUrl,
|
|
110
|
+
name: options.groupName,
|
|
111
|
+
output: 'json',
|
|
112
|
+
debug: this.debug,
|
|
113
|
+
verbose: this.verbose
|
|
114
|
+
};
|
|
115
|
+
return cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) })
|
|
116
|
+
.then((output) => {
|
|
117
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
118
|
+
return Promise.resolve(getGroupOutput.Id);
|
|
119
|
+
}, (err) => {
|
|
120
|
+
return Promise.reject(err);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
GetUserPrincipalId(options) {
|
|
124
|
+
const userGetCommandOptions = {
|
|
125
|
+
webUrl: options.webUrl,
|
|
126
|
+
email: options.upn,
|
|
127
|
+
id: undefined,
|
|
128
|
+
output: 'json',
|
|
129
|
+
debug: this.debug,
|
|
130
|
+
verbose: this.verbose
|
|
131
|
+
};
|
|
132
|
+
return cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) })
|
|
133
|
+
.then((output) => {
|
|
134
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
135
|
+
return Promise.resolve(getUserOutput.Id);
|
|
136
|
+
}, (err) => {
|
|
137
|
+
return Promise.reject(err);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
_SpoListItemRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoListItemRoleAssignmentRemoveCommand_initTelemetry = function _SpoListItemRoleAssignmentRemoveCommand_initTelemetry() {
|
|
142
|
+
this.telemetry.push((args) => {
|
|
143
|
+
Object.assign(this.telemetryProperties, {
|
|
144
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
145
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
146
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
147
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
148
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
149
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
150
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
}, _SpoListItemRoleAssignmentRemoveCommand_initOptions = function _SpoListItemRoleAssignmentRemoveCommand_initOptions() {
|
|
154
|
+
this.options.unshift({
|
|
155
|
+
option: '-u, --webUrl <webUrl>'
|
|
156
|
+
}, {
|
|
157
|
+
option: '-i, --listId [listId]'
|
|
158
|
+
}, {
|
|
159
|
+
option: '-t, --listTitle [listTitle]'
|
|
160
|
+
}, {
|
|
161
|
+
option: '--listUrl [listUrl]'
|
|
162
|
+
}, {
|
|
163
|
+
option: '--listItemId <listItemId>'
|
|
164
|
+
}, {
|
|
165
|
+
option: '--principalId [principalId]'
|
|
166
|
+
}, {
|
|
167
|
+
option: '--upn [upn]'
|
|
168
|
+
}, {
|
|
169
|
+
option: '--groupName [groupName]'
|
|
170
|
+
}, {
|
|
171
|
+
option: '--confirm'
|
|
172
|
+
});
|
|
173
|
+
}, _SpoListItemRoleAssignmentRemoveCommand_initValidators = function _SpoListItemRoleAssignmentRemoveCommand_initValidators() {
|
|
174
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
176
|
+
if (isValidSharePointUrl !== true) {
|
|
177
|
+
return isValidSharePointUrl;
|
|
178
|
+
}
|
|
179
|
+
if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
|
|
180
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
181
|
+
}
|
|
182
|
+
if (args.options.listItemId && isNaN(args.options.listItemId)) {
|
|
183
|
+
return `Specified listItemId ${args.options.listItemId} is not a number`;
|
|
184
|
+
}
|
|
185
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
186
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
187
|
+
}
|
|
188
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
189
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
190
|
+
return `Specify either list id or title or list url`;
|
|
191
|
+
}
|
|
192
|
+
if (listOptions.filter(item => item !== undefined).length === 0) {
|
|
193
|
+
return `Specify at least list id or title or list url`;
|
|
194
|
+
}
|
|
195
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
196
|
+
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
197
|
+
return `Specify either principalId id or upn or groupName`;
|
|
198
|
+
}
|
|
199
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
200
|
+
return `Specify at least principalId id or upn or groupName`;
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
}));
|
|
204
|
+
};
|
|
205
|
+
module.exports = new SpoListItemRoleAssignmentRemoveCommand();
|
|
206
|
+
//# sourceMappingURL=listitem-roleassignment-remove.js.map
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoWebRoleAssignmentAddCommand_instances, _SpoWebRoleAssignmentAddCommand_initTelemetry, _SpoWebRoleAssignmentAddCommand_initOptions, _SpoWebRoleAssignmentAddCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const utils_1 = require("../../../../utils");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
24
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
25
|
+
const SpoRoleDefinitionListCommand = require("../roledefinition/roledefinition-list");
|
|
26
|
+
class SpoWebRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
_SpoWebRoleAssignmentAddCommand_instances.add(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentAddCommand_instances, "m", _SpoWebRoleAssignmentAddCommand_initTelemetry).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentAddCommand_instances, "m", _SpoWebRoleAssignmentAddCommand_initOptions).call(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentAddCommand_instances, "m", _SpoWebRoleAssignmentAddCommand_initValidators).call(this);
|
|
33
|
+
}
|
|
34
|
+
get name() {
|
|
35
|
+
return commands_1.default.WEB_ROLEASSIGNMENT_ADD;
|
|
36
|
+
}
|
|
37
|
+
get description() {
|
|
38
|
+
return 'Adds a role assignment to web';
|
|
39
|
+
}
|
|
40
|
+
commandAction(logger, args, cb) {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
logger.logToStderr(`Adding role assignment to web ${args.options.webUrl}...`);
|
|
43
|
+
}
|
|
44
|
+
this.GetRoleDefinitionId(args.options)
|
|
45
|
+
.then((roleDefinitionId) => {
|
|
46
|
+
args.options.roleDefinitionId = roleDefinitionId;
|
|
47
|
+
if (args.options.upn) {
|
|
48
|
+
this.GetUserPrincipalId(args.options)
|
|
49
|
+
.then((userPrincipalId) => {
|
|
50
|
+
args.options.principalId = userPrincipalId;
|
|
51
|
+
this.AddRoleAssignment(logger, args.options, cb);
|
|
52
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
53
|
+
}
|
|
54
|
+
else if (args.options.groupName) {
|
|
55
|
+
this.GetGroupPrincipalId(args.options)
|
|
56
|
+
.then((groupPrincipalId) => {
|
|
57
|
+
args.options.principalId = groupPrincipalId;
|
|
58
|
+
this.AddRoleAssignment(logger, args.options, cb);
|
|
59
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.AddRoleAssignment(logger, args.options, cb);
|
|
63
|
+
}
|
|
64
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
65
|
+
}
|
|
66
|
+
AddRoleAssignment(logger, options, cb) {
|
|
67
|
+
const requestOptions = {
|
|
68
|
+
url: `${options.webUrl}/_api/web/roleassignments/addroleassignment(principalid='${options.principalId}',roledefid='${options.roleDefinitionId}')`,
|
|
69
|
+
method: 'POST',
|
|
70
|
+
headers: {
|
|
71
|
+
'accept': 'application/json;odata=nometadata',
|
|
72
|
+
'content-type': 'application/json'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
request_1.default
|
|
77
|
+
.post(requestOptions)
|
|
78
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
79
|
+
}
|
|
80
|
+
GetRoleDefinitionId(options) {
|
|
81
|
+
if (!options.roleDefinitionName) {
|
|
82
|
+
return Promise.resolve(options.roleDefinitionId);
|
|
83
|
+
}
|
|
84
|
+
const roleDefinitionListCommandOptions = {
|
|
85
|
+
webUrl: options.webUrl,
|
|
86
|
+
output: 'json',
|
|
87
|
+
debug: this.debug,
|
|
88
|
+
verbose: this.verbose
|
|
89
|
+
};
|
|
90
|
+
return cli_1.Cli.executeCommandWithOutput(SpoRoleDefinitionListCommand, { options: Object.assign(Object.assign({}, roleDefinitionListCommandOptions), { _: [] }) })
|
|
91
|
+
.then((output) => {
|
|
92
|
+
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
93
|
+
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
94
|
+
return Promise.resolve(roleDefinitionId);
|
|
95
|
+
}, (err) => {
|
|
96
|
+
return Promise.reject(err);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
GetGroupPrincipalId(options) {
|
|
100
|
+
const groupGetCommandOptions = {
|
|
101
|
+
webUrl: options.webUrl,
|
|
102
|
+
name: options.groupName,
|
|
103
|
+
output: 'json',
|
|
104
|
+
debug: this.debug,
|
|
105
|
+
verbose: this.verbose
|
|
106
|
+
};
|
|
107
|
+
return cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) })
|
|
108
|
+
.then((output) => {
|
|
109
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
110
|
+
return Promise.resolve(getGroupOutput.Id);
|
|
111
|
+
}, (err) => {
|
|
112
|
+
return Promise.reject(err);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
GetUserPrincipalId(options) {
|
|
116
|
+
const userGetCommandOptions = {
|
|
117
|
+
webUrl: options.webUrl,
|
|
118
|
+
email: options.upn,
|
|
119
|
+
id: undefined,
|
|
120
|
+
output: 'json',
|
|
121
|
+
debug: this.debug,
|
|
122
|
+
verbose: this.verbose
|
|
123
|
+
};
|
|
124
|
+
return cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) })
|
|
125
|
+
.then((output) => {
|
|
126
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
127
|
+
return Promise.resolve(getUserOutput.Id);
|
|
128
|
+
}, (err) => {
|
|
129
|
+
return Promise.reject(err);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
_SpoWebRoleAssignmentAddCommand_instances = new WeakSet(), _SpoWebRoleAssignmentAddCommand_initTelemetry = function _SpoWebRoleAssignmentAddCommand_initTelemetry() {
|
|
134
|
+
this.telemetry.push((args) => {
|
|
135
|
+
Object.assign(this.telemetryProperties, {
|
|
136
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
137
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
138
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
139
|
+
roleDefinitionId: typeof args.options.roleDefinitionId !== 'undefined',
|
|
140
|
+
roleDefinitionName: typeof args.options.roleDefinitionName !== 'undefined'
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
}, _SpoWebRoleAssignmentAddCommand_initOptions = function _SpoWebRoleAssignmentAddCommand_initOptions() {
|
|
144
|
+
this.options.unshift({
|
|
145
|
+
option: '-u, --webUrl <webUrl>'
|
|
146
|
+
}, {
|
|
147
|
+
option: '--principalId [principalId]'
|
|
148
|
+
}, {
|
|
149
|
+
option: '--upn [upn]'
|
|
150
|
+
}, {
|
|
151
|
+
option: '--groupName [groupName]'
|
|
152
|
+
}, {
|
|
153
|
+
option: '--roleDefinitionId [roleDefinitionId]'
|
|
154
|
+
}, {
|
|
155
|
+
option: '--roleDefinitionName [roleDefinitionName]'
|
|
156
|
+
});
|
|
157
|
+
}, _SpoWebRoleAssignmentAddCommand_initValidators = function _SpoWebRoleAssignmentAddCommand_initValidators() {
|
|
158
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
160
|
+
if (isValidSharePointUrl !== true) {
|
|
161
|
+
return isValidSharePointUrl;
|
|
162
|
+
}
|
|
163
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
164
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
165
|
+
}
|
|
166
|
+
if (args.options.roleDefinitionId && isNaN(args.options.roleDefinitionId)) {
|
|
167
|
+
return `Specified roleDefinitionId ${args.options.roleDefinitionId} is not a number`;
|
|
168
|
+
}
|
|
169
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
170
|
+
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
171
|
+
return `Specify either principalId id or upn or groupName`;
|
|
172
|
+
}
|
|
173
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
174
|
+
return `Specify at least principalId id or upn or groupName`;
|
|
175
|
+
}
|
|
176
|
+
const roleDefinitionOptions = [args.options.roleDefinitionId, args.options.roleDefinitionName];
|
|
177
|
+
if (roleDefinitionOptions.some(item => item !== undefined) && roleDefinitionOptions.filter(item => item !== undefined).length > 1) {
|
|
178
|
+
return `Specify either roleDefinitionId id or roleDefinitionName`;
|
|
179
|
+
}
|
|
180
|
+
if (roleDefinitionOptions.filter(item => item !== undefined).length === 0) {
|
|
181
|
+
return `Specify at least roleDefinitionId id or roleDefinitionName`;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}));
|
|
185
|
+
};
|
|
186
|
+
module.exports = new SpoWebRoleAssignmentAddCommand();
|
|
187
|
+
//# sourceMappingURL=web-roleassignment-add.js.map
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoWebRoleAssignmentRemoveCommand_instances, _SpoWebRoleAssignmentRemoveCommand_initTelemetry, _SpoWebRoleAssignmentRemoveCommand_initOptions, _SpoWebRoleAssignmentRemoveCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const cli_1 = require("../../../../cli");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const utils_1 = require("../../../../utils");
|
|
21
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
22
|
+
const commands_1 = require("../../commands");
|
|
23
|
+
const SpoUserGetCommand = require("../user/user-get");
|
|
24
|
+
const SpoGroupGetCommand = require("../group/group-get");
|
|
25
|
+
class SpoWebRoleAssignmentRemoveCommand extends SpoCommand_1.default {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
_SpoWebRoleAssignmentRemoveCommand_instances.add(this);
|
|
29
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentRemoveCommand_instances, "m", _SpoWebRoleAssignmentRemoveCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentRemoveCommand_instances, "m", _SpoWebRoleAssignmentRemoveCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoWebRoleAssignmentRemoveCommand_instances, "m", _SpoWebRoleAssignmentRemoveCommand_initValidators).call(this);
|
|
32
|
+
}
|
|
33
|
+
get name() {
|
|
34
|
+
return commands_1.default.WEB_ROLEASSIGNMENT_REMOVE;
|
|
35
|
+
}
|
|
36
|
+
get description() {
|
|
37
|
+
return 'Removes a role assignment from web permissions';
|
|
38
|
+
}
|
|
39
|
+
commandAction(logger, args, cb) {
|
|
40
|
+
const removeRoleAssignment = () => {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
logger.logToStderr(`Removing role assignment from web ${args.options.webUrl}...`);
|
|
43
|
+
}
|
|
44
|
+
if (args.options.upn) {
|
|
45
|
+
this.GetUserPrincipalId(args.options)
|
|
46
|
+
.then((userPrincipalId) => {
|
|
47
|
+
args.options.principalId = userPrincipalId;
|
|
48
|
+
this.RemoveRoleAssignment(logger, args.options, cb);
|
|
49
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
50
|
+
}
|
|
51
|
+
else if (args.options.groupName) {
|
|
52
|
+
this.GetGroupPrincipalId(args.options)
|
|
53
|
+
.then((groupPrincipalId) => {
|
|
54
|
+
args.options.principalId = groupPrincipalId;
|
|
55
|
+
this.RemoveRoleAssignment(logger, args.options, cb);
|
|
56
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
this.RemoveRoleAssignment(logger, args.options, cb);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
if (args.options.confirm) {
|
|
63
|
+
removeRoleAssignment();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
cli_1.Cli.prompt({
|
|
67
|
+
type: 'confirm',
|
|
68
|
+
name: 'continue',
|
|
69
|
+
default: false,
|
|
70
|
+
message: `Are you sure you want to remove role assignment from web ${args.options.webUrl}?`
|
|
71
|
+
}, (result) => {
|
|
72
|
+
if (!result.continue) {
|
|
73
|
+
cb();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
removeRoleAssignment();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
RemoveRoleAssignment(logger, options, cb) {
|
|
82
|
+
const requestOptions = {
|
|
83
|
+
url: `${options.webUrl}/_api/web/roleassignments/removeroleassignment(principalid='${options.principalId}')`,
|
|
84
|
+
method: 'POST',
|
|
85
|
+
headers: {
|
|
86
|
+
'accept': 'application/json;odata=nometadata',
|
|
87
|
+
'content-type': 'application/json'
|
|
88
|
+
},
|
|
89
|
+
responseType: 'json'
|
|
90
|
+
};
|
|
91
|
+
request_1.default
|
|
92
|
+
.post(requestOptions)
|
|
93
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
94
|
+
}
|
|
95
|
+
GetGroupPrincipalId(options) {
|
|
96
|
+
const groupGetCommandOptions = {
|
|
97
|
+
webUrl: options.webUrl,
|
|
98
|
+
name: options.groupName,
|
|
99
|
+
output: 'json',
|
|
100
|
+
debug: this.debug,
|
|
101
|
+
verbose: this.verbose
|
|
102
|
+
};
|
|
103
|
+
return cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) })
|
|
104
|
+
.then((output) => {
|
|
105
|
+
const getGroupOutput = JSON.parse(output.stdout);
|
|
106
|
+
return Promise.resolve(getGroupOutput.Id);
|
|
107
|
+
}, (err) => {
|
|
108
|
+
return Promise.reject(err);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
GetUserPrincipalId(options) {
|
|
112
|
+
const userGetCommandOptions = {
|
|
113
|
+
webUrl: options.webUrl,
|
|
114
|
+
email: options.upn,
|
|
115
|
+
id: undefined,
|
|
116
|
+
output: 'json',
|
|
117
|
+
debug: this.debug,
|
|
118
|
+
verbose: this.verbose
|
|
119
|
+
};
|
|
120
|
+
return cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) })
|
|
121
|
+
.then((output) => {
|
|
122
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
123
|
+
return Promise.resolve(getUserOutput.Id);
|
|
124
|
+
}, (err) => {
|
|
125
|
+
return Promise.reject(err);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
_SpoWebRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoWebRoleAssignmentRemoveCommand_initTelemetry = function _SpoWebRoleAssignmentRemoveCommand_initTelemetry() {
|
|
130
|
+
this.telemetry.push((args) => {
|
|
131
|
+
Object.assign(this.telemetryProperties, {
|
|
132
|
+
principalId: typeof args.options.principalId !== 'undefined',
|
|
133
|
+
upn: typeof args.options.upn !== 'undefined',
|
|
134
|
+
groupName: typeof args.options.groupName !== 'undefined',
|
|
135
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}, _SpoWebRoleAssignmentRemoveCommand_initOptions = function _SpoWebRoleAssignmentRemoveCommand_initOptions() {
|
|
139
|
+
this.options.unshift({
|
|
140
|
+
option: '-u, --webUrl <webUrl>'
|
|
141
|
+
}, {
|
|
142
|
+
option: '--principalId [principalId]'
|
|
143
|
+
}, {
|
|
144
|
+
option: '--upn [upn]'
|
|
145
|
+
}, {
|
|
146
|
+
option: '--groupName [groupName]'
|
|
147
|
+
}, {
|
|
148
|
+
option: '--confirm'
|
|
149
|
+
});
|
|
150
|
+
}, _SpoWebRoleAssignmentRemoveCommand_initValidators = function _SpoWebRoleAssignmentRemoveCommand_initValidators() {
|
|
151
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
153
|
+
if (isValidSharePointUrl !== true) {
|
|
154
|
+
return isValidSharePointUrl;
|
|
155
|
+
}
|
|
156
|
+
if (args.options.principalId && isNaN(args.options.principalId)) {
|
|
157
|
+
return `Specified principalId ${args.options.principalId} is not a number`;
|
|
158
|
+
}
|
|
159
|
+
const principalOptions = [args.options.principalId, args.options.upn, args.options.groupName];
|
|
160
|
+
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) {
|
|
161
|
+
return `Specify either principalId id or upn or groupName`;
|
|
162
|
+
}
|
|
163
|
+
if (principalOptions.filter(item => item !== undefined).length === 0) {
|
|
164
|
+
return `Specify at least principalId id or upn or groupName`;
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
}));
|
|
168
|
+
};
|
|
169
|
+
module.exports = new SpoWebRoleAssignmentRemoveCommand();
|
|
170
|
+
//# sourceMappingURL=web-roleassignment-remove.js.map
|
|
@@ -128,6 +128,7 @@ exports.default = {
|
|
|
128
128
|
LISTITEM_RECORD_DECLARE: `${prefix} listitem record declare`,
|
|
129
129
|
LISTITEM_RECORD_UNDECLARE: `${prefix} listitem record undeclare`,
|
|
130
130
|
LISTITEM_REMOVE: `${prefix} listitem remove`,
|
|
131
|
+
LISTITEM_ROLEASSIGNMENT_REMOVE: `${prefix} listitem roleassignment remove`,
|
|
131
132
|
LISTITEM_ROLEINHERITANCE_BREAK: `${prefix} listitem roleinheritance break`,
|
|
132
133
|
LISTITEM_ROLEINHERITANCE_RESET: `${prefix} listitem roleinheritance reset`,
|
|
133
134
|
LISTITEM_SET: `${prefix} listitem set`,
|
|
@@ -270,6 +271,8 @@ exports.default = {
|
|
|
270
271
|
WEB_LIST: `${prefix} web list`,
|
|
271
272
|
WEB_REINDEX: `${prefix} web reindex`,
|
|
272
273
|
WEB_REMOVE: `${prefix} web remove`,
|
|
274
|
+
WEB_ROLEASSIGNMENT_REMOVE: `${prefix} web roleassignment remove`,
|
|
275
|
+
WEB_ROLEASSIGNMENT_ADD: `${prefix} web roleassignment add`,
|
|
273
276
|
WEB_ROLEINHERITANCE_RESET: `${prefix} web roleinheritance reset`,
|
|
274
277
|
WEB_SET: `${prefix} web set`
|
|
275
278
|
};
|
|
@@ -116,23 +116,3 @@ Send custom card with card data
|
|
|
116
116
|
```sh
|
|
117
117
|
m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --card '{"type":"AdaptiveCard","body":[{"type":"TextBlock","size":"Medium","weight":"Bolder","text":"${title}"},{"type":"TextBlock","text":"${description}","wrap":true},{"type":"FactSet","facts":[{"$data":"${properties}","title":"${key}:","value":"${value}"}]}],"actions":[{"type":"Action.OpenUrl","title":"View","url":"${viewUrl}"}],"$schema":"http://adaptivecards.io/schemas/adaptive-card.json","version":"1.2"}' --cardData '{"title":"Publish Adaptive Card Schema","description":"Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.","creator":{"name":"Matt Hidinger","profileImage":"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg"},"createdUtc":"2017-02-14T06:08:39Z","viewUrl":"https://adaptivecards.io","properties":[{"key":"Board","value":"Adaptive Cards"},{"key":"List","value":"Backlog"},{"key":"Assigned to","value":"Matt Hidinger"},{"key":"Due date","value":"Not set"}]}'
|
|
118
118
|
```
|
|
119
|
-
|
|
120
|
-
## Examples for PowerShell
|
|
121
|
-
|
|
122
|
-
Send custom card with all known options merged
|
|
123
|
-
|
|
124
|
-
```powershell
|
|
125
|
-
m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --card "{\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"${title}\"},{\"type\":\"TextBlock\",\"text\":\"${description}\",\"wrap\":true},{\"type\":\"FactSet\",\"facts\":[{\"$data\":\"${properties}\",\"title\":\"${key}:\",\"value\":\"${value}\"}]}],\"actions\":[{\"type\":\"Action.OpenUrl\",\"title\":\"View\",\"url\":\"${actionUrl}\"}],\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.2\"}" --title "CLI for Microsoft 365 v3.4" --description "New release of CLI for Microsoft 365" --imageUrl "https://contoso.com/image.gif" --actionUrl "https://aka.ms/cli-m365"
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Send custom card with unknown option merged
|
|
129
|
-
|
|
130
|
-
```powershell
|
|
131
|
-
m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --card "{\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"${Title}\"}],\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.2\"}" --Title "CLI for Microsoft 365 v3.4"
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Send custom card with card data
|
|
135
|
-
|
|
136
|
-
```powershell
|
|
137
|
-
m365 adaptivecard send --url https://contoso.webhook.office.com/webhookb2/892e8ed3-997c-4b6e-8f8a-7f32728a8a87@f7322380-f203-42ff-93e8-66e266f6d2e4/IncomingWebhook/fcc6565ec7a944928bd43d6fc193b258/4f0482d4-b147-4f67-8a61-11f0a5019547 --card "{\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"${title}\"},{\"type\":\"TextBlock\",\"text\":\"${description}\",\"wrap\":true},{\"type\":\"FactSet\",\"facts\":[{\"$data\":\"${properties}\",\"title\":\"${key}:\",\"value\":\"${value}\"}]}],\"actions\":[{\"type\":\"Action.OpenUrl\",\"title\":\"View\",\"url\":\"${viewUrl}\"}],\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.2\"}" --cardData "{\"title\":\"Publish Adaptive Card Schema\",\"description\":\"Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.\",\"creator\":{\"name\":\"Matt Hidinger\",\"profileImage\":\"https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg\"},\"createdUtc\":\"2017-02-14T06:08:39Z\",\"viewUrl\":\"https://adaptivecards.io\",\"properties\":[{\"key\":\"Board\",\"value\":\"Adaptive Cards\"},{\"key\":\"List\",\"value\":\"Backlog\"},{\"key\":\"Assigned to\",\"value\":\"Matt Hidinger\"},{\"key\":\"Due date\",\"value\":\"Not set\"}]}"
|
|
138
|
-
```
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# onenote notebook list
|
|
2
|
+
|
|
3
|
+
Retrieve a list of notebooks.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 onenote notebook list [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`--userId [userId]`
|
|
14
|
+
: Id of the user. Use either userId or userName, but not both.
|
|
15
|
+
|
|
16
|
+
`--userName [userName]`
|
|
17
|
+
: Name of the user. Use either userId or userName, but not both.
|
|
18
|
+
|
|
19
|
+
`--groupId [groupId]`
|
|
20
|
+
: Id of the SharePoint group. Use either groupName or groupId, but not both
|
|
21
|
+
|
|
22
|
+
`--groupName [groupName]`
|
|
23
|
+
: Name of the SharePoint group. Use either groupName or groupId, but not both.
|
|
24
|
+
|
|
25
|
+
`-u, --webUrl [webUrl]`
|
|
26
|
+
: URL of the SharePoint site.
|
|
27
|
+
|
|
28
|
+
--8<-- "docs/cmd/_global.md"
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
List Microsoft OneNote notebooks for the currently logged in user
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
m365 onenote notebook list
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
List Microsoft OneNote notebooks in group 233e43d0-dc6a-482e-9b4e-0de7a7bce9b4
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
m365 onenote notebook list --groupId 233e43d0-dc6a-482e-9b4e-0de7a7bce9b4
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
List Microsoft OneNote notebooks in group My Group
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
m365 onenote notebook list --groupName "MyGroup"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
List Microsoft OneNote notebooks for user user1@contoso.onmicrosoft.com
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
m365 onenote notebook list --userName user1@contoso.onmicrosoft.com
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
List Microsoft OneNote notebooks for user 2609af39-7775-4f94-a3dc-0dd67657e900
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
m365 onenote notebook list --userId 2609af39-7775-4f94-a3dc-0dd67657e900
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
List Microsoft OneNote notebooks for site https://contoso.sharepoint.com/sites/testsite
|
|
63
|
+
|
|
64
|
+
```sh
|
|
65
|
+
m365 onenote notebook list --webUrl https://contoso.sharepoint.com/sites/testsite
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## More information
|
|
69
|
+
|
|
70
|
+
- List notebooks (MS Graph docs): [https://docs.microsoft.com/en-us/graph/api/onenote-list-notebooks?view=graph-rest-1.0&tabs=http](https://docs.microsoft.com/en-us/graph/api/onenote-list-notebooks?view=graph-rest-1.0&tabs=http)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# spo hubsite unregister
|
|
2
2
|
|
|
3
|
-
Unregisters the
|
|
3
|
+
Unregisters the specified site collection as a hub site
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -33,7 +33,7 @@ Unregister the site collection with URL _https://contoso.sharepoint.com/sites/sa
|
|
|
33
33
|
m365 spo hubsite unregister --url https://contoso.sharepoint.com/sites/sales
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
Unregister the site collection with URL _https://contoso.sharepoint.com/sites/sales_ as a hub site without prompting for confirmation
|
|
36
|
+
Unregister the site collection with URL _https://contoso.sharepoint.com/sites/sales_ as a hub site without prompting for confirmation.
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
39
|
m365 spo hubsite unregister --url https://contoso.sharepoint.com/sites/sales --confirm
|
|
@@ -31,6 +31,9 @@ m365 spo list roleassignment remove [options]
|
|
|
31
31
|
`--groupName [groupName]`
|
|
32
32
|
: enter group name of Azure AD or SharePoint group. Specify either groupName or princpialId.
|
|
33
33
|
|
|
34
|
+
`--confirm`
|
|
35
|
+
: Don't prompt for confirming removing the role assignment
|
|
36
|
+
|
|
34
37
|
--8<-- "docs/cmd/_global.md"
|
|
35
38
|
|
|
36
39
|
## Examples
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# spo listitem roleassignment remove
|
|
2
|
+
|
|
3
|
+
Removes a role assignment to a listitem.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo listitem roleassignment remove [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: URL of the site where the listitem is located
|
|
15
|
+
|
|
16
|
+
`-i, --listId [listId]`
|
|
17
|
+
: ID of the list. Specify either listId, listTitle or listUrl but not multiple.
|
|
18
|
+
|
|
19
|
+
`-t, --listTitle [listTitle]`
|
|
20
|
+
: Title of the list. Specify either listId, listTitle or listUrl but not multiple.
|
|
21
|
+
|
|
22
|
+
`--listUrl [listUrl]`
|
|
23
|
+
: Relative URL of the list. Specify either listId, listTitle or listUrl but not multiple.
|
|
24
|
+
|
|
25
|
+
`--listItemId <listItemId>`
|
|
26
|
+
: Id of the listitem to remove the role from.
|
|
27
|
+
|
|
28
|
+
`--principalId [principalId]`
|
|
29
|
+
: SharePoint ID of principal it may be either user id or group id we want to remove permissions Specify principalId only when upn or groupName are not used.
|
|
30
|
+
|
|
31
|
+
`--upn [upn]`
|
|
32
|
+
: upn/email of user. Specify either upn or princpialId.
|
|
33
|
+
|
|
34
|
+
`--groupName [groupName]`
|
|
35
|
+
: enter group name of Azure AD or SharePoint group. Specify either groupName or princpialId.
|
|
36
|
+
|
|
37
|
+
`--confirm`
|
|
38
|
+
: Don't prompt for confirming removing the role assignment
|
|
39
|
+
|
|
40
|
+
--8<-- "docs/cmd/_global.md"
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
Remove roleassignment from listitem getting list by title based on group name
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listTitle "someList" --listItemId 1 --groupName "saleGroup"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Remove roleassignment from listitem getting list by title based on principal Id
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listTitle "Events" --listItemId 1 --principalId 2
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Remove roleassignment from listitem getting list by url based on principal Id
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listUrl '/sites/contoso-sales/lists/Events' --listItemId 1 --principalId 2
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Remove roleassignment from listitem getting list by url based on principal Id without prompting for confirmation
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
m365 spo listitem roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --listUrl '/sites/contoso-sales/lists/Events' --listItemId 1 --principalId 2 --confirm
|
|
67
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# spo web roleassignment add
|
|
2
|
+
|
|
3
|
+
Adds a role assignment to web permissions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo web roleassignment add [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: URL of the site
|
|
15
|
+
|
|
16
|
+
`--principalId [principalId]`
|
|
17
|
+
: SharePoint ID of principal it may be either user id or group id we want to add permissions to. Specify principalId only when upn or groupName are not used.
|
|
18
|
+
|
|
19
|
+
`--upn [upn]`
|
|
20
|
+
: upn/email of user to assign role to. Specify either upn or princpialId
|
|
21
|
+
|
|
22
|
+
`--groupName [groupName]`
|
|
23
|
+
: enter group name of Azure AD or SharePoint group.. Specify either groupName or princpialId
|
|
24
|
+
|
|
25
|
+
`--roleDefinitionId [roleDefinitionId]`
|
|
26
|
+
: ID of role definition. Specify either roleDefinitionId or roleDefinitionName but not both
|
|
27
|
+
|
|
28
|
+
`--roleDefinitionName [roleDefinitionName]`
|
|
29
|
+
: enter the name of a role definition, like 'Contribute', 'Read', etc. Specify either roleDefinitionId or roleDefinitionName but not both
|
|
30
|
+
|
|
31
|
+
--8<-- "docs/cmd/_global.md"
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
add role assignment to site _https://contoso.sharepoint.com/sites/project-x_for principal id _11_ and role definition id _1073741829_
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --principalId 11 --roleDefinitionId 1073741829
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
add role assignment to site _https://contoso.sharepoint.com/sites/project-x_for upn _someaccount@tenant.onmicrosoft.com_ and role definition id _1073741829_
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --upn "someaccount@tenant.onmicrosoft.com" --roleDefinitionId 1073741829
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
add role assignment to site _https://contoso.sharepoint.com/sites/project-x_for group _someGroup_ and role definition id _1073741829_
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --groupName "someGroup" --roleDefinitionId 1073741829
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
add role assignment to site _https://contoso.sharepoint.com/sites/project-x_for principal id _11_ and role definition name _Full Control_
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
m365 spo list roleassignment add --webUrl "https://contoso.sharepoint.com/sites/project-x" --principalId 11 --roleDefinitionName "Full Control"
|
|
57
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# spo web roleassignment remove
|
|
2
|
+
|
|
3
|
+
Removes a role assignment from web permissions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo web roleassignment remove [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: URL of the site
|
|
15
|
+
|
|
16
|
+
`--principalId [principalId]`
|
|
17
|
+
: SharePoint ID of principal it may be either user id or group id we want to add permissions to. Specify principalId only when upn or groupName are not used.
|
|
18
|
+
|
|
19
|
+
`--upn [upn]`
|
|
20
|
+
: Upn/email of user to assign role to. Specify upn only when principalId or groupName are not used.
|
|
21
|
+
|
|
22
|
+
`--groupName [groupName]`
|
|
23
|
+
: Enter group name of Azure AD or SharePoint group. Specify groupName only when principalId or upn are not used.
|
|
24
|
+
|
|
25
|
+
`--confirm [confirm]`
|
|
26
|
+
: Don't prompt for confirming removing the roleassignment.
|
|
27
|
+
|
|
28
|
+
--8<-- "docs/cmd/_global.md"
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
Remove roleassignment from web based on group name
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
m365 spo list roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --groupName "saleGroup"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Remove roleassignment from web based on principal Id
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
m365 spo list roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --principalId 2
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Remove roleassignment from web based on upn
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
m365 spo list roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --upn "someaccount@tenant.onmicrosoft.com"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Remove roleassignment from web based on principal Id without prompting for confirmation
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
m365 spo list roleassignment remove --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --principalId 2 --confirm
|
|
54
|
+
```
|
package/package.json
CHANGED