@ichicraft/widgets-widget-base 1.7.3 → 1.7.7
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 +16 -0
- package/lib/types/index.d.ts +52 -0
- package/lib/utils/UserHelper.d.ts +1 -0
- package/lib/utils/UserHelper.js +20 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -8,6 +8,22 @@ All notable changes to this project will be documented here.
|
|
|
8
8
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
9
9
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
10
10
|
|
|
11
|
+
## 1.7.7 - 2022-01-14
|
|
12
|
+
### Changed
|
|
13
|
+
* Added `tenantId` property to the `WidgetContext` interface.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## 1.7.6 - 2021-11-04
|
|
17
|
+
### Changed
|
|
18
|
+
* Added `theme` property to the `WidgetContext` interface to give access to currently applied theme.
|
|
19
|
+
|
|
20
|
+
## 1.7.5 - 2021-10-26
|
|
21
|
+
### Changed
|
|
22
|
+
* Added `userSecurityGroups` and `userSharePointGroups` properties to the `WidgetContext` interface to inform widgets of SharePoint and security group memberships of the current user.
|
|
23
|
+
|
|
24
|
+
## 1.7.4 - 2021-10-20
|
|
25
|
+
### Changed
|
|
26
|
+
* Added `contentLanguages` property to the `WidgetContext` interface to inform widgets of the available content languages as configured in Ichicraft Boards.
|
|
11
27
|
|
|
12
28
|
## 1.7.3 - 2021-10-04
|
|
13
29
|
### Changed
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MSGraphClientFactory, AadTokenProviderFactory, AadHttpClientFactory } from '@microsoft/sp-http';
|
|
2
|
+
import { IReadonlyTheme } from '@microsoft/sp-component-base';
|
|
2
3
|
import * as microsoftTeams from '@microsoft/teams-js';
|
|
3
4
|
/**
|
|
4
5
|
* Widget context providing widget metadata and functionality offered by the widget board
|
|
@@ -116,6 +117,10 @@ export interface WidgetContext {
|
|
|
116
117
|
* Tells whether the widget board is running in a mobile webview context
|
|
117
118
|
*/
|
|
118
119
|
isMobileWebView: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Tenant ID of current SharePoint tenant
|
|
122
|
+
*/
|
|
123
|
+
tenantId: string;
|
|
119
124
|
/**
|
|
120
125
|
* Site url of the site where the widget board is running
|
|
121
126
|
*/
|
|
@@ -131,14 +136,57 @@ export interface WidgetContext {
|
|
|
131
136
|
* Example: `"example@contoso.com"`
|
|
132
137
|
*/
|
|
133
138
|
userEmail: string;
|
|
139
|
+
/**
|
|
140
|
+
* SharePoint ID of the user in the current site
|
|
141
|
+
*/
|
|
142
|
+
spUserId: number;
|
|
134
143
|
/**
|
|
135
144
|
* Login name of current user in claim style: i:0#.f|myprovider|myuser
|
|
136
145
|
*/
|
|
137
146
|
claimBasedLoginName: string;
|
|
147
|
+
/**
|
|
148
|
+
* Azure AD Security groups that user is member of
|
|
149
|
+
*/
|
|
150
|
+
userSecurityGroups: string[];
|
|
151
|
+
/**
|
|
152
|
+
* SharePoint groups in this site collection that user is member of
|
|
153
|
+
*/
|
|
154
|
+
userSharePointGroups: number[];
|
|
138
155
|
/**
|
|
139
156
|
* Language code of currently used UI rendering language in SharePoint
|
|
140
157
|
*/
|
|
141
158
|
language: string;
|
|
159
|
+
/**
|
|
160
|
+
* List of supported languages as configured in Widget Board configuration
|
|
161
|
+
/**
|
|
162
|
+
*
|
|
163
|
+
*/
|
|
164
|
+
contentLanguages: {
|
|
165
|
+
/**
|
|
166
|
+
* Numeric Locale ID, like 1033 for English - United States
|
|
167
|
+
*/
|
|
168
|
+
LCID: number;
|
|
169
|
+
/**
|
|
170
|
+
* Language code, like 'en-US' for English - United States
|
|
171
|
+
*/
|
|
172
|
+
BCP47LanguageTag: string;
|
|
173
|
+
/**
|
|
174
|
+
* 2 or 3 character uppercase language code, like 'EN' for English - United States
|
|
175
|
+
*/
|
|
176
|
+
abbreviatedCode: string;
|
|
177
|
+
/**
|
|
178
|
+
* Friendly name of the language, translated in the currently used UI language
|
|
179
|
+
*/
|
|
180
|
+
friendlyName: string;
|
|
181
|
+
/**
|
|
182
|
+
* Whether this is the default UI language of the Widget Board
|
|
183
|
+
*/
|
|
184
|
+
isDefault?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Whether this is the current UI language of the Widget Board
|
|
187
|
+
*/
|
|
188
|
+
isCurrent?: boolean;
|
|
189
|
+
}[];
|
|
142
190
|
/**
|
|
143
191
|
* MS Graph Client Factory class as provided by the WebPartContext object.
|
|
144
192
|
*/
|
|
@@ -151,6 +199,10 @@ export interface WidgetContext {
|
|
|
151
199
|
* AAD Token Provider Factory class as provided by the WebPartContext object.
|
|
152
200
|
*/
|
|
153
201
|
aadTokenProviderFactory: AadTokenProviderFactory;
|
|
202
|
+
/**
|
|
203
|
+
* Currently in use theme (by SharePoint/Teams)
|
|
204
|
+
*/
|
|
205
|
+
theme: IReadonlyTheme;
|
|
154
206
|
/**
|
|
155
207
|
* Returns whether or not the currently signed in user is part of an AAD security group.
|
|
156
208
|
* Provide the guid of the group.
|
|
@@ -5,4 +5,5 @@ import { ICPersona, WidgetContext } from '../types';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class UserHelper {
|
|
7
7
|
static isCurrentUserInScope(personas: ICPersona[], context: WidgetContext): Promise<boolean>;
|
|
8
|
+
static gatherAllNormalizedUserPersonaIds(userName: string, claimBasedLoginName: string, spGroups: number[], secGroups: string[]): string[];
|
|
8
9
|
}
|
package/lib/utils/UserHelper.js
CHANGED
|
@@ -120,6 +120,26 @@ var UserHelper = /** @class */ (function () {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
};
|
|
123
|
+
UserHelper.gatherAllNormalizedUserPersonaIds = function (userName, claimBasedLoginName, spGroups, secGroups) {
|
|
124
|
+
var personas = [];
|
|
125
|
+
// 1. The user name in two known shapes
|
|
126
|
+
personas.push("USER|" + userName.toLowerCase());
|
|
127
|
+
personas.push("USER|" + claimBasedLoginName.toLowerCase());
|
|
128
|
+
// 2. The SP Groups, just as they are: numeric strings
|
|
129
|
+
spGroups.forEach(function (spg) {
|
|
130
|
+
personas.push("SPGROUP|" + spg);
|
|
131
|
+
});
|
|
132
|
+
// 3. The Security Groups, as Guids
|
|
133
|
+
secGroups.forEach(function (secg) {
|
|
134
|
+
personas.push("ADGROUP|" + secg.toLowerCase());
|
|
135
|
+
});
|
|
136
|
+
// 4. Optionally the all users except external users group:
|
|
137
|
+
if (claimBasedLoginName.indexOf('#ext#') === -1) {
|
|
138
|
+
// This is an internal user
|
|
139
|
+
personas.push('ADGROUP|spo-grid-all-users');
|
|
140
|
+
}
|
|
141
|
+
return personas;
|
|
142
|
+
};
|
|
123
143
|
return UserHelper;
|
|
124
144
|
}());
|
|
125
145
|
exports.UserHelper = UserHelper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichicraft/widgets-widget-base",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.7",
|
|
4
4
|
"description": "Part of the Widget Development Kit for building widgets for Ichicraft Boards",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"lib/**/*"
|
|
20
20
|
],
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@microsoft/sp-
|
|
23
|
-
"@microsoft/
|
|
22
|
+
"@microsoft/sp-component-base": "^1.11.0",
|
|
23
|
+
"@microsoft/sp-http": "1.11.0",
|
|
24
|
+
"@microsoft/teams-js": "1.9.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"typescript": "^3.6.4"
|