@kwiz/common 1.0.1
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/LICENSE +21 -0
- package/dist/_dependencies.d.ts +1 -0
- package/dist/_dependencies.js +8 -0
- package/dist/_dependencies.js.map +1 -0
- package/dist/helpers/Guid.d.ts +119 -0
- package/dist/helpers/Guid.js +183 -0
- package/dist/helpers/Guid.js.map +1 -0
- package/dist/helpers/_dependencies.d.ts +2 -0
- package/dist/helpers/_dependencies.js +21 -0
- package/dist/helpers/_dependencies.js.map +1 -0
- package/dist/helpers/base64.d.ts +8 -0
- package/dist/helpers/base64.js +178 -0
- package/dist/helpers/base64.js.map +1 -0
- package/dist/helpers/browser.d.ts +144 -0
- package/dist/helpers/browser.js +1200 -0
- package/dist/helpers/browser.js.map +1 -0
- package/dist/helpers/browserinfo.d.ts +23 -0
- package/dist/helpers/browserinfo.js +215 -0
- package/dist/helpers/browserinfo.js.map +1 -0
- package/dist/helpers/collections.base.d.ts +128 -0
- package/dist/helpers/collections.base.js +430 -0
- package/dist/helpers/collections.base.js.map +1 -0
- package/dist/helpers/collections.d.ts +18 -0
- package/dist/helpers/collections.js +99 -0
- package/dist/helpers/collections.js.map +1 -0
- package/dist/helpers/color.d.ts +11 -0
- package/dist/helpers/color.js +57 -0
- package/dist/helpers/color.js.map +1 -0
- package/dist/helpers/cookies.d.ts +6 -0
- package/dist/helpers/cookies.js +56 -0
- package/dist/helpers/cookies.js.map +1 -0
- package/dist/helpers/date.d.ts +43 -0
- package/dist/helpers/date.js +158 -0
- package/dist/helpers/date.js.map +1 -0
- package/dist/helpers/debug.d.ts +33 -0
- package/dist/helpers/debug.js +177 -0
- package/dist/helpers/debug.js.map +1 -0
- package/dist/helpers/emails.d.ts +2 -0
- package/dist/helpers/emails.js +10 -0
- package/dist/helpers/emails.js.map +1 -0
- package/dist/helpers/eval.d.ts +1 -0
- package/dist/helpers/eval.js +10 -0
- package/dist/helpers/eval.js.map +1 -0
- package/dist/helpers/file.d.ts +11 -0
- package/dist/helpers/file.js +55 -0
- package/dist/helpers/file.js.map +1 -0
- package/dist/helpers/flatted.d.ts +20 -0
- package/dist/helpers/flatted.js +135 -0
- package/dist/helpers/flatted.js.map +1 -0
- package/dist/helpers/functions.d.ts +4 -0
- package/dist/helpers/functions.js +17 -0
- package/dist/helpers/functions.js.map +1 -0
- package/dist/helpers/graph/calendar.types.d.ts +3 -0
- package/dist/helpers/graph/calendar.types.js +15 -0
- package/dist/helpers/graph/calendar.types.js.map +1 -0
- package/dist/helpers/http.d.ts +25 -0
- package/dist/helpers/http.js +70 -0
- package/dist/helpers/http.js.map +1 -0
- package/dist/helpers/images.d.ts +16 -0
- package/dist/helpers/images.js +21 -0
- package/dist/helpers/images.js.map +1 -0
- package/dist/helpers/index.d.ts +29 -0
- package/dist/helpers/index.js +46 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/json.d.ts +3 -0
- package/dist/helpers/json.js +44 -0
- package/dist/helpers/json.js.map +1 -0
- package/dist/helpers/md5.d.ts +5 -0
- package/dist/helpers/md5.js +172 -0
- package/dist/helpers/md5.js.map +1 -0
- package/dist/helpers/objects.d.ts +49 -0
- package/dist/helpers/objects.js +271 -0
- package/dist/helpers/objects.js.map +1 -0
- package/dist/helpers/promises.d.ts +14 -0
- package/dist/helpers/promises.js +112 -0
- package/dist/helpers/promises.js.map +1 -0
- package/dist/helpers/random.d.ts +2 -0
- package/dist/helpers/random.js +32 -0
- package/dist/helpers/random.js.map +1 -0
- package/dist/helpers/scheduler/scheduler.d.ts +39 -0
- package/dist/helpers/scheduler/scheduler.js +109 -0
- package/dist/helpers/scheduler/scheduler.js.map +1 -0
- package/dist/helpers/sharepoint.d.ts +112 -0
- package/dist/helpers/sharepoint.js +629 -0
- package/dist/helpers/sharepoint.js.map +1 -0
- package/dist/helpers/strings.d.ts +56 -0
- package/dist/helpers/strings.js +282 -0
- package/dist/helpers/strings.js.map +1 -0
- package/dist/helpers/typecheckers.d.ts +56 -0
- package/dist/helpers/typecheckers.js +274 -0
- package/dist/helpers/typecheckers.js.map +1 -0
- package/dist/helpers/url.d.ts +46 -0
- package/dist/helpers/url.js +199 -0
- package/dist/helpers/url.js.map +1 -0
- package/dist/helpers/urlhelper.d.ts +16 -0
- package/dist/helpers/urlhelper.js +96 -0
- package/dist/helpers/urlhelper.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/types/common.types.d.ts +19 -0
- package/dist/types/common.types.js +4 -0
- package/dist/types/common.types.js.map +1 -0
- package/dist/types/flatted.types.d.ts +49 -0
- package/dist/types/flatted.types.js +3 -0
- package/dist/types/flatted.types.js.map +1 -0
- package/dist/types/globals.types.d.ts +6 -0
- package/dist/types/globals.types.js +3 -0
- package/dist/types/globals.types.js.map +1 -0
- package/dist/types/graph/calendar.types.d.ts +79 -0
- package/dist/types/graph/calendar.types.js +3 -0
- package/dist/types/graph/calendar.types.js.map +1 -0
- package/dist/types/graph/index.d.ts +1 -0
- package/dist/types/graph/index.js +18 -0
- package/dist/types/graph/index.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.js +28 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/knownscript.types.d.ts +22 -0
- package/dist/types/knownscript.types.js +3 -0
- package/dist/types/knownscript.types.js.map +1 -0
- package/dist/types/libs/datajs.types.d.ts +29 -0
- package/dist/types/libs/datajs.types.js +3 -0
- package/dist/types/libs/datajs.types.js.map +1 -0
- package/dist/types/libs/ics.types.d.ts +29 -0
- package/dist/types/libs/ics.types.js +3 -0
- package/dist/types/libs/ics.types.js.map +1 -0
- package/dist/types/libs/index.d.ts +3 -0
- package/dist/types/libs/index.js +20 -0
- package/dist/types/libs/index.js.map +1 -0
- package/dist/types/libs/msal.types.d.ts +33 -0
- package/dist/types/libs/msal.types.js +63 -0
- package/dist/types/libs/msal.types.js.map +1 -0
- package/dist/types/locales.d.ts +122 -0
- package/dist/types/locales.js +1 -0
- package/dist/types/locales.js.map +1 -0
- package/dist/types/localstoragecache.types.d.ts +8 -0
- package/dist/types/localstoragecache.types.js +3 -0
- package/dist/types/localstoragecache.types.js.map +1 -0
- package/dist/types/moment.d.ts +6 -0
- package/dist/types/moment.js +1 -0
- package/dist/types/moment.js.map +1 -0
- package/dist/types/regex.types.d.ts +14 -0
- package/dist/types/regex.types.js +3 -0
- package/dist/types/regex.types.js.map +1 -0
- package/dist/types/rest.types.d.ts +81 -0
- package/dist/types/rest.types.js +24 -0
- package/dist/types/rest.types.js.map +1 -0
- package/dist/types/sharepoint.types.d.ts +1432 -0
- package/dist/types/sharepoint.types.js +629 -0
- package/dist/types/sharepoint.types.js.map +1 -0
- package/dist/types/sharepoint.utils.types.d.ts +246 -0
- package/dist/types/sharepoint.utils.types.js +26 -0
- package/dist/types/sharepoint.utils.types.js.map +1 -0
- package/dist/utils/_dependencies.d.ts +3 -0
- package/dist/utils/_dependencies.js +24 -0
- package/dist/utils/_dependencies.js.map +1 -0
- package/dist/utils/base64.d.ts +2 -0
- package/dist/utils/base64.js +41 -0
- package/dist/utils/base64.js.map +1 -0
- package/dist/utils/consolelogger.d.ts +73 -0
- package/dist/utils/consolelogger.js +281 -0
- package/dist/utils/consolelogger.js.map +1 -0
- package/dist/utils/date.d.ts +10 -0
- package/dist/utils/date.js +30 -0
- package/dist/utils/date.js.map +1 -0
- package/dist/utils/emails.d.ts +2 -0
- package/dist/utils/emails.js +24 -0
- package/dist/utils/emails.js.map +1 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.js +31 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/knownscript.d.ts +99 -0
- package/dist/utils/knownscript.js +261 -0
- package/dist/utils/knownscript.js.map +1 -0
- package/dist/utils/localstoragecache.d.ts +19 -0
- package/dist/utils/localstoragecache.js +372 -0
- package/dist/utils/localstoragecache.js.map +1 -0
- package/dist/utils/rest.d.ts +17 -0
- package/dist/utils/rest.js +402 -0
- package/dist/utils/rest.js.map +1 -0
- package/dist/utils/script.d.ts +33 -0
- package/dist/utils/script.js +169 -0
- package/dist/utils/script.js.map +1 -0
- package/dist/utils/sharepoint.rest/common.d.ts +32 -0
- package/dist/utils/sharepoint.rest/common.js +146 -0
- package/dist/utils/sharepoint.rest/common.js.map +1 -0
- package/dist/utils/sharepoint.rest/date.d.ts +2 -0
- package/dist/utils/sharepoint.rest/date.js +57 -0
- package/dist/utils/sharepoint.rest/date.js.map +1 -0
- package/dist/utils/sharepoint.rest/file.folder.d.ts +58 -0
- package/dist/utils/sharepoint.rest/file.folder.js +305 -0
- package/dist/utils/sharepoint.rest/file.folder.js.map +1 -0
- package/dist/utils/sharepoint.rest/index.d.ts +11 -0
- package/dist/utils/sharepoint.rest/index.js +28 -0
- package/dist/utils/sharepoint.rest/index.js.map +1 -0
- package/dist/utils/sharepoint.rest/item.d.ts +81 -0
- package/dist/utils/sharepoint.rest/item.js +444 -0
- package/dist/utils/sharepoint.rest/item.js.map +1 -0
- package/dist/utils/sharepoint.rest/list.d.ts +228 -0
- package/dist/utils/sharepoint.rest/list.js +868 -0
- package/dist/utils/sharepoint.rest/list.js.map +1 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.d.ts +19 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.js +629 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsByCaml.js.map +1 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsById.d.ts +14 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsById.js +222 -0
- package/dist/utils/sharepoint.rest/listutils/GetListItemsById.js.map +1 -0
- package/dist/utils/sharepoint.rest/listutils/common.d.ts +3 -0
- package/dist/utils/sharepoint.rest/listutils/common.js +198 -0
- package/dist/utils/sharepoint.rest/listutils/common.js.map +1 -0
- package/dist/utils/sharepoint.rest/user-search.d.ts +76 -0
- package/dist/utils/sharepoint.rest/user-search.js +239 -0
- package/dist/utils/sharepoint.rest/user-search.js.map +1 -0
- package/dist/utils/sharepoint.rest/user.d.ts +71 -0
- package/dist/utils/sharepoint.rest/user.js +404 -0
- package/dist/utils/sharepoint.rest/user.js.map +1 -0
- package/dist/utils/sharepoint.rest/web.d.ts +107 -0
- package/dist/utils/sharepoint.rest/web.js +929 -0
- package/dist/utils/sharepoint.rest/web.js.map +1 -0
- package/dist/utils/sod.d.ts +29 -0
- package/dist/utils/sod.js +177 -0
- package/dist/utils/sod.js.map +1 -0
- package/package.json +60 -0
- package/readme.md +13 -0
- package/src/_dependencies.ts +2 -0
- package/src/helpers/Guid.ts +182 -0
- package/src/helpers/_dependencies.ts +3 -0
- package/src/helpers/base64.ts +174 -0
- package/src/helpers/browser.test.js +9 -0
- package/src/helpers/browser.ts +1299 -0
- package/src/helpers/browserinfo.ts +293 -0
- package/src/helpers/collections.base.test.js +26 -0
- package/src/helpers/collections.base.ts +439 -0
- package/src/helpers/collections.ts +108 -0
- package/src/helpers/color.ts +55 -0
- package/src/helpers/cookies.ts +55 -0
- package/src/helpers/date.test.js +97 -0
- package/src/helpers/date.ts +163 -0
- package/src/helpers/debug.ts +187 -0
- package/src/helpers/emails.ts +7 -0
- package/src/helpers/eval.ts +5 -0
- package/src/helpers/file.test.js +51 -0
- package/src/helpers/file.ts +59 -0
- package/src/helpers/flatted.ts +150 -0
- package/src/helpers/functions.ts +17 -0
- package/src/helpers/graph/calendar.types.ts +11 -0
- package/src/helpers/http.ts +70 -0
- package/src/helpers/images.ts +23 -0
- package/src/helpers/index.ts +29 -0
- package/src/helpers/json.ts +39 -0
- package/src/helpers/md5.ts +190 -0
- package/src/helpers/objects.test.js +27 -0
- package/src/helpers/objects.ts +256 -0
- package/src/helpers/promises.test.js +18 -0
- package/src/helpers/promises.ts +102 -0
- package/src/helpers/random.ts +27 -0
- package/src/helpers/scheduler/scheduler.test.js +104 -0
- package/src/helpers/scheduler/scheduler.ts +132 -0
- package/src/helpers/sharepoint.ts +681 -0
- package/src/helpers/strings.test.js +43 -0
- package/src/helpers/strings.ts +288 -0
- package/src/helpers/typecheckers.test.js +35 -0
- package/src/helpers/typecheckers.ts +263 -0
- package/src/helpers/url.test.js +18 -0
- package/src/helpers/url.ts +202 -0
- package/src/helpers/urlhelper.ts +104 -0
- package/src/index.ts +24 -0
- package/src/types/common.types.ts +16 -0
- package/src/types/flatted.types.ts +60 -0
- package/src/types/globals.types.ts +7 -0
- package/src/types/graph/calendar.types.ts +81 -0
- package/src/types/graph/index.ts +1 -0
- package/src/types/index.ts +12 -0
- package/src/types/knownscript.types.ts +19 -0
- package/src/types/libs/datajs.types.ts +29 -0
- package/src/types/libs/ics.types.ts +31 -0
- package/src/types/libs/index.ts +4 -0
- package/src/types/libs/msal.types.ts +79 -0
- package/src/types/locales.ts +125 -0
- package/src/types/localstoragecache.types.ts +9 -0
- package/src/types/moment.ts +7 -0
- package/src/types/regex.types.ts +17 -0
- package/src/types/rest.types.ts +94 -0
- package/src/types/sharepoint.types.ts +1413 -0
- package/src/types/sharepoint.utils.types.ts +246 -0
- package/src/utils/_dependencies.ts +4 -0
- package/src/utils/base64.ts +27 -0
- package/src/utils/consolelogger.ts +315 -0
- package/src/utils/date.ts +36 -0
- package/src/utils/emails.ts +25 -0
- package/src/utils/index.ts +13 -0
- package/src/utils/knownscript.ts +280 -0
- package/src/utils/localstoragecache.ts +419 -0
- package/src/utils/rest.ts +465 -0
- package/src/utils/script.ts +168 -0
- package/src/utils/sharepoint.rest/common.ts +149 -0
- package/src/utils/sharepoint.rest/date.ts +61 -0
- package/src/utils/sharepoint.rest/file.folder.ts +368 -0
- package/src/utils/sharepoint.rest/index.ts +11 -0
- package/src/utils/sharepoint.rest/item.ts +456 -0
- package/src/utils/sharepoint.rest/list.ts +1144 -0
- package/src/utils/sharepoint.rest/listutils/GetListItemsByCaml.ts +750 -0
- package/src/utils/sharepoint.rest/listutils/GetListItemsById.ts +265 -0
- package/src/utils/sharepoint.rest/listutils/common.ts +202 -0
- package/src/utils/sharepoint.rest/user-search.ts +254 -0
- package/src/utils/sharepoint.rest/user.ts +447 -0
- package/src/utils/sharepoint.rest/web.ts +1031 -0
- package/src/utils/sod.ts +193 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.SPPeopleSearchService = void 0;
|
|
13
|
+
const _dependencies_1 = require("../_dependencies");
|
|
14
|
+
const rest_1 = require("../rest");
|
|
15
|
+
const user_1 = require("./user");
|
|
16
|
+
/**
|
|
17
|
+
* Service implementation to search people in SharePoint
|
|
18
|
+
*/
|
|
19
|
+
class SPPeopleSearchService {
|
|
20
|
+
/**
|
|
21
|
+
* Service constructor
|
|
22
|
+
*/
|
|
23
|
+
constructor(context) {
|
|
24
|
+
this.context = context;
|
|
25
|
+
this.cachedLocalUsers = {};
|
|
26
|
+
this.cachedLocalUsers[this.context.siteUrl] = [];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Generate the user photo link using SharePoint user photo endpoint.
|
|
30
|
+
*
|
|
31
|
+
* @param value
|
|
32
|
+
*/
|
|
33
|
+
generateUserPhotoLink(value, size = "M") {
|
|
34
|
+
return `${this.context.siteUrl}/_layouts/15/userphoto.aspx?accountname=${encodeURIComponent(value)}&size=M`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Generate sum of principal types
|
|
38
|
+
*
|
|
39
|
+
* PrincipalType controls the type of entities that are returned in the results.
|
|
40
|
+
* Choices are All - 15, Distribution List - 2 , Security Groups - 4, SharePoint Groups - 8, User - 1.
|
|
41
|
+
* These values can be combined (example: 13 is security + SP groups + users)
|
|
42
|
+
*
|
|
43
|
+
* @param principalTypes
|
|
44
|
+
*/
|
|
45
|
+
getSumOfPrincipalTypes(principalTypes) {
|
|
46
|
+
return !!principalTypes && principalTypes.length > 0 ? principalTypes.reduce((a, b) => a + b, 0) : 1;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the specified group
|
|
50
|
+
*
|
|
51
|
+
* @param groupName
|
|
52
|
+
* @param siteUrl
|
|
53
|
+
*/
|
|
54
|
+
getGroupId(groupName, siteUrl = null) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
// if (Environment.type === EnvironmentType.Local) {
|
|
57
|
+
// return 1;
|
|
58
|
+
// } else {
|
|
59
|
+
const groups = yield this.searchTenant(siteUrl, groupName, 1, [8 /* PrincipalType.SharePointGroup */], false, 0);
|
|
60
|
+
return (groups && groups.length > 0) ? parseInt(groups[0].id) : null;
|
|
61
|
+
//}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Search person by its email or login name
|
|
66
|
+
*/
|
|
67
|
+
searchPersonByEmailOrLogin(email, principalTypes, siteUrl = null, groupId = null, ensureUser = false) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
// if (Environment.type === EnvironmentType.Local) {
|
|
70
|
+
// // If the running environment is local, load the data from the mock
|
|
71
|
+
// const mockUsers = await this.searchPeopleFromMock(email);
|
|
72
|
+
// return (mockUsers && mockUsers.length > 0) ? mockUsers[0] : null;
|
|
73
|
+
// } else {
|
|
74
|
+
const userResults = yield this.searchTenant(siteUrl, email, 1, principalTypes, ensureUser, groupId);
|
|
75
|
+
return (userResults && userResults.length > 0) ? userResults[0] : null;
|
|
76
|
+
//}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Search All Users from the SharePoint People database
|
|
81
|
+
*/
|
|
82
|
+
searchPeople(query, maximumSuggestions, principalTypes, siteUrl = null, groupId = null, ensureUser = false) {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
// if (Environment.type === EnvironmentType.Local) {
|
|
85
|
+
// // If the running environment is local, load the data from the mock
|
|
86
|
+
// return this.searchPeopleFromMock(query);
|
|
87
|
+
// } else {
|
|
88
|
+
return yield this.searchTenant(siteUrl, query, maximumSuggestions, principalTypes, ensureUser, groupId);
|
|
89
|
+
//}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Tenant search
|
|
94
|
+
*/
|
|
95
|
+
searchTenant(siteUrl, query, maximumSuggestions, principalTypes, ensureUser, groupId) {
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
try {
|
|
98
|
+
// If the running env is SharePoint, loads from the peoplepicker web service
|
|
99
|
+
const userRequestUrl = `${siteUrl || this.context.siteUrl}/_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.clientPeoplePickerSearchUser`;
|
|
100
|
+
const searchBody = {
|
|
101
|
+
queryParams: {
|
|
102
|
+
AllowEmailAddresses: true,
|
|
103
|
+
AllowMultipleEntities: false,
|
|
104
|
+
AllUrlZones: false,
|
|
105
|
+
MaximumEntitySuggestions: maximumSuggestions,
|
|
106
|
+
PrincipalSource: 15,
|
|
107
|
+
PrincipalType: this.getSumOfPrincipalTypes(principalTypes),
|
|
108
|
+
QueryString: query
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
// Search on the local site when "0"
|
|
112
|
+
if (siteUrl) {
|
|
113
|
+
searchBody.queryParams["SharePointGroupID"] = 0;
|
|
114
|
+
}
|
|
115
|
+
// Check if users need to be searched in a specific group
|
|
116
|
+
if (groupId) {
|
|
117
|
+
searchBody.queryParams["SharePointGroupID"] = groupId;
|
|
118
|
+
}
|
|
119
|
+
// Do the call against the People REST API endpoint
|
|
120
|
+
const userDataResp = yield (0, rest_1.GetJson)(userRequestUrl, JSON.stringify(searchBody), {
|
|
121
|
+
headers: {
|
|
122
|
+
Accept: _dependencies_1.jsonTypes.standard,
|
|
123
|
+
"content-type": _dependencies_1.contentTypes.json
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
if (userDataResp && userDataResp.value && userDataResp.value.length > 0) {
|
|
127
|
+
let values = userDataResp.value;
|
|
128
|
+
if (typeof userDataResp.value === "string") {
|
|
129
|
+
values = JSON.parse(userDataResp.value);
|
|
130
|
+
}
|
|
131
|
+
// Filter out "UNVALIDATED_EMAIL_ADDRESS"
|
|
132
|
+
values = values.filter(v => !(v.EntityData && v.EntityData.PrincipalType && v.EntityData.PrincipalType === "UNVALIDATED_EMAIL_ADDRESS"));
|
|
133
|
+
// Check if local user IDs need to be retrieved
|
|
134
|
+
if (ensureUser) {
|
|
135
|
+
for (const value of values) {
|
|
136
|
+
// Only ensure the user if it is not a SharePoint group
|
|
137
|
+
if (!value.EntityData || (value.EntityData && typeof value.EntityData.SPGroupID === "undefined")) {
|
|
138
|
+
const id = yield this.ensureUser(value.Key);
|
|
139
|
+
value.LoginName = value.Key;
|
|
140
|
+
value.Key = id;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
// Filter out NULL keys
|
|
145
|
+
values = values.filter(v => v.Key !== null);
|
|
146
|
+
const userResults = values.map(element => {
|
|
147
|
+
switch (element.EntityType) {
|
|
148
|
+
case 'User':
|
|
149
|
+
return {
|
|
150
|
+
id: element.Key,
|
|
151
|
+
loginName: element.LoginName ? element.LoginName : element.Key,
|
|
152
|
+
imageUrl: this.generateUserPhotoLink(element.Description || ""),
|
|
153
|
+
imageInitials: this.getFullNameInitials(element.DisplayText),
|
|
154
|
+
text: element.DisplayText, // name
|
|
155
|
+
secondaryText: element.EntityData.Email || element.Description, // email
|
|
156
|
+
tertiaryText: "", // status
|
|
157
|
+
optionalText: "" // anything
|
|
158
|
+
};
|
|
159
|
+
case 'SecGroup':
|
|
160
|
+
return {
|
|
161
|
+
id: element.Key,
|
|
162
|
+
loginName: element.LoginName ? element.LoginName : element.Key,
|
|
163
|
+
imageInitials: this.getFullNameInitials(element.DisplayText),
|
|
164
|
+
text: element.DisplayText,
|
|
165
|
+
secondaryText: element.ProviderName
|
|
166
|
+
};
|
|
167
|
+
case 'FormsRole':
|
|
168
|
+
return {
|
|
169
|
+
id: element.Key,
|
|
170
|
+
loginName: element.LoginName ? element.LoginName : element.Key,
|
|
171
|
+
imageInitials: this.getFullNameInitials(element.DisplayText),
|
|
172
|
+
text: element.DisplayText,
|
|
173
|
+
secondaryText: element.ProviderName
|
|
174
|
+
};
|
|
175
|
+
default:
|
|
176
|
+
return {
|
|
177
|
+
id: element.EntityData.SPGroupID,
|
|
178
|
+
loginName: element.EntityData.AccountName,
|
|
179
|
+
imageInitials: this.getFullNameInitials(element.DisplayText),
|
|
180
|
+
text: element.DisplayText,
|
|
181
|
+
secondaryText: element.EntityData.AccountName
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return userResults;
|
|
186
|
+
}
|
|
187
|
+
// Nothing to return
|
|
188
|
+
return [];
|
|
189
|
+
}
|
|
190
|
+
catch (e) {
|
|
191
|
+
console.error("PeopleSearchService::searchTenant: error occured while fetching the users.");
|
|
192
|
+
return [];
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Retrieves the local user ID
|
|
198
|
+
*
|
|
199
|
+
* @param userId
|
|
200
|
+
*/
|
|
201
|
+
ensureUser(userId) {
|
|
202
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const siteUrl = this.context.siteUrl;
|
|
204
|
+
if (this.cachedLocalUsers && this.cachedLocalUsers[siteUrl]) {
|
|
205
|
+
const users = this.cachedLocalUsers[siteUrl];
|
|
206
|
+
const userIdx = (0, _dependencies_1.firstIndexOf)(users, u => u.LoginName === userId);
|
|
207
|
+
if (userIdx !== -1) {
|
|
208
|
+
return users[userIdx].Id;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const user = yield (0, user_1.EnsureUser)(siteUrl, userId);
|
|
212
|
+
if (user && user.Id) {
|
|
213
|
+
this.cachedLocalUsers[siteUrl].push(user);
|
|
214
|
+
return user.Id;
|
|
215
|
+
}
|
|
216
|
+
return null;
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Generates Initials from a full name
|
|
221
|
+
*/
|
|
222
|
+
getFullNameInitials(fullName) {
|
|
223
|
+
if (fullName === null) {
|
|
224
|
+
return fullName;
|
|
225
|
+
}
|
|
226
|
+
const words = fullName.split(' ');
|
|
227
|
+
if (words.length === 0) {
|
|
228
|
+
return '';
|
|
229
|
+
}
|
|
230
|
+
else if (words.length === 1) {
|
|
231
|
+
return words[0].charAt(0);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
return (words[0].charAt(0) + words[1].charAt(0));
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.SPPeopleSearchService = SPPeopleSearchService;
|
|
239
|
+
//# sourceMappingURL=user-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user-search.js","sourceRoot":"","sources":["../../../src/utils/sharepoint.rest/user-search.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAmG;AACnG,kCAAkC;AAClC,iCAAoC;AAkBpC;;GAEG;AACH,MAAa,qBAAqB;IAG9B;;OAEG;IACH,YAAoB,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;QACpC,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,gBAAgB,CAAC,IA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AAO,KAAK,CAAC,CAAC,EAAE,CAAC;oBACjB,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;gBAC7B,CAAC;YACL,CAAC;YAED,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAU,EAAC,OAAO,EAAE,MAAM,CAAC,CAAA;YAC9C,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC;gBAClB,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC1C,OAAO,IAAI,CAAC,EAAE,CAAC;YACnB,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;IAED;;OAEG;IACK,mBAAmB,CAAC,QAAgB;QACxC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,MAAM,KAAK,GAAa,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,EAAE,CAAC;QACd,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC9B,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ;AAtOD,sDAsOC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IGroupInfo, ISPPeoplePickerControlFormEntity, IUserInfo, PrincipalType } from "../_dependencies";
|
|
2
|
+
/** Get user login name */
|
|
3
|
+
export declare function GetUserLoginName(siteUrl?: string): Promise<string>;
|
|
4
|
+
/** Get user login name syncronously */
|
|
5
|
+
export declare function GetUserLoginNameSync(siteUrl?: string): string;
|
|
6
|
+
export declare function GetCurrentUser(siteUrl?: string, options?: {
|
|
7
|
+
expandGroups: boolean;
|
|
8
|
+
refreshCache?: boolean;
|
|
9
|
+
}): Promise<IUserInfo>;
|
|
10
|
+
export declare function GetCurrentUserSync(siteUrl?: string, options?: {
|
|
11
|
+
expandGroups: boolean;
|
|
12
|
+
}): IUserInfo;
|
|
13
|
+
export declare function GetUser(siteUrl?: string, userId?: number, options?: {
|
|
14
|
+
expandGroups: boolean;
|
|
15
|
+
}): Promise<IUserInfo>;
|
|
16
|
+
export declare function GetUserSync(siteUrl?: string, userId?: number, options?: {
|
|
17
|
+
expandGroups: boolean;
|
|
18
|
+
}): IUserInfo;
|
|
19
|
+
export declare function GetUserByLogin(siteUrl?: string, loginName?: string, options?: {
|
|
20
|
+
expandGroups: boolean;
|
|
21
|
+
}): Promise<IUserInfo>;
|
|
22
|
+
export declare function GetUserByLoginSync(siteUrl?: string, loginName?: string, options?: {
|
|
23
|
+
expandGroups: boolean;
|
|
24
|
+
}): IUserInfo;
|
|
25
|
+
export declare function EnsureUser(siteUrl: string, userLogin: string, options?: {
|
|
26
|
+
expandGroups: boolean;
|
|
27
|
+
}): Promise<IUserInfo>;
|
|
28
|
+
export declare function EnsureUserSync(siteUrl: string, userLogin: string, options?: {
|
|
29
|
+
expandGroups: boolean;
|
|
30
|
+
}): IUserInfo;
|
|
31
|
+
export declare function GetOrEnsureUserByLoginSync(siteUrl: string, key: string, options?: {
|
|
32
|
+
expandGroups: boolean;
|
|
33
|
+
}): IUserInfo;
|
|
34
|
+
export declare function GetSecurityGroupByTitle(siteUrl: string, title: string): Promise<IUserInfo>;
|
|
35
|
+
export declare function GetSecurityGroupByTitleSync(siteUrl: string, title: string): IUserInfo;
|
|
36
|
+
export declare function GetGroup(siteUrl?: string, groupId?: number, options?: {
|
|
37
|
+
expandUsers: boolean;
|
|
38
|
+
refreshCache?: boolean;
|
|
39
|
+
}): Promise<IGroupInfo>;
|
|
40
|
+
export declare function GetGroupSync(siteUrl?: string, groupId?: number, options?: {
|
|
41
|
+
expandUsers: boolean;
|
|
42
|
+
}): IGroupInfo;
|
|
43
|
+
export declare function GetGroupByName(siteUrl: string, groupName: string, options?: {
|
|
44
|
+
expandUsers: boolean;
|
|
45
|
+
refreshCache?: boolean;
|
|
46
|
+
}): Promise<IGroupInfo>;
|
|
47
|
+
export declare function GetGroupByNameSync(siteUrl: string, groupName: string, options?: {
|
|
48
|
+
expandUsers: boolean;
|
|
49
|
+
}): IGroupInfo;
|
|
50
|
+
export declare function GetSiteGroups(siteUrl: string, refreshCache?: boolean): Promise<IGroupInfo[]>;
|
|
51
|
+
export declare function GetInfoFromSPPeoplePickerControlFormEntity(entity: ISPPeoplePickerControlFormEntity): IUserInfo | IGroupInfo;
|
|
52
|
+
interface ICreateSiteGroupResult {
|
|
53
|
+
Id: number;
|
|
54
|
+
IsHiddenInUI: boolean;
|
|
55
|
+
LoginName: string;
|
|
56
|
+
Title: string;
|
|
57
|
+
PrincipalType: PrincipalType.SharePointGroup;
|
|
58
|
+
AllowMembersEditMembership: boolean;
|
|
59
|
+
AllowRequestToJoinLeave: boolean;
|
|
60
|
+
AutoAcceptRequestToJoinLeave: boolean;
|
|
61
|
+
Description: string;
|
|
62
|
+
OnlyAllowMembersViewMembership: boolean;
|
|
63
|
+
OwnerTitle: string;
|
|
64
|
+
}
|
|
65
|
+
export declare function CreateSiteGroup(siteUrl: string, info: {
|
|
66
|
+
name: string;
|
|
67
|
+
description: string;
|
|
68
|
+
}): Promise<ICreateSiteGroupResult>;
|
|
69
|
+
export declare function AddUserToGroup(siteUrl: string, groupId: number, userIdOrLogin: number | string): Promise<void>;
|
|
70
|
+
export declare function RemoveUserFromGroup(siteUrl: string, groupId: number, userId: number): Promise<void>;
|
|
71
|
+
export {};
|