@ichicraft/widgets-widget-base 1.9.2 → 1.9.4
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/README.md +200 -200
- package/lib/.DS_Store +0 -0
- package/lib/BaseWidget.d.ts +18 -18
- package/lib/BaseWidget.js +51 -51
- package/lib/index.d.ts +2 -2
- package/lib/index.js +23 -8
- package/lib/types/index.d.ts +717 -715
- package/lib/types/index.js +43 -42
- package/lib/utils/ConfigurationHelper.d.ts +13 -13
- package/lib/utils/ConfigurationHelper.js +25 -24
- package/lib/utils/UserHelper.d.ts +9 -9
- package/lib/utils/UserHelper.js +146 -145
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.js +18 -7
- package/package.json +27 -24
package/lib/types/index.js
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
ICPersonaType[ICPersonaType["
|
|
19
|
-
ICPersonaType[ICPersonaType["
|
|
20
|
-
ICPersonaType[ICPersonaType["
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBarItemType = exports.CustomCommandBarItemSeverity = exports.ICPersonaType = exports.DebugComponentType = void 0;
|
|
4
|
+
var DebugComponentType;
|
|
5
|
+
(function (DebugComponentType) {
|
|
6
|
+
/**
|
|
7
|
+
* This is the default component type and just opens the default widget board.
|
|
8
|
+
*/
|
|
9
|
+
DebugComponentType["Default"] = "Default";
|
|
10
|
+
/**
|
|
11
|
+
* This automatically opens the widget board administration panel and opens the widget admin config
|
|
12
|
+
* dialog of the widget you're working on
|
|
13
|
+
*/
|
|
14
|
+
DebugComponentType["AdminConfig"] = "AdminConfig";
|
|
15
|
+
})(DebugComponentType || (exports.DebugComponentType = DebugComponentType = {}));
|
|
16
|
+
var ICPersonaType;
|
|
17
|
+
(function (ICPersonaType) {
|
|
18
|
+
ICPersonaType[ICPersonaType["User"] = 0] = "User";
|
|
19
|
+
ICPersonaType[ICPersonaType["SPGroup"] = 1] = "SPGroup";
|
|
20
|
+
ICPersonaType[ICPersonaType["Other"] = 2] = "Other";
|
|
21
|
+
ICPersonaType[ICPersonaType["Custom"] = 3] = "Custom";
|
|
22
|
+
})(ICPersonaType || (exports.ICPersonaType = ICPersonaType = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Tells the severity of the command bar item, resulting in
|
|
25
|
+
* distinguishable presentation of the item
|
|
26
|
+
*/
|
|
27
|
+
var CustomCommandBarItemSeverity;
|
|
28
|
+
(function (CustomCommandBarItemSeverity) {
|
|
29
|
+
/** Normal severity, displays just like all the other command bar items */
|
|
30
|
+
CustomCommandBarItemSeverity[CustomCommandBarItemSeverity["Normal"] = 0] = "Normal";
|
|
31
|
+
/** Warning severity, displays the item with a more noticable warning color */
|
|
32
|
+
CustomCommandBarItemSeverity[CustomCommandBarItemSeverity["Warning"] = 1] = "Warning";
|
|
33
|
+
})(CustomCommandBarItemSeverity || (exports.CustomCommandBarItemSeverity = CustomCommandBarItemSeverity = {}));
|
|
34
|
+
/**
|
|
35
|
+
* Tells how to render the command bar item, e.g. as an icon button or as a link.
|
|
36
|
+
*/
|
|
37
|
+
var CommandBarItemType;
|
|
38
|
+
(function (CommandBarItemType) {
|
|
39
|
+
/** Normal severity, displays just like all the other command bar items */
|
|
40
|
+
CommandBarItemType["Icon"] = "icon";
|
|
41
|
+
/** Warning severity, displays the item with a more noticable warning color */
|
|
42
|
+
CommandBarItemType["Link"] = "link";
|
|
43
|
+
})(CommandBarItemType || (exports.CommandBarItemType = CommandBarItemType = {}));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @class
|
|
3
|
-
* Helper class for Configuration related things.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ConfigurationHelper {
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param config The serialized configuration to parse into an object
|
|
9
|
-
* @param schema Deprecated: schema validation is no longer possible
|
|
10
|
-
*/
|
|
11
|
-
static parseConfiguration<T>(config: string, schema?: any): T;
|
|
12
|
-
static stringifyConfiguration(config: any): string;
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @class
|
|
3
|
+
* Helper class for Configuration related things.
|
|
4
|
+
*/
|
|
5
|
+
export declare class ConfigurationHelper {
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param config The serialized configuration to parse into an object
|
|
9
|
+
* @param schema Deprecated: schema validation is no longer possible
|
|
10
|
+
*/
|
|
11
|
+
static parseConfiguration<T>(config: string, schema?: any): T;
|
|
12
|
+
static stringifyConfiguration(config: any): string;
|
|
13
|
+
}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
* @param
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationHelper = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @class
|
|
6
|
+
* Helper class for Configuration related things.
|
|
7
|
+
*/
|
|
8
|
+
var ConfigurationHelper = /** @class */ (function () {
|
|
9
|
+
function ConfigurationHelper() {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param config The serialized configuration to parse into an object
|
|
14
|
+
* @param schema Deprecated: schema validation is no longer possible
|
|
15
|
+
*/
|
|
16
|
+
ConfigurationHelper.parseConfiguration = function (config, schema) {
|
|
17
|
+
var data = JSON.parse(config ? config : '{}');
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
ConfigurationHelper.stringifyConfiguration = function (config) {
|
|
21
|
+
return JSON.stringify(config);
|
|
22
|
+
};
|
|
23
|
+
return ConfigurationHelper;
|
|
24
|
+
}());
|
|
25
|
+
exports.ConfigurationHelper = ConfigurationHelper;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ICPersona, WidgetContext } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* @class
|
|
4
|
-
* Helper class for User related methods.
|
|
5
|
-
*/
|
|
6
|
-
export declare class UserHelper {
|
|
7
|
-
static isCurrentUserInScope(personas: ICPersona[], context: WidgetContext): Promise<boolean>;
|
|
8
|
-
static gatherAllNormalizedUserPersonaIds(userName: string, claimBasedLoginName: string, spGroups: number[], secGroups: string[]): string[];
|
|
9
|
-
}
|
|
1
|
+
import { ICPersona, WidgetContext } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @class
|
|
4
|
+
* Helper class for User related methods.
|
|
5
|
+
*/
|
|
6
|
+
export declare class UserHelper {
|
|
7
|
+
static isCurrentUserInScope(personas: ICPersona[], context: WidgetContext): Promise<boolean>;
|
|
8
|
+
static gatherAllNormalizedUserPersonaIds(userName: string, claimBasedLoginName: string, spGroups: number[], secGroups: string[]): string[];
|
|
9
|
+
}
|
package/lib/utils/UserHelper.js
CHANGED
|
@@ -1,145 +1,146 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
case types_1.ICPersonaType.
|
|
63
|
-
case types_1.ICPersonaType.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
case
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if
|
|
92
|
-
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
personas.push("USER|"
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.UserHelper = void 0;
|
|
40
|
+
var types_1 = require("../types");
|
|
41
|
+
/**
|
|
42
|
+
* @class
|
|
43
|
+
* Helper class for User related methods.
|
|
44
|
+
*/
|
|
45
|
+
var UserHelper = /** @class */ (function () {
|
|
46
|
+
function UserHelper() {
|
|
47
|
+
}
|
|
48
|
+
UserHelper.isCurrentUserInScope = function (personas, context) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
var userIsPartOfThis, i, personaItem, _a, userIsMemberOfSPGroup, personaItemId, userIsMemberOfSecGroup;
|
|
51
|
+
return __generator(this, function (_b) {
|
|
52
|
+
switch (_b.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
userIsPartOfThis = false;
|
|
55
|
+
i = 0;
|
|
56
|
+
_b.label = 1;
|
|
57
|
+
case 1:
|
|
58
|
+
if (!(i < personas.length)) return [3 /*break*/, 9];
|
|
59
|
+
personaItem = personas[i];
|
|
60
|
+
_a = personaItem.type;
|
|
61
|
+
switch (_a) {
|
|
62
|
+
case types_1.ICPersonaType.SPGroup: return [3 /*break*/, 2];
|
|
63
|
+
case types_1.ICPersonaType.User: return [3 /*break*/, 4];
|
|
64
|
+
case types_1.ICPersonaType.Other: return [3 /*break*/, 5];
|
|
65
|
+
}
|
|
66
|
+
return [3 /*break*/, 7];
|
|
67
|
+
case 2: return [4 /*yield*/, context.isCurrentUserMemberOfSPGroup(Number.parseInt(personaItem.id))];
|
|
68
|
+
case 3:
|
|
69
|
+
userIsMemberOfSPGroup = _b.sent();
|
|
70
|
+
if (userIsMemberOfSPGroup) {
|
|
71
|
+
userIsPartOfThis = true;
|
|
72
|
+
}
|
|
73
|
+
return [3 /*break*/, 7];
|
|
74
|
+
case 4:
|
|
75
|
+
{
|
|
76
|
+
// handle a username exact match and partial match in case picker is in format 'i:0#.f|membership|USERNAME'
|
|
77
|
+
if (personaItem.id.toLowerCase() === context.userName.toLowerCase() ||
|
|
78
|
+
personaItem.id.toLowerCase() ===
|
|
79
|
+
context.claimBasedLoginName.toLowerCase() ||
|
|
80
|
+
(personaItem.id.indexOf('|') > -1 &&
|
|
81
|
+
personaItem.id
|
|
82
|
+
.toLowerCase()
|
|
83
|
+
.endsWith('|' + context.userName.toLowerCase()))) {
|
|
84
|
+
userIsPartOfThis = true;
|
|
85
|
+
}
|
|
86
|
+
return [3 /*break*/, 7];
|
|
87
|
+
}
|
|
88
|
+
_b.label = 5;
|
|
89
|
+
case 5:
|
|
90
|
+
personaItemId = personaItem.id;
|
|
91
|
+
// Check if this is the infamous "Everyone except external users" group, in which case we need special treatment
|
|
92
|
+
if (personaItemId.indexOf('c:0-.f|rolemanager|spo-grid-all-users/') === 0) {
|
|
93
|
+
// There you have it: we need special treatment.
|
|
94
|
+
// If this is an external user, break, otherwise, assume user is member of group
|
|
95
|
+
if (context.claimBasedLoginName.indexOf('#ext#') === -1) {
|
|
96
|
+
// This is an internal user
|
|
97
|
+
userIsPartOfThis = true;
|
|
98
|
+
}
|
|
99
|
+
return [3 /*break*/, 7];
|
|
100
|
+
}
|
|
101
|
+
// Check if the id of the picker item contains a pipe, this means we need to strip the id
|
|
102
|
+
if (personaItemId.indexOf('|') > -1) {
|
|
103
|
+
personaItemId = personaItemId.split('|').slice(-1)[0];
|
|
104
|
+
}
|
|
105
|
+
return [4 /*yield*/, context.isCurrentUserMemberOfSecGroup(personaItemId)];
|
|
106
|
+
case 6:
|
|
107
|
+
userIsMemberOfSecGroup = _b.sent();
|
|
108
|
+
if (userIsMemberOfSecGroup) {
|
|
109
|
+
userIsPartOfThis = true;
|
|
110
|
+
}
|
|
111
|
+
return [3 /*break*/, 7];
|
|
112
|
+
case 7:
|
|
113
|
+
if (userIsPartOfThis)
|
|
114
|
+
return [3 /*break*/, 9];
|
|
115
|
+
_b.label = 8;
|
|
116
|
+
case 8:
|
|
117
|
+
i++;
|
|
118
|
+
return [3 /*break*/, 1];
|
|
119
|
+
case 9: return [2 /*return*/, userIsPartOfThis];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
UserHelper.gatherAllNormalizedUserPersonaIds = function (userName, claimBasedLoginName, spGroups, secGroups) {
|
|
125
|
+
var personas = [];
|
|
126
|
+
// 1. The user name in two known shapes
|
|
127
|
+
personas.push("USER|".concat(userName.toLowerCase()));
|
|
128
|
+
personas.push("USER|".concat(claimBasedLoginName.toLowerCase()));
|
|
129
|
+
// 2. The SP Groups, just as they are: numeric strings
|
|
130
|
+
spGroups.forEach(function (spg) {
|
|
131
|
+
personas.push("SPGROUP|".concat(spg));
|
|
132
|
+
});
|
|
133
|
+
// 3. The Security Groups, as Guids
|
|
134
|
+
secGroups.forEach(function (secg) {
|
|
135
|
+
personas.push("ADGROUP|".concat(secg.toLowerCase()));
|
|
136
|
+
});
|
|
137
|
+
// 4. Optionally the all users except external users group:
|
|
138
|
+
if (claimBasedLoginName.indexOf('#ext#') === -1) {
|
|
139
|
+
// This is an internal user
|
|
140
|
+
personas.push('ADGROUP|spo-grid-all-users');
|
|
141
|
+
}
|
|
142
|
+
return personas;
|
|
143
|
+
};
|
|
144
|
+
return UserHelper;
|
|
145
|
+
}());
|
|
146
|
+
exports.UserHelper = UserHelper;
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './ConfigurationHelper';
|
|
2
|
-
export * from './UserHelper';
|
|
1
|
+
export * from './ConfigurationHelper';
|
|
2
|
+
export * from './UserHelper';
|
package/lib/utils/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ConfigurationHelper"), exports);
|
|
18
|
+
__exportStar(require("./UserHelper"), exports);
|
package/package.json
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@ichicraft/widgets-widget-base",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"prepare": "tsc"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"ichicraft",
|
|
13
|
-
"widget",
|
|
14
|
-
"widgets"
|
|
15
|
-
],
|
|
16
|
-
"author": "Ichicraft",
|
|
17
|
-
"license": "ISC",
|
|
18
|
-
"files": [
|
|
19
|
-
"lib/**/*"
|
|
20
|
-
],
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
}
|
|
24
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@ichicraft/widgets-widget-base",
|
|
3
|
+
"version": "1.9.4",
|
|
4
|
+
"description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"types": "lib/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepare": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"ichicraft",
|
|
13
|
+
"widget",
|
|
14
|
+
"widgets"
|
|
15
|
+
],
|
|
16
|
+
"author": "Ichicraft",
|
|
17
|
+
"license": "ISC",
|
|
18
|
+
"files": [
|
|
19
|
+
"lib/**/*"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@microsoft/sp-http": "1.18.2"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"typescript": "^5.4.5"
|
|
26
|
+
}
|
|
27
|
+
}
|