dattatable 2.9.0 → 2.9.2-t
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/build/common/documents.js +1 -1
- package/build/common/itemForm.d.ts +1 -0
- package/build/common/itemForm.js +1 -0
- package/build/common/listSecurity.d.ts +24 -4
- package/build/common/listSecurity.js +331 -87
- package/build/lib.d.ts +5 -0
- package/build/styles.js +1 -1
- package/dist/dattatable.js +493 -471
- package/dist/dattatable.min.js +1 -1
- package/docs/assets/main.js +58 -53
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +496 -370
- package/docs/classes/AuditLog.html +14 -235
- package/docs/classes/CanvasForm.html +18 -255
- package/docs/classes/Comments.html +14 -229
- package/docs/classes/Dashboard.html +23 -304
- package/docs/classes/DataTable.html +14 -236
- package/docs/classes/Documents.html +51 -551
- package/docs/classes/FilterSlideout.html +15 -219
- package/docs/classes/Footer.html +5 -106
- package/docs/classes/Header.html +5 -106
- package/docs/classes/InstallationRequired.html +14 -205
- package/docs/classes/ItemForm.html +49 -679
- package/docs/classes/List.html +50 -631
- package/docs/classes/ListSecurity.html +28 -254
- package/docs/classes/LoadingDialog.html +13 -187
- package/docs/classes/Modal.html +27 -374
- package/docs/classes/Navigation.html +8 -125
- package/docs/classes/Timeout.html +9 -141
- package/docs/enums/ActionButtonTypes.html +7 -95
- package/docs/functions/formatBytes.html +1 -103
- package/docs/functions/formatDateValue.html +1 -103
- package/docs/functions/formatTimeValue.html +1 -103
- package/docs/functions/getFileExt.html +1 -101
- package/docs/index.html +8 -122
- package/docs/interfaces/IAuditLogItem.html +81 -1065
- package/docs/interfaces/IAuditLogItemCreation.html +7 -105
- package/docs/interfaces/IAuditLogProps.html +5 -110
- package/docs/interfaces/IAuditLogViewProps.html +6 -139
- package/docs/interfaces/ICommentsItem.html +6 -105
- package/docs/interfaces/IDashboardProps.html +14 -427
- package/docs/interfaces/IDataTable.html +9 -204
- package/docs/interfaces/IDataTableProps.html +7 -114
- package/docs/interfaces/IDocumentsProps.html +26 -562
- package/docs/interfaces/IFilterItem.html +6 -105
- package/docs/interfaces/IFilterProps.html +5 -106
- package/docs/interfaces/IFooterProps.html +7 -125
- package/docs/interfaces/IHeaderProps.html +6 -118
- package/docs/interfaces/IInstallProps.html +4 -103
- package/docs/interfaces/IItemFormCreateProps.html +15 -274
- package/docs/interfaces/IItemFormEditProps.html +16 -281
- package/docs/interfaces/IItemFormTab.html +9 -167
- package/docs/interfaces/IItemFormTabInfo.html +5 -78
- package/docs/interfaces/IItemFormViewProps.html +13 -219
- package/docs/interfaces/IListProps.html +12 -207
- package/docs/interfaces/IListSecurity.html +7 -122
- package/docs/interfaces/IListSecurityItem.html +4 -82
- package/docs/interfaces/IShowDialogProps.html +7 -153
- package/docs/modules.html +48 -150
- package/docs/variables/DattaTable.html +1 -153
- package/docs/variables/ListSecurityDefaultGroups.html +1 -0
- package/package.json +18 -18
- package/pnpm-lock.yaml +1332 -1142
|
@@ -820,7 +820,7 @@ var Documents = /** @class */ (function () {
|
|
|
820
820
|
Documents.prototype.renderFileIcon = function (el, fileName) {
|
|
821
821
|
// Render the icon wrapper
|
|
822
822
|
var span = document.createElement("span");
|
|
823
|
-
span.className = "text-
|
|
823
|
+
span.className = "text-body";
|
|
824
824
|
el.appendChild(span);
|
|
825
825
|
// Render the icon
|
|
826
826
|
var size = 28;
|
package/build/common/itemForm.js
CHANGED
|
@@ -4,6 +4,9 @@ export interface IListSecurity {
|
|
|
4
4
|
listItems: IListSecurityItem[];
|
|
5
5
|
onGroupCreating?: (props: Types.SP.GroupCreationInformation) => Types.SP.GroupCreationInformation;
|
|
6
6
|
onGroupCreated?: (group: Types.SP.Group) => void;
|
|
7
|
+
onGroupsLoaded?: (groups?: {
|
|
8
|
+
[key: string]: Types.SP.Group;
|
|
9
|
+
}) => void;
|
|
7
10
|
webUrl?: string;
|
|
8
11
|
}
|
|
9
12
|
export interface IListSecurityItem {
|
|
@@ -11,6 +14,11 @@ export interface IListSecurityItem {
|
|
|
11
14
|
listName: string;
|
|
12
15
|
permission: number | string;
|
|
13
16
|
}
|
|
17
|
+
export declare const ListSecurityDefaultGroups: {
|
|
18
|
+
Members: string;
|
|
19
|
+
Owners: string;
|
|
20
|
+
Visitors: string;
|
|
21
|
+
};
|
|
14
22
|
/**
|
|
15
23
|
* List Security
|
|
16
24
|
* This component is used for setting the security group/permissions for a list.
|
|
@@ -19,15 +27,27 @@ export declare class ListSecurity {
|
|
|
19
27
|
private _ddlItems;
|
|
20
28
|
private _permissionTypes;
|
|
21
29
|
private _props;
|
|
30
|
+
private _currentUser;
|
|
31
|
+
get CurrentUser(): Types.SP.User;
|
|
32
|
+
private _groups;
|
|
33
|
+
getGroup(groupName: string): Types.SP.Group;
|
|
34
|
+
private setGroup;
|
|
35
|
+
private _groupUsers;
|
|
36
|
+
getGroupUsers(groupName: string): Types.SP.User[];
|
|
37
|
+
private addUser;
|
|
38
|
+
private removeUser;
|
|
22
39
|
constructor(props: IListSecurity);
|
|
40
|
+
addToGroup(userId: number, groupName: string): PromiseLike<void>;
|
|
23
41
|
private configureList;
|
|
24
42
|
private configureLists;
|
|
25
43
|
private createGroups;
|
|
26
|
-
private _groups;
|
|
27
44
|
private getGroupId;
|
|
28
|
-
private setGroupId;
|
|
29
|
-
private renderModal;
|
|
30
45
|
private getPermissionTypes;
|
|
46
|
+
isInGroup(userId: number, groupName: string): boolean;
|
|
47
|
+
private loadCurrentUser;
|
|
48
|
+
private loadGroups;
|
|
49
|
+
removeFromGroup(userId: number, groupName: string): PromiseLike<void>;
|
|
50
|
+
private renderModal;
|
|
31
51
|
private resetPermissions;
|
|
32
|
-
show(createFl?: boolean): void;
|
|
52
|
+
show(createFl?: boolean, onComplete?: () => void): void;
|
|
33
53
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListSecurity = void 0;
|
|
3
|
+
exports.ListSecurity = exports.ListSecurityDefaultGroups = void 0;
|
|
4
4
|
var gd_sprest_bs_1 = require("gd-sprest-bs");
|
|
5
5
|
var loadingDialog_1 = require("./loadingDialog");
|
|
6
6
|
var modal_1 = require("./modal");
|
|
7
|
+
// List Security Default Groups
|
|
8
|
+
exports.ListSecurityDefaultGroups = {
|
|
9
|
+
Members: "member",
|
|
10
|
+
Owners: "owner",
|
|
11
|
+
Visitors: "visitor"
|
|
12
|
+
};
|
|
7
13
|
/**
|
|
8
14
|
* List Security
|
|
9
15
|
* This component is used for setting the security group/permissions for a list.
|
|
@@ -14,13 +20,82 @@ var ListSecurity = /** @class */ (function () {
|
|
|
14
20
|
this._ddlItems = null;
|
|
15
21
|
this._permissionTypes = null;
|
|
16
22
|
this._props = null;
|
|
17
|
-
//
|
|
23
|
+
// Current User
|
|
24
|
+
this._currentUser = null;
|
|
25
|
+
// Security group information
|
|
18
26
|
this._groups = {};
|
|
27
|
+
// Security group users
|
|
28
|
+
this._groupUsers = {};
|
|
19
29
|
// Save the properties
|
|
20
30
|
this._props = props;
|
|
31
|
+
// Get the current user information
|
|
32
|
+
this.loadCurrentUser();
|
|
21
33
|
// Get the permission types
|
|
22
34
|
this.getPermissionTypes();
|
|
35
|
+
// Load the groups
|
|
36
|
+
this.loadGroups();
|
|
23
37
|
}
|
|
38
|
+
Object.defineProperty(ListSecurity.prototype, "CurrentUser", {
|
|
39
|
+
get: function () { return this._currentUser; },
|
|
40
|
+
enumerable: false,
|
|
41
|
+
configurable: true
|
|
42
|
+
});
|
|
43
|
+
ListSecurity.prototype.getGroup = function (groupName) { return this._groups[groupName.toLowerCase()]; };
|
|
44
|
+
ListSecurity.prototype.setGroup = function (key, group) {
|
|
45
|
+
// Save the info
|
|
46
|
+
this._groups[key] = group;
|
|
47
|
+
this._groupUsers[key] = [];
|
|
48
|
+
// See if the users exist
|
|
49
|
+
if (group.Users) {
|
|
50
|
+
// Set the users for this group
|
|
51
|
+
this._groupUsers[key] = group.Users.results || [];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
ListSecurity.prototype.getGroupUsers = function (groupName) { return this._groupUsers[groupName.toLowerCase()] || []; };
|
|
55
|
+
ListSecurity.prototype.addUser = function (user, groupName) {
|
|
56
|
+
// Ensure the group exists
|
|
57
|
+
var key = groupName.toLowerCase();
|
|
58
|
+
if (this._groupUsers[key]) {
|
|
59
|
+
// Add the user to the group
|
|
60
|
+
this._groupUsers[key].push(user);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
ListSecurity.prototype.removeUser = function (userId, groupName) {
|
|
64
|
+
// Ensure the group exists
|
|
65
|
+
var key = groupName.toLowerCase();
|
|
66
|
+
if (this._groupUsers[key]) {
|
|
67
|
+
// Find the idx of the user
|
|
68
|
+
for (var i = 0; i < this._groupUsers[key].length; i++) {
|
|
69
|
+
// See if this is the user
|
|
70
|
+
var user = this._groupUsers[key][i];
|
|
71
|
+
if (user.Id == userId) {
|
|
72
|
+
// Remove the user
|
|
73
|
+
this._groupUsers[key].splice(i, 1);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
// Method to check if the user is w/in a group and add them otherwise
|
|
80
|
+
ListSecurity.prototype.addToGroup = function (userId, groupName) {
|
|
81
|
+
var _this = this;
|
|
82
|
+
// Return a promise
|
|
83
|
+
return new Promise(function (resolve, reject) {
|
|
84
|
+
// See if the user is in the group
|
|
85
|
+
if (_this.isInGroup(userId, groupName)) {
|
|
86
|
+
// Resolve the request
|
|
87
|
+
resolve();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// Add the user to the group
|
|
91
|
+
_this._groups[groupName].Users().addUserById(userId).execute(function (user) {
|
|
92
|
+
// Add the user to the group
|
|
93
|
+
_this.addUser(user, groupName);
|
|
94
|
+
// Resolve the request
|
|
95
|
+
resolve();
|
|
96
|
+
}, reject);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
24
99
|
// Configures a list
|
|
25
100
|
ListSecurity.prototype.configureList = function (listInfo) {
|
|
26
101
|
var _this = this;
|
|
@@ -58,22 +133,25 @@ var ListSecurity = /** @class */ (function () {
|
|
|
58
133
|
// Configures the lists
|
|
59
134
|
ListSecurity.prototype.configureLists = function (lists) {
|
|
60
135
|
var _this = this;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
136
|
+
// Return a promise
|
|
137
|
+
return new Promise(function (resolve, reject) {
|
|
138
|
+
var counter = 0;
|
|
139
|
+
// Show a loading dialog
|
|
140
|
+
loadingDialog_1.LoadingDialog.setHeader("Configuring Lists");
|
|
141
|
+
loadingDialog_1.LoadingDialog.setBody("This will close after the lists are configured...");
|
|
142
|
+
loadingDialog_1.LoadingDialog.show();
|
|
143
|
+
// Reset the lists
|
|
144
|
+
_this.resetPermissions(lists).then(function () {
|
|
145
|
+
// Parse the lists
|
|
146
|
+
gd_sprest_bs_1.Helper.Executor(lists, function (list) {
|
|
147
|
+
// Return a promise
|
|
148
|
+
return new Promise(function (resolve) {
|
|
149
|
+
// Update the loading dialog
|
|
150
|
+
loadingDialog_1.LoadingDialog.setBody("Configuring ".concat(++counter, " of ").concat(lists.length, " lists..."));
|
|
151
|
+
// Configure the list
|
|
152
|
+
_this.configureList(list).then(resolve);
|
|
153
|
+
});
|
|
154
|
+
}).then(resolve, reject);
|
|
77
155
|
});
|
|
78
156
|
});
|
|
79
157
|
};
|
|
@@ -98,9 +176,9 @@ var ListSecurity = /** @class */ (function () {
|
|
|
98
176
|
// Get the group
|
|
99
177
|
_this.getGroupId(groupInfo.Title).then(
|
|
100
178
|
// Group exists
|
|
101
|
-
function (
|
|
179
|
+
function () {
|
|
102
180
|
// Check the next group
|
|
103
|
-
resolve(
|
|
181
|
+
resolve(null);
|
|
104
182
|
},
|
|
105
183
|
// Group doesn't exist
|
|
106
184
|
function () {
|
|
@@ -117,7 +195,7 @@ var ListSecurity = /** @class */ (function () {
|
|
|
117
195
|
// Successfully created the group
|
|
118
196
|
function (group) {
|
|
119
197
|
// Set the group id
|
|
120
|
-
_this.
|
|
198
|
+
_this.setGroup(groupInfo.Title.toLowerCase(), group);
|
|
121
199
|
// Call the event
|
|
122
200
|
_this._props.onGroupCreated ? _this._props.onGroupCreated(group) : null;
|
|
123
201
|
// Check the next group
|
|
@@ -132,9 +210,10 @@ var ListSecurity = /** @class */ (function () {
|
|
|
132
210
|
});
|
|
133
211
|
});
|
|
134
212
|
});
|
|
135
|
-
});
|
|
213
|
+
}).then(resolve, reject);
|
|
136
214
|
});
|
|
137
215
|
};
|
|
216
|
+
// Gets the group id
|
|
138
217
|
ListSecurity.prototype.getGroupId = function (groupName) {
|
|
139
218
|
var _this = this;
|
|
140
219
|
// Return a promise
|
|
@@ -149,43 +228,203 @@ var ListSecurity = /** @class */ (function () {
|
|
|
149
228
|
// Get the group information
|
|
150
229
|
switch (key) {
|
|
151
230
|
// Default owner's group
|
|
152
|
-
case
|
|
153
|
-
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedOwnerGroup().
|
|
231
|
+
case exports.ListSecurityDefaultGroups.Owners:
|
|
232
|
+
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedOwnerGroup().query({
|
|
233
|
+
Expand: ["Users"]
|
|
234
|
+
}).execute(function (group) {
|
|
235
|
+
_this.setGroup(key, group);
|
|
236
|
+
_this.setGroup(group.Title.toLowerCase(), group);
|
|
237
|
+
resolve(group.Id);
|
|
238
|
+
}, reject);
|
|
154
239
|
break;
|
|
155
240
|
// Default member's group
|
|
156
|
-
case
|
|
157
|
-
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedMemberGroup().
|
|
241
|
+
case exports.ListSecurityDefaultGroups.Members:
|
|
242
|
+
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedMemberGroup().query({
|
|
243
|
+
Expand: ["Users"]
|
|
244
|
+
}).execute(function (group) {
|
|
245
|
+
_this.setGroup(key, group);
|
|
246
|
+
_this.setGroup(group.Title.toLowerCase(), group);
|
|
247
|
+
resolve(group.Id);
|
|
248
|
+
}, reject);
|
|
158
249
|
break;
|
|
159
250
|
// Default visitor's group
|
|
160
|
-
case
|
|
161
|
-
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedVisitorGroup().
|
|
251
|
+
case exports.ListSecurityDefaultGroups.Visitors:
|
|
252
|
+
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).AssociatedVisitorGroup().query({
|
|
253
|
+
Expand: ["Users"]
|
|
254
|
+
}).execute(function (group) {
|
|
255
|
+
_this.setGroup(key, group);
|
|
256
|
+
_this.setGroup(group.Title.toLowerCase(), group);
|
|
257
|
+
resolve(group.Id);
|
|
258
|
+
}, reject);
|
|
162
259
|
break;
|
|
163
260
|
// Default
|
|
164
261
|
default:
|
|
165
262
|
// Get the group
|
|
166
|
-
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().getByName(groupName).
|
|
263
|
+
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).SiteGroups().getByName(groupName).query({
|
|
264
|
+
Expand: ["Users"]
|
|
265
|
+
}).execute(function (group) {
|
|
266
|
+
_this.setGroup(key, group);
|
|
267
|
+
resolve(group.Id);
|
|
268
|
+
}, reject);
|
|
167
269
|
break;
|
|
168
270
|
}
|
|
169
271
|
});
|
|
170
272
|
};
|
|
171
|
-
//
|
|
172
|
-
ListSecurity.prototype.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
273
|
+
// Get the permission types
|
|
274
|
+
ListSecurity.prototype.getPermissionTypes = function () {
|
|
275
|
+
var _this = this;
|
|
276
|
+
// Return a promise
|
|
277
|
+
return new Promise(function (resolve) {
|
|
278
|
+
// Get the definitions
|
|
279
|
+
(0, gd_sprest_bs_1.Web)(_this._props.webUrl).RoleDefinitions().query({
|
|
280
|
+
OrderBy: ["Name"]
|
|
281
|
+
}).execute(function (roleDefs) {
|
|
282
|
+
// Clear the permissions and items
|
|
283
|
+
_this._ddlItems = [{ text: "No Permission" }];
|
|
284
|
+
_this._permissionTypes = {};
|
|
285
|
+
// Parse the role definitions
|
|
286
|
+
for (var i = 0; i < roleDefs.results.length; i++) {
|
|
287
|
+
var roleDef = roleDefs.results[i];
|
|
288
|
+
// Add the role and item
|
|
289
|
+
var value = roleDef.RoleTypeKind > 0 ? roleDef.RoleTypeKind : roleDef.Name;
|
|
290
|
+
_this._permissionTypes[value] = roleDef.Id;
|
|
291
|
+
_this._ddlItems.push({
|
|
292
|
+
data: roleDef,
|
|
293
|
+
text: roleDef.Name,
|
|
294
|
+
value: value.toString()
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
// Resolve the request
|
|
298
|
+
resolve();
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
// Method to see if a user is w/in a group
|
|
303
|
+
ListSecurity.prototype.isInGroup = function (userId, groupName) {
|
|
304
|
+
// See if we have the user information
|
|
305
|
+
var users = this.getGroupUsers(groupName);
|
|
306
|
+
for (var i = 0; i < users.length; i++) {
|
|
307
|
+
// See if the user is in this group
|
|
308
|
+
if (users[i].Id == userId) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
// Not in the group
|
|
313
|
+
return false;
|
|
314
|
+
};
|
|
315
|
+
// Loads the current user
|
|
316
|
+
ListSecurity.prototype.loadCurrentUser = function () {
|
|
317
|
+
var _this = this;
|
|
318
|
+
// Load the current user
|
|
319
|
+
(0, gd_sprest_bs_1.Web)(this._props.webUrl).CurrentUser().execute(
|
|
320
|
+
// Success
|
|
321
|
+
function (user) {
|
|
322
|
+
// Set the user
|
|
323
|
+
_this._currentUser = user;
|
|
324
|
+
},
|
|
325
|
+
// Error
|
|
326
|
+
function () {
|
|
327
|
+
// Log
|
|
328
|
+
console.error("Unable to load the current user");
|
|
329
|
+
// Set the information from the context info
|
|
330
|
+
_this._currentUser = {
|
|
331
|
+
Email: gd_sprest_bs_1.ContextInfo.userEmail,
|
|
332
|
+
Id: gd_sprest_bs_1.ContextInfo.userId,
|
|
333
|
+
LoginName: gd_sprest_bs_1.ContextInfo.userLoginName,
|
|
334
|
+
Title: gd_sprest_bs_1.ContextInfo.userDisplayName,
|
|
335
|
+
UserPrincipalName: gd_sprest_bs_1.ContextInfo.userPrincipalName
|
|
336
|
+
};
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
// Loads the security groups
|
|
340
|
+
ListSecurity.prototype.loadGroups = function () {
|
|
341
|
+
var _this = this;
|
|
342
|
+
var groupNames = [];
|
|
343
|
+
// Parse the security groups
|
|
344
|
+
var groups = this._props.groups || [];
|
|
345
|
+
for (var i = 0; i < groups.length; i++) {
|
|
346
|
+
// Add the group name
|
|
347
|
+
groupNames.push(groups[i].Title);
|
|
348
|
+
}
|
|
349
|
+
// Parse the list items
|
|
350
|
+
var loadDefaultOwner = false;
|
|
351
|
+
var loadDefaultMember = false;
|
|
352
|
+
var loadDefaultVisitor = false;
|
|
353
|
+
for (var i = 0; i < this._props.listItems.length; i++) {
|
|
354
|
+
// See if this item uses a default group name
|
|
355
|
+
switch (this._props.listItems[i].groupName) {
|
|
356
|
+
// Members Group
|
|
357
|
+
case exports.ListSecurityDefaultGroups.Members:
|
|
358
|
+
loadDefaultMember = true;
|
|
359
|
+
break;
|
|
360
|
+
// Owners Group
|
|
361
|
+
case exports.ListSecurityDefaultGroups.Owners:
|
|
362
|
+
loadDefaultOwner = true;
|
|
363
|
+
break;
|
|
364
|
+
// Visitors Group
|
|
365
|
+
case exports.ListSecurityDefaultGroups.Visitors:
|
|
366
|
+
loadDefaultVisitor = true;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// Append the group names
|
|
371
|
+
loadDefaultMember ? groupNames.push(exports.ListSecurityDefaultGroups.Members) : null;
|
|
372
|
+
loadDefaultOwner ? groupNames.push(exports.ListSecurityDefaultGroups.Owners) : null;
|
|
373
|
+
loadDefaultVisitor ? groupNames.push(exports.ListSecurityDefaultGroups.Visitors) : null;
|
|
374
|
+
// Parse the security groups
|
|
375
|
+
gd_sprest_bs_1.Helper.Executor(groupNames, function (groupName) {
|
|
376
|
+
// Return a promise
|
|
377
|
+
return new Promise(function (resolve) {
|
|
378
|
+
// Load the group
|
|
379
|
+
_this.getGroupId(groupName).then(resolve, resolve);
|
|
380
|
+
});
|
|
381
|
+
}).then(function () {
|
|
382
|
+
// Call the event
|
|
383
|
+
_this._props.onGroupsLoaded ? _this._props.onGroupsLoaded(_this._groups) : null;
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
// Method remove a user from a specified group
|
|
387
|
+
ListSecurity.prototype.removeFromGroup = function (userId, groupName) {
|
|
388
|
+
var _this = this;
|
|
389
|
+
// Return a promise
|
|
390
|
+
return new Promise(function (resolve, reject) {
|
|
391
|
+
// See if the user is not in the group
|
|
392
|
+
if (!_this.isInGroup(userId, groupName)) {
|
|
393
|
+
// Resolve the request
|
|
394
|
+
resolve();
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
// Remove the user from the group
|
|
398
|
+
_this._groups[groupName].Users().removeById(userId).execute(function () {
|
|
399
|
+
// Add the user to the group
|
|
400
|
+
_this.removeUser(userId, groupName);
|
|
401
|
+
// Resolve the request
|
|
402
|
+
resolve();
|
|
403
|
+
}, reject);
|
|
404
|
+
});
|
|
177
405
|
};
|
|
178
406
|
// Render the modal
|
|
179
|
-
ListSecurity.prototype.renderModal = function () {
|
|
407
|
+
ListSecurity.prototype.renderModal = function (onComplete) {
|
|
180
408
|
var _this = this;
|
|
181
409
|
// Clear the modal
|
|
182
410
|
modal_1.Modal.clear();
|
|
183
411
|
// Set the header
|
|
184
412
|
modal_1.Modal.setHeader("List Security");
|
|
413
|
+
// Get the default groups
|
|
414
|
+
var defaultGroups = {};
|
|
415
|
+
defaultGroups[exports.ListSecurityDefaultGroups.Members] = this.getGroup(exports.ListSecurityDefaultGroups.Members);
|
|
416
|
+
defaultGroups[exports.ListSecurityDefaultGroups.Owners] = this.getGroup(exports.ListSecurityDefaultGroups.Owners);
|
|
417
|
+
defaultGroups[exports.ListSecurityDefaultGroups.Visitors] = this.getGroup(exports.ListSecurityDefaultGroups.Visitors);
|
|
185
418
|
// Parse the lists
|
|
186
419
|
var rows = [];
|
|
187
420
|
for (var i = 0; i < this._props.listItems.length; i++) {
|
|
188
421
|
var listItem = this._props.listItems[i];
|
|
422
|
+
// Set the group name
|
|
423
|
+
var groupName = listItem.groupName;
|
|
424
|
+
if (defaultGroups[groupName]) {
|
|
425
|
+
// Set the group name
|
|
426
|
+
groupName = defaultGroups[groupName].Title;
|
|
427
|
+
}
|
|
189
428
|
// Add the row
|
|
190
429
|
rows.push({
|
|
191
430
|
isAutoSized: true,
|
|
@@ -203,7 +442,7 @@ var ListSecurity = /** @class */ (function () {
|
|
|
203
442
|
name: "groupName_" + i,
|
|
204
443
|
label: "Group Name",
|
|
205
444
|
type: gd_sprest_bs_1.Components.FormControlTypes.Readonly,
|
|
206
|
-
value:
|
|
445
|
+
value: groupName
|
|
207
446
|
}
|
|
208
447
|
},
|
|
209
448
|
{
|
|
@@ -221,44 +460,61 @@ var ListSecurity = /** @class */ (function () {
|
|
|
221
460
|
}
|
|
222
461
|
// Render the form
|
|
223
462
|
var form = gd_sprest_bs_1.Components.Form({
|
|
463
|
+
className: "list-security-form",
|
|
224
464
|
el: modal_1.Modal.BodyElement,
|
|
225
465
|
rows: rows
|
|
226
466
|
});
|
|
467
|
+
// Gets the list names
|
|
468
|
+
var getListNames = function () {
|
|
469
|
+
var lists = [];
|
|
470
|
+
// Get the form values
|
|
471
|
+
var tableData = form.getValues();
|
|
472
|
+
// Parse the # of rows
|
|
473
|
+
for (var i = 0; i < rows.length; i++) {
|
|
474
|
+
// Add the list information
|
|
475
|
+
lists.push({
|
|
476
|
+
groupName: tableData["groupName_" + i],
|
|
477
|
+
listName: tableData["listName_" + i],
|
|
478
|
+
permission: tableData["permission_" + i].value
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
// Return the list names
|
|
482
|
+
return lists;
|
|
483
|
+
};
|
|
227
484
|
// Render the footer
|
|
228
485
|
gd_sprest_bs_1.Components.TooltipGroup({
|
|
229
486
|
el: modal_1.Modal.FooterElement,
|
|
230
487
|
tooltips: [
|
|
231
488
|
{
|
|
232
|
-
content: "
|
|
489
|
+
content: "Configure the list to inherit permissions from the web",
|
|
233
490
|
btnProps: {
|
|
234
|
-
text: "
|
|
235
|
-
type: gd_sprest_bs_1.Components.ButtonTypes.
|
|
491
|
+
text: "Inherit",
|
|
492
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
|
|
236
493
|
onClick: function () {
|
|
237
|
-
//
|
|
238
|
-
|
|
494
|
+
// Reset the list permissions
|
|
495
|
+
_this.resetPermissions(getListNames(), false).then(onComplete);
|
|
239
496
|
}
|
|
240
497
|
}
|
|
241
498
|
},
|
|
242
499
|
{
|
|
243
|
-
content: "
|
|
500
|
+
content: "Configure the security for the lists",
|
|
244
501
|
btnProps: {
|
|
245
502
|
text: "Configure",
|
|
246
503
|
type: gd_sprest_bs_1.Components.ButtonTypes.OutlinePrimary,
|
|
247
504
|
onClick: function () {
|
|
248
|
-
var lists = [];
|
|
249
|
-
// Get the form values
|
|
250
|
-
var tableData = form.getValues();
|
|
251
|
-
// Parse the # of rows
|
|
252
|
-
for (var i = 0; i < rows.length; i++) {
|
|
253
|
-
// Add the list information
|
|
254
|
-
lists.push({
|
|
255
|
-
groupName: tableData["groupName_" + i],
|
|
256
|
-
listName: tableData["listName_" + i],
|
|
257
|
-
permission: tableData["permission_" + i]
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
505
|
// Configure the lists
|
|
261
|
-
_this.configureLists(
|
|
506
|
+
_this.configureLists(getListNames()).then(onComplete);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
content: "Close this modal",
|
|
512
|
+
btnProps: {
|
|
513
|
+
text: "Close",
|
|
514
|
+
type: gd_sprest_bs_1.Components.ButtonTypes.OutlineSecondary,
|
|
515
|
+
onClick: function () {
|
|
516
|
+
// Close the modal
|
|
517
|
+
modal_1.Modal.hide();
|
|
262
518
|
}
|
|
263
519
|
}
|
|
264
520
|
}
|
|
@@ -267,36 +523,10 @@ var ListSecurity = /** @class */ (function () {
|
|
|
267
523
|
// Show the modal
|
|
268
524
|
modal_1.Modal.show();
|
|
269
525
|
};
|
|
270
|
-
// Get the permission types
|
|
271
|
-
ListSecurity.prototype.getPermissionTypes = function () {
|
|
272
|
-
var _this = this;
|
|
273
|
-
// Return a promise
|
|
274
|
-
return new Promise(function (resolve) {
|
|
275
|
-
// Get the definitions
|
|
276
|
-
(0, gd_sprest_bs_1.Web)().RoleDefinitions().query({
|
|
277
|
-
OrderBy: ["Name"]
|
|
278
|
-
}).execute(function (roleDefs) {
|
|
279
|
-
// Clear the permissions and items
|
|
280
|
-
_this._ddlItems = [{ text: "No Permission" }];
|
|
281
|
-
_this._permissionTypes = {};
|
|
282
|
-
// Parse the role definitions
|
|
283
|
-
for (var i = 0; i < roleDefs.results.length; i++) {
|
|
284
|
-
var roleDef = roleDefs.results[i];
|
|
285
|
-
// Add the role and item
|
|
286
|
-
var value = roleDef.RoleTypeKind > 0 ? roleDef.RoleTypeKind : roleDef.Name;
|
|
287
|
-
_this._permissionTypes[value] = roleDef.Id;
|
|
288
|
-
_this._ddlItems.push({
|
|
289
|
-
data: roleDef,
|
|
290
|
-
text: roleDef.Name,
|
|
291
|
-
value: value.toString()
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
};
|
|
297
526
|
// Reset list permissions
|
|
298
|
-
ListSecurity.prototype.resetPermissions = function (listItems) {
|
|
527
|
+
ListSecurity.prototype.resetPermissions = function (listItems, breakInheritance) {
|
|
299
528
|
var _this = this;
|
|
529
|
+
if (breakInheritance === void 0) { breakInheritance = true; }
|
|
300
530
|
// Parse the lists
|
|
301
531
|
var lists = {};
|
|
302
532
|
for (var i = 0; i < listItems.length; i++) {
|
|
@@ -311,14 +541,16 @@ var ListSecurity = /** @class */ (function () {
|
|
|
311
541
|
// Reset the permissions
|
|
312
542
|
list.resetRoleInheritance().execute();
|
|
313
543
|
// Revert to the default
|
|
314
|
-
|
|
544
|
+
if (breakInheritance) {
|
|
545
|
+
list.breakRoleInheritance(false, true).execute(true);
|
|
546
|
+
}
|
|
315
547
|
// Wait for the requests to complete
|
|
316
548
|
list.done(resolve);
|
|
317
549
|
}
|
|
318
550
|
});
|
|
319
551
|
};
|
|
320
552
|
// Shows the modal
|
|
321
|
-
ListSecurity.prototype.show = function (createFl) {
|
|
553
|
+
ListSecurity.prototype.show = function (createFl, onComplete) {
|
|
322
554
|
var _this = this;
|
|
323
555
|
if (createFl === void 0) { createFl = true; }
|
|
324
556
|
// Show a loading dialog
|
|
@@ -336,11 +568,23 @@ var ListSecurity = /** @class */ (function () {
|
|
|
336
568
|
// Hide the loading dialog
|
|
337
569
|
loadingDialog_1.LoadingDialog.hide();
|
|
338
570
|
// Show the modal
|
|
339
|
-
_this.renderModal()
|
|
571
|
+
_this.renderModal(function () {
|
|
572
|
+
// Hide the loading dialog
|
|
573
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
574
|
+
// Call the event
|
|
575
|
+
onComplete ? onComplete() : null;
|
|
576
|
+
});
|
|
340
577
|
// Stop the loop
|
|
341
578
|
clearInterval(loopId);
|
|
342
579
|
}
|
|
343
580
|
}, 10);
|
|
581
|
+
}, function () {
|
|
582
|
+
// Hide the loading dialog
|
|
583
|
+
loadingDialog_1.LoadingDialog.hide();
|
|
584
|
+
// Show an error
|
|
585
|
+
modal_1.Modal.setHeader("Security Groups");
|
|
586
|
+
modal_1.Modal.setBody("Error loading/creating the security groups. Please contact your admin.");
|
|
587
|
+
modal_1.Modal.show();
|
|
344
588
|
});
|
|
345
589
|
};
|
|
346
590
|
return ListSecurity;
|
package/build/lib.d.ts
CHANGED
|
@@ -19,6 +19,11 @@ export declare const DattaTable: {
|
|
|
19
19
|
InstallationRequired: typeof Common.InstallationRequired;
|
|
20
20
|
ItemForm: typeof Common.ItemForm;
|
|
21
21
|
List: typeof Common.List;
|
|
22
|
+
ListSecurityDefaultGroups: {
|
|
23
|
+
Members: string;
|
|
24
|
+
Owners: string;
|
|
25
|
+
Visitors: string;
|
|
26
|
+
};
|
|
22
27
|
ListSecurity: typeof Common.ListSecurity;
|
|
23
28
|
LoadingDialog: typeof Common.LoadingDialog;
|
|
24
29
|
formatBytes: (bytes: number, decimals?: number) => string;
|