gd-sprest 6.8.9 → 6.9.2
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/.github/workflows/build.yml +4 -2
- package/@types/helper/index.d.ts +8 -1
- package/@types/helper/methods/addPermissionLevel.d.ts +1 -0
- package/@types/helper/methods/copyPermissionLevel.d.ts +23 -0
- package/@types/helper/methods/index.d.ts +1 -0
- package/@types/helper/spCfg.d.ts +6 -0
- package/build/helper/methods/addPermissionLevel.js +1 -1
- package/build/helper/methods/copyPermissionLevel.js +69 -0
- package/build/helper/methods/index.js +1 -0
- package/build/helper/spCfg.js +2 -0
- package/build/rest.js +1 -1
- package/dist/gd-sprest.d.ts +56 -15
- package/dist/gd-sprest.js +15 -4
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +1 -1
|
@@ -7,19 +7,21 @@ jobs:
|
|
|
7
7
|
runs-on: ubuntu-latest
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
|
-
node-version: [
|
|
10
|
+
node-version: [14.x]
|
|
11
11
|
steps:
|
|
12
12
|
- uses: actions/checkout@v2
|
|
13
|
+
|
|
13
14
|
- name: Use Node.js ${{ env.node-version }}
|
|
14
15
|
uses: actions/setup-node@v1
|
|
15
16
|
with:
|
|
16
17
|
node-version: ${{ env.node-version }}
|
|
18
|
+
|
|
17
19
|
- name: Build Library using NodeJS ${{ env.node-version }}
|
|
18
20
|
run: |
|
|
19
|
-
# Build the project
|
|
20
21
|
npm install
|
|
21
22
|
npm run all
|
|
22
23
|
npm run test --if-present
|
|
24
|
+
|
|
23
25
|
- name: Build Artifacts
|
|
24
26
|
uses: actions/upload-artifact@v1
|
|
25
27
|
with:
|
package/@types/helper/index.d.ts
CHANGED
|
@@ -4,7 +4,11 @@ import { IJSLink } from "./jslink";
|
|
|
4
4
|
import { IRibbonLink, ISuiteBarLink, ILinkInfo } from "./linkInfo";
|
|
5
5
|
import { IListForm } from "./listForm";
|
|
6
6
|
import { IListFormField } from "./listFormField";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
IRequest, IaddContentEditorWebPart, IaddPermissionLevel, IaddScriptEditorWebPart, IcopyPermissionLevel,
|
|
9
|
+
IcreateContentType, IcreateDocSet, IhasPermissions, IloadSPCore, Iparse, Irequest, IsetContentTypeFields,
|
|
10
|
+
IsetGroupOwner
|
|
11
|
+
} from "./methods";
|
|
8
12
|
import { ISPComponents } from "./sp";
|
|
9
13
|
import { ISPConfig, ISPConfigProps, IFieldInfo } from "./spCfg";
|
|
10
14
|
import { ISPCfgFieldType, ISPCfgType } from "./spCfgTypes";
|
|
@@ -35,10 +39,13 @@ export interface IHelper {
|
|
|
35
39
|
/** Methods */
|
|
36
40
|
|
|
37
41
|
addContentEditorWebPart: IaddContentEditorWebPart,
|
|
42
|
+
addPermissionLevel: IaddPermissionLevel,
|
|
38
43
|
addScriptEditorWebPart: IaddScriptEditorWebPart,
|
|
44
|
+
copyPermissionLevel: IcopyPermissionLevel,
|
|
39
45
|
createContentType: IcreateContentType,
|
|
40
46
|
createDocSet: IcreateDocSet,
|
|
41
47
|
hasPermissions: IhasPermissions,
|
|
48
|
+
loadSPCore: IloadSPCore,
|
|
42
49
|
parse: Iparse,
|
|
43
50
|
request: Irequest,
|
|
44
51
|
setContentTypeFields: IsetContentTypeFields,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RoleDefinition, RoleDefinitionCreationInformation } from "gd-sprest-def/lib/SP";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Properties
|
|
5
|
+
*/
|
|
6
|
+
export interface IcopyPermissionLevelProps extends RoleDefinitionCreationInformation {
|
|
7
|
+
AddPermissions?: Array<number>;
|
|
8
|
+
Description: string;
|
|
9
|
+
BasePermission: string;
|
|
10
|
+
Order?: number;
|
|
11
|
+
Name: string;
|
|
12
|
+
RemovePermissions?: Array<number>;
|
|
13
|
+
WebUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Copies a permission level to the current or specified web.
|
|
18
|
+
* @props properties
|
|
19
|
+
*/
|
|
20
|
+
export const copyPermissionLevel: IcopyPermissionLevel;
|
|
21
|
+
export interface IcopyPermissionLevel {
|
|
22
|
+
(props: IcopyPermissionLevelProps): PromiseLike<RoleDefinition>;
|
|
23
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./addContentEditorWebPart";
|
|
2
2
|
export * from "./addPermissionLevel";
|
|
3
3
|
export * from "./addScriptEditorWebPart";
|
|
4
|
+
export * from "./copyPermissionLevel";
|
|
4
5
|
export * from "./createContentType";
|
|
5
6
|
export * from "./createDocSet";
|
|
6
7
|
export * from "./hasPermissions";
|
package/@types/helper/spCfg.d.ts
CHANGED
|
@@ -441,6 +441,12 @@ export interface ISPConfig {
|
|
|
441
441
|
*/
|
|
442
442
|
install(): PromiseLike<void>;
|
|
443
443
|
|
|
444
|
+
/**
|
|
445
|
+
* Sets the web url to install/uninstall the solution to/from.
|
|
446
|
+
* @param url - The web url.
|
|
447
|
+
*/
|
|
448
|
+
setWebUrl(url: string);
|
|
449
|
+
|
|
444
450
|
/**
|
|
445
451
|
* Method to install the configuration
|
|
446
452
|
*/
|
|
@@ -23,8 +23,8 @@ exports.addPermissionLevel = function (props) {
|
|
|
23
23
|
var roleDefInfo = new SP.RoleDefinitionCreationInformation();
|
|
24
24
|
roleDefInfo.set_basePermissions(basePermissions);
|
|
25
25
|
roleDefInfo.set_description(props.Description);
|
|
26
|
-
roleDefInfo.set_order(props.Order);
|
|
27
26
|
roleDefInfo.set_name(props.Name);
|
|
27
|
+
roleDefInfo.set_order(props.Order);
|
|
28
28
|
// Add the role definition
|
|
29
29
|
var roleDef_1 = ctx.get_site().get_rootWeb().get_roleDefinitions().add(roleDefInfo);
|
|
30
30
|
ctx.load(roleDef_1);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copyPermissionLevel = void 0;
|
|
4
|
+
var lib_1 = require("../../lib");
|
|
5
|
+
var sptypes_1 = require("../../sptypes");
|
|
6
|
+
/**
|
|
7
|
+
* Copies a permission level to the current or specified web.
|
|
8
|
+
*/
|
|
9
|
+
exports.copyPermissionLevel = function (props) {
|
|
10
|
+
// Return a promise
|
|
11
|
+
return new Promise(function (resolve, reject) {
|
|
12
|
+
// Ensure the base permissions exist
|
|
13
|
+
if (SP && SP.BasePermissions) {
|
|
14
|
+
// Set the context and get the role definitions
|
|
15
|
+
var ctx_1 = props.WebUrl ? new SP.ClientContext(props.WebUrl) : SP.ClientContext.get_current();
|
|
16
|
+
// Get the base permission
|
|
17
|
+
var basePerm = ctx_1.get_site().get_rootWeb().get_roleDefinitions().getByName(props.BasePermission);
|
|
18
|
+
ctx_1.load(basePerm);
|
|
19
|
+
ctx_1.executeQueryAsync(
|
|
20
|
+
// Success
|
|
21
|
+
function () {
|
|
22
|
+
// Copy the base permissions
|
|
23
|
+
var basePermissions = basePerm.get_basePermissions();
|
|
24
|
+
var permissions = new SP.BasePermissions();
|
|
25
|
+
var removePermissions = props.RemovePermissions || [];
|
|
26
|
+
for (var key in sptypes_1.SPTypes.BasePermissionTypes) {
|
|
27
|
+
var permission = sptypes_1.SPTypes.BasePermissionTypes[key];
|
|
28
|
+
// See if the base permission has this
|
|
29
|
+
if (basePermissions.has(permission) && removePermissions.indexOf(permission) < 0) {
|
|
30
|
+
// Set the permission
|
|
31
|
+
permissions.set(permission);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Parse the custom permissions to add
|
|
35
|
+
var newPermissions = props.AddPermissions || [];
|
|
36
|
+
for (var i = 0; i < newPermissions.length; i++) {
|
|
37
|
+
// Set the flag
|
|
38
|
+
permissions.set(newPermissions[i]);
|
|
39
|
+
}
|
|
40
|
+
// Create the role definition
|
|
41
|
+
var roleDefInfo = new SP.RoleDefinitionCreationInformation();
|
|
42
|
+
roleDefInfo.set_basePermissions(permissions);
|
|
43
|
+
roleDefInfo.set_description(props.Description);
|
|
44
|
+
roleDefInfo.set_name(props.Name);
|
|
45
|
+
roleDefInfo.set_order(props.Order);
|
|
46
|
+
// Add the role definition
|
|
47
|
+
var roleDef = ctx_1.get_site().get_rootWeb().get_roleDefinitions().add(roleDefInfo);
|
|
48
|
+
ctx_1.load(roleDef);
|
|
49
|
+
// Execute the request
|
|
50
|
+
ctx_1.executeQueryAsync(function () {
|
|
51
|
+
// Get the role definition
|
|
52
|
+
lib_1.Site(props.WebUrl).RootWeb().RoleDefinitions().getById(roleDef.get_id()).execute(function (roleDef) {
|
|
53
|
+
// Resolve the request
|
|
54
|
+
resolve(roleDef);
|
|
55
|
+
}, reject);
|
|
56
|
+
}, reject);
|
|
57
|
+
},
|
|
58
|
+
// Error
|
|
59
|
+
function () {
|
|
60
|
+
// Reject the request
|
|
61
|
+
reject("Permission not found in site: " + props.WebUrl);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
// Reject the request
|
|
66
|
+
reject("The 'SP' core library is not available.");
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./addContentEditorWebPart"), exports);
|
|
14
14
|
__exportStar(require("./addPermissionLevel"), exports);
|
|
15
15
|
__exportStar(require("./addScriptEditorWebPart"), exports);
|
|
16
|
+
__exportStar(require("./copyPermissionLevel"), exports);
|
|
16
17
|
__exportStar(require("./createContentType"), exports);
|
|
17
18
|
__exportStar(require("./createDocSet"), exports);
|
|
18
19
|
__exportStar(require("./hasPermissions"), exports);
|
package/build/helper/spCfg.js
CHANGED
|
@@ -1265,6 +1265,8 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
1265
1265
|
}, reject);
|
|
1266
1266
|
});
|
|
1267
1267
|
},
|
|
1268
|
+
// Method to update the web url to target
|
|
1269
|
+
setWebUrl: function (url) { webUrl = url; },
|
|
1268
1270
|
// Method to uninstall the configuration
|
|
1269
1271
|
uninstall: function () {
|
|
1270
1272
|
// Return a promise
|
package/build/rest.js
CHANGED
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -94,7 +94,11 @@ declare module 'gd-sprest/helper' {
|
|
|
94
94
|
import { IRibbonLink, ISuiteBarLink, ILinkInfo } from "gd-sprest/helper/linkInfo";
|
|
95
95
|
import { IListForm } from "gd-sprest/helper/listForm";
|
|
96
96
|
import { IListFormField } from "gd-sprest/helper/listFormField";
|
|
97
|
-
import {
|
|
97
|
+
import {
|
|
98
|
+
IRequest, IaddContentEditorWebPart, IaddPermissionLevel, IaddScriptEditorWebPart, IcopyPermissionLevel,
|
|
99
|
+
IcreateContentType, IcreateDocSet, IhasPermissions, IloadSPCore, Iparse, Irequest, IsetContentTypeFields,
|
|
100
|
+
IsetGroupOwner
|
|
101
|
+
} from "./methods";
|
|
98
102
|
import { ISPComponents } from "gd-sprest/helper/sp";
|
|
99
103
|
import { ISPConfig, ISPConfigProps, IFieldInfo } from "gd-sprest/helper/spCfg";
|
|
100
104
|
import { ISPCfgFieldType, ISPCfgType } from "gd-sprest/helper/spCfgTypes";
|
|
@@ -125,10 +129,13 @@ declare module 'gd-sprest/helper' {
|
|
|
125
129
|
|
|
126
130
|
/** Methods */
|
|
127
131
|
addContentEditorWebPart: IaddContentEditorWebPart,
|
|
132
|
+
addPermissionLevel: IaddPermissionLevel,
|
|
128
133
|
addScriptEditorWebPart: IaddScriptEditorWebPart,
|
|
134
|
+
copyPermissionLevel: IcopyPermissionLevel,
|
|
129
135
|
createContentType: IcreateContentType,
|
|
130
136
|
createDocSet: IcreateDocSet,
|
|
131
137
|
hasPermissions: IhasPermissions,
|
|
138
|
+
loadSPCore: IloadSPCore,
|
|
132
139
|
parse: Iparse,
|
|
133
140
|
request: Irequest,
|
|
134
141
|
setContentTypeFields: IsetContentTypeFields,
|
|
@@ -2288,20 +2295,6 @@ declare module 'gd-sprest/helper/listFormField' {
|
|
|
2288
2295
|
}
|
|
2289
2296
|
}
|
|
2290
2297
|
|
|
2291
|
-
declare module 'gd-sprest/helper/methods' {
|
|
2292
|
-
export * from "gd-sprest/helper/methods/addContentEditorWebPart";
|
|
2293
|
-
export * from "gd-sprest/helper/methods/addPermissionLevel";
|
|
2294
|
-
export * from "gd-sprest/helper/methods/addScriptEditorWebPart";
|
|
2295
|
-
export * from "gd-sprest/helper/methods/createContentType";
|
|
2296
|
-
export * from "gd-sprest/helper/methods/createDocSet";
|
|
2297
|
-
export * from "gd-sprest/helper/methods/hasPermissions";
|
|
2298
|
-
export * from "gd-sprest/helper/methods/loadSPCore";
|
|
2299
|
-
export * from "gd-sprest/helper/methods/parse";
|
|
2300
|
-
export * from "gd-sprest/helper/methods/request";
|
|
2301
|
-
export * from "gd-sprest/helper/methods/setContentTypeFields";
|
|
2302
|
-
export * from "gd-sprest/helper/methods/setGroupOwner";
|
|
2303
|
-
}
|
|
2304
|
-
|
|
2305
2298
|
declare module 'gd-sprest/helper/sp' {
|
|
2306
2299
|
/**
|
|
2307
2300
|
* References to the internal SharePoint libraries.
|
|
@@ -3398,6 +3391,12 @@ declare module 'gd-sprest/helper/spCfg' {
|
|
|
3398
3391
|
*/
|
|
3399
3392
|
install(): PromiseLike<void>;
|
|
3400
3393
|
|
|
3394
|
+
/**
|
|
3395
|
+
* Sets the web url to install/uninstall the solution to/from.
|
|
3396
|
+
* @param url - The web url.
|
|
3397
|
+
*/
|
|
3398
|
+
setWebUrl(url: string);
|
|
3399
|
+
|
|
3401
3400
|
/**
|
|
3402
3401
|
* Method to install the configuration
|
|
3403
3402
|
*/
|
|
@@ -3816,6 +3815,21 @@ declare module 'gd-sprest/helper/webpart' {
|
|
|
3816
3815
|
}
|
|
3817
3816
|
}
|
|
3818
3817
|
|
|
3818
|
+
declare module 'gd-sprest/helper/methods' {
|
|
3819
|
+
export * from "gd-sprest/helper/methods/addContentEditorWebPart";
|
|
3820
|
+
export * from "gd-sprest/helper/methods/addPermissionLevel";
|
|
3821
|
+
export * from "gd-sprest/helper/methods/addScriptEditorWebPart";
|
|
3822
|
+
export * from "gd-sprest/helper/methods/copyPermissionLevel";
|
|
3823
|
+
export * from "gd-sprest/helper/methods/createContentType";
|
|
3824
|
+
export * from "gd-sprest/helper/methods/createDocSet";
|
|
3825
|
+
export * from "gd-sprest/helper/methods/hasPermissions";
|
|
3826
|
+
export * from "gd-sprest/helper/methods/loadSPCore";
|
|
3827
|
+
export * from "gd-sprest/helper/methods/parse";
|
|
3828
|
+
export * from "gd-sprest/helper/methods/request";
|
|
3829
|
+
export * from "gd-sprest/helper/methods/setContentTypeFields";
|
|
3830
|
+
export * from "gd-sprest/helper/methods/setGroupOwner";
|
|
3831
|
+
}
|
|
3832
|
+
|
|
3819
3833
|
declare module 'gd-sprest/sptypes/sptypes' {
|
|
3820
3834
|
import { BasePermissions } from "gd-sprest-def/lib/SP/complextypes";
|
|
3821
3835
|
|
|
@@ -5983,6 +5997,7 @@ declare module 'gd-sprest/helper/methods/addPermissionLevel' {
|
|
|
5983
5997
|
export interface IaddPermissionLevelProps extends RoleDefinitionCreationInformation {
|
|
5984
5998
|
Permissions: Array<number>;
|
|
5985
5999
|
Name: string;
|
|
6000
|
+
Order?: number;
|
|
5986
6001
|
WebUrl?: string;
|
|
5987
6002
|
}
|
|
5988
6003
|
|
|
@@ -6011,6 +6026,32 @@ declare module 'gd-sprest/helper/methods/addScriptEditorWebPart' {
|
|
|
6011
6026
|
}
|
|
6012
6027
|
}
|
|
6013
6028
|
|
|
6029
|
+
declare module 'gd-sprest/helper/methods/copyPermissionLevel' {
|
|
6030
|
+
import { RoleDefinition, RoleDefinitionCreationInformation } from "gd-sprest-def/lib/SP";
|
|
6031
|
+
|
|
6032
|
+
/**
|
|
6033
|
+
* Properties
|
|
6034
|
+
*/
|
|
6035
|
+
export interface IcopyPermissionLevelProps extends RoleDefinitionCreationInformation {
|
|
6036
|
+
AddPermissions?: Array<number>;
|
|
6037
|
+
Description: string;
|
|
6038
|
+
BasePermission: string;
|
|
6039
|
+
Order?: number;
|
|
6040
|
+
Name: string;
|
|
6041
|
+
RemovePermissions?: Array<number>;
|
|
6042
|
+
WebUrl?: string;
|
|
6043
|
+
}
|
|
6044
|
+
|
|
6045
|
+
/**
|
|
6046
|
+
* Copies a permission level to the current or specified web.
|
|
6047
|
+
* @props properties
|
|
6048
|
+
*/
|
|
6049
|
+
export const copyPermissionLevel: IcopyPermissionLevel;
|
|
6050
|
+
export interface IcopyPermissionLevel {
|
|
6051
|
+
(props: IcopyPermissionLevelProps): PromiseLike<RoleDefinition>;
|
|
6052
|
+
}
|
|
6053
|
+
}
|
|
6054
|
+
|
|
6014
6055
|
declare module 'gd-sprest/helper/methods/createContentType' {
|
|
6015
6056
|
import { ContentTypeCreationInformation } from "gd-sprest-def/lib/SP/complextypes";
|
|
6016
6057
|
import { ContentType } from "gd-sprest-def/lib/SP/entitytypes";
|