dattatable 2.9.37 → 2.9.39

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.
Files changed (58) hide show
  1. package/build/common/installRequired.d.ts +2 -1
  2. package/build/common/installRequired.js +38 -36
  3. package/build/common/listSecurity.d.ts +2 -1
  4. package/build/common/listSecurity.js +61 -28
  5. package/dist/dattatable.js +707 -707
  6. package/dist/dattatable.min.js +1 -1
  7. package/docs/assets/search.js +1 -1
  8. package/docs/classes/AuditLog.html +2 -2
  9. package/docs/classes/CanvasForm.html +2 -2
  10. package/docs/classes/Comments.html +2 -2
  11. package/docs/classes/Dashboard.html +4 -4
  12. package/docs/classes/DataTable.html +3 -3
  13. package/docs/classes/Documents.html +6 -6
  14. package/docs/classes/FilterSlideout.html +2 -2
  15. package/docs/classes/Footer.html +2 -2
  16. package/docs/classes/Header.html +2 -2
  17. package/docs/classes/InstallationRequired.html +4 -3
  18. package/docs/classes/ItemForm.html +4 -4
  19. package/docs/classes/List.html +4 -4
  20. package/docs/classes/ListSecurity.html +3 -2
  21. package/docs/classes/LoadingDialog.html +2 -2
  22. package/docs/classes/Modal.html +2 -2
  23. package/docs/classes/Navigation.html +3 -3
  24. package/docs/classes/Timeout.html +2 -2
  25. package/docs/enums/ActionButtonTypes.html +2 -2
  26. package/docs/functions/formatBytes.html +1 -1
  27. package/docs/functions/formatDateValue.html +1 -1
  28. package/docs/functions/formatTimeValue.html +1 -1
  29. package/docs/functions/getContextInfo.html +1 -1
  30. package/docs/functions/getFileExt.html +1 -1
  31. package/docs/functions/waitForTheme.html +1 -1
  32. package/docs/interfaces/IAuditLogItem.html +2 -2
  33. package/docs/interfaces/IAuditLogItemCreation.html +2 -2
  34. package/docs/interfaces/IAuditLogProps.html +2 -2
  35. package/docs/interfaces/IAuditLogViewProps.html +2 -2
  36. package/docs/interfaces/ICommentsItem.html +2 -2
  37. package/docs/interfaces/IDashboardProps.html +2 -2
  38. package/docs/interfaces/IDataTable.html +2 -2
  39. package/docs/interfaces/IDataTableProps.html +2 -2
  40. package/docs/interfaces/IDocumentsProps.html +2 -2
  41. package/docs/interfaces/IFilterItem.html +2 -2
  42. package/docs/interfaces/IFilterProps.html +2 -2
  43. package/docs/interfaces/IFooterProps.html +2 -2
  44. package/docs/interfaces/IHeaderProps.html +2 -2
  45. package/docs/interfaces/IInstallProps.html +2 -2
  46. package/docs/interfaces/IItemFormCreateProps.html +2 -2
  47. package/docs/interfaces/IItemFormEditProps.html +2 -2
  48. package/docs/interfaces/IItemFormTab.html +2 -2
  49. package/docs/interfaces/IItemFormTabInfo.html +2 -2
  50. package/docs/interfaces/IItemFormViewProps.html +2 -2
  51. package/docs/interfaces/IListProps.html +2 -2
  52. package/docs/interfaces/IListSecurity.html +2 -2
  53. package/docs/interfaces/IListSecurityItem.html +2 -2
  54. package/docs/interfaces/IShowDialogProps.html +2 -2
  55. package/docs/variables/DattaTable.html +1 -1
  56. package/docs/variables/ListSecurityDefaultGroups.html +1 -1
  57. package/package.json +2 -2
  58. package/pnpm-lock.yaml +16 -16
@@ -19,13 +19,14 @@ export interface IShowDialogProps {
19
19
  export declare class InstallationRequired {
20
20
  private static _cfg;
21
21
  private static _report;
22
+ private static _webUrl;
22
23
  private static _customActionsExist;
23
24
  static get CustomActionsExist(): boolean;
24
25
  private static checkCustomActions;
25
- private static isOwnerOrAdmin;
26
26
  private static _listsExist;
27
27
  static get ListsExist(): boolean;
28
28
  private static checkLists;
29
+ private static checkUserPermissions;
29
30
  static requiresInstall(props: IInstallProps): PromiseLike<boolean>;
30
31
  static showDialog(props?: IShowDialogProps): void;
31
32
  private static showErrorDialog;
@@ -32,7 +32,7 @@ var InstallationRequired = /** @class */ (function () {
32
32
  return;
33
33
  }
34
34
  // Load the web custom actions
35
- var web = (0, gd_sprest_bs_1.Web)();
35
+ var web = (0, gd_sprest_bs_1.Web)(_this._webUrl);
36
36
  web.UserCustomActions().execute(function (webCustomActions) {
37
37
  // Parse the web custom actions
38
38
  for (var i = 0; i < cfg._configuration.CustomActionCfg.Web.length; i++) {
@@ -69,7 +69,7 @@ var InstallationRequired = /** @class */ (function () {
69
69
  return;
70
70
  }
71
71
  // Load the site custom actions
72
- (0, gd_sprest_bs_1.Site)().UserCustomActions().execute(function (siteCustomActions) {
72
+ (0, gd_sprest_bs_1.Site)(_this._webUrl).UserCustomActions().execute(function (siteCustomActions) {
73
73
  // Parse the site custom actions
74
74
  for (var i = 0; i < cfg._configuration.CustomActionCfg.Site.length; i++) {
75
75
  var customAction = cfg._configuration.CustomActionCfg.Site[i];
@@ -107,37 +107,6 @@ var InstallationRequired = /** @class */ (function () {
107
107
  });
108
108
  });
109
109
  };
110
- // Determines if the user is an owner or admin
111
- InstallationRequired.isOwnerOrAdmin = function () {
112
- // Return a promise
113
- return new Promise(function (resolve) {
114
- // Get the current user
115
- (0, gd_sprest_bs_1.Web)().CurrentUser().execute(function (user) {
116
- // See if they are an admin
117
- if (user.IsSiteAdmin) {
118
- // Resolve the request
119
- resolve(true);
120
- }
121
- else {
122
- // See if the user is part of the owner's group
123
- (0, gd_sprest_bs_1.Web)().AssociatedOwnerGroup().Users().getById(user.Id).execute(
124
- // Is an owner
125
- function () {
126
- // Resolve the request
127
- resolve(true);
128
- },
129
- // Not an owner
130
- function () {
131
- // Resolve the request
132
- resolve(false);
133
- });
134
- }
135
- }, function () {
136
- // Resolve the request
137
- resolve(false);
138
- });
139
- });
140
- };
141
110
  Object.defineProperty(InstallationRequired, "ListsExist", {
142
111
  get: function () { return this._listsExist; },
143
112
  enumerable: false,
@@ -161,7 +130,7 @@ var InstallationRequired = /** @class */ (function () {
161
130
  // Return a promise
162
131
  return new Promise(function (resolve) {
163
132
  // Get the list
164
- (0, gd_sprest_bs_1.Web)().Lists(listCfg.ListInformation.Title).query({
133
+ (0, gd_sprest_bs_1.Web)(_this._webUrl).Lists(listCfg.ListInformation.Title).query({
165
134
  Expand: ["Fields"]
166
135
  }).execute(
167
136
  // Success
@@ -204,6 +173,35 @@ var InstallationRequired = /** @class */ (function () {
204
173
  });
205
174
  });
206
175
  };
176
+ // Determines if the user is an owner or admin
177
+ InstallationRequired.checkUserPermissions = function () {
178
+ var _this = this;
179
+ // Return a promise
180
+ return new Promise(function (resolve) {
181
+ // Get the current user information
182
+ (0, gd_sprest_bs_1.Web)(_this._webUrl).CurrentUser().execute(
183
+ // Success
184
+ function (user) {
185
+ // Get the current user permissions
186
+ (0, gd_sprest_bs_1.Web)(_this._webUrl).getUserEffectivePermissions(user.LoginName).execute(
187
+ // Success
188
+ function (permissions) {
189
+ // See if the user has manage web rights
190
+ resolve(gd_sprest_bs_1.Helper.hasPermissions(permissions.GetUserEffectivePermissions, gd_sprest_bs_1.SPTypes.BasePermissionTypes.ManageLists));
191
+ },
192
+ // Error
193
+ function () {
194
+ // Resolve the request
195
+ resolve(false);
196
+ });
197
+ },
198
+ // Error
199
+ function () {
200
+ // Resolve the request
201
+ resolve(false);
202
+ });
203
+ });
204
+ };
207
205
  // Checks the configuration to see if an installation is required
208
206
  InstallationRequired.requiresInstall = function (props) {
209
207
  var _this = this;
@@ -213,8 +211,8 @@ var InstallationRequired = /** @class */ (function () {
213
211
  this._report = [];
214
212
  // Return a promise
215
213
  return new Promise(function (resolve, reject) {
216
- // Ensure this is an admin or owner
217
- _this.isOwnerOrAdmin().then(function (hasPermissions) {
214
+ // Check the user permissions
215
+ _this.checkUserPermissions().then(function (hasPermissions) {
218
216
  // See if they are not an owner or admin
219
217
  if (!hasPermissions) {
220
218
  // Reject the request
@@ -320,6 +318,9 @@ var InstallationRequired = /** @class */ (function () {
320
318
  gd_sprest_bs_1.Helper.Executor(cfgs, function (cfg) {
321
319
  // Return a promise
322
320
  return new Promise(function (resolve) {
321
+ // Set the web url
322
+ _this._webUrl = cfg.getWebUrl();
323
+ // Add the components
323
324
  cfg.install().then(function () {
324
325
  // Hide the button
325
326
  btnInstall.hide();
@@ -373,6 +374,7 @@ var InstallationRequired = /** @class */ (function () {
373
374
  };
374
375
  InstallationRequired._cfg = null;
375
376
  InstallationRequired._report = null;
377
+ InstallationRequired._webUrl = null;
376
378
  // Custom Actions exists
377
379
  InstallationRequired._customActionsExist = null;
378
380
  // Lists exists
@@ -39,6 +39,7 @@ export declare class ListSecurity {
39
39
  private removeUser;
40
40
  constructor(props: IListSecurity);
41
41
  addToGroup(userId: number, groupName: string): PromiseLike<void>;
42
+ private checkUserPermissions;
42
43
  private configureList;
43
44
  private configureLists;
44
45
  private createGroups;
@@ -50,5 +51,5 @@ export declare class ListSecurity {
50
51
  removeFromGroup(userId: number, groupName: string): PromiseLike<void>;
51
52
  private renderModal;
52
53
  private resetPermissions;
53
- show(createFl?: boolean, onComplete?: () => void): void;
54
+ show(createFl?: boolean, onComplete?: () => void, onError?: () => void): void;
54
55
  }
@@ -104,6 +104,25 @@ var ListSecurity = /** @class */ (function () {
104
104
  }, reject);
105
105
  });
106
106
  };
107
+ // Determines if the user is an owner or admin
108
+ ListSecurity.prototype.checkUserPermissions = function () {
109
+ var _this = this;
110
+ // Return a promise
111
+ return new Promise(function (resolve) {
112
+ // Get the current user permissions
113
+ (0, gd_sprest_bs_1.Web)().getUserEffectivePermissions(_this.CurrentUser.LoginName).execute(
114
+ // Success
115
+ function (permissions) {
116
+ // See if the user has manage web rights
117
+ resolve(gd_sprest_bs_1.Helper.hasPermissions(permissions.GetUserEffectivePermissions, gd_sprest_bs_1.SPTypes.BasePermissionTypes.ManageWeb));
118
+ },
119
+ // Error
120
+ function () {
121
+ // Resolve the request
122
+ resolve(false);
123
+ });
124
+ });
125
+ };
107
126
  // Configures a list
108
127
  ListSecurity.prototype.configureList = function (listInfo) {
109
128
  var _this = this;
@@ -560,41 +579,55 @@ var ListSecurity = /** @class */ (function () {
560
579
  });
561
580
  };
562
581
  // Shows the modal
563
- ListSecurity.prototype.show = function (createFl, onComplete) {
582
+ ListSecurity.prototype.show = function (createFl, onComplete, onError) {
564
583
  var _this = this;
565
584
  if (createFl === void 0) { createFl = true; }
566
585
  // Show a loading dialog
567
- loadingDialog_1.LoadingDialog.setHeader("Loading the Security Information");
568
- loadingDialog_1.LoadingDialog.setBody("Loading the security group information...");
586
+ loadingDialog_1.LoadingDialog.setHeader("Loading the User Permissions");
587
+ loadingDialog_1.LoadingDialog.setBody("Checking to see if the user can manage this web...");
569
588
  loadingDialog_1.LoadingDialog.show();
570
- // Create the groups
571
- this.createGroups(createFl).then(function () {
589
+ // Check the user permissions
590
+ this.checkUserPermissions().then(function (hasPermissions) {
591
+ // Ensure they have permissions
592
+ if (!hasPermissions) {
593
+ // Close the dialog
594
+ loadingDialog_1.LoadingDialog.hide();
595
+ // Call the event and do nothing
596
+ onError ? onError() : null;
597
+ return;
598
+ }
572
599
  // Update the loading dialog
573
- loadingDialog_1.LoadingDialog.setBody("Waiting for the permission types to be loaded...");
574
- // Ensure the permissions are loaded
575
- var loopId = setInterval(function () {
576
- // See if the permissions exist
577
- if (_this._ddlItems && _this._permissionTypes) {
578
- // Hide the loading dialog
579
- loadingDialog_1.LoadingDialog.hide();
580
- // Show the modal
581
- _this.renderModal(function () {
600
+ loadingDialog_1.LoadingDialog.setHeader("Loading the Security Information");
601
+ loadingDialog_1.LoadingDialog.setBody("Loading the security group information...");
602
+ // Create the groups
603
+ _this.createGroups(createFl).then(function () {
604
+ // Update the loading dialog
605
+ loadingDialog_1.LoadingDialog.setBody("Waiting for the permission types to be loaded...");
606
+ // Ensure the permissions are loaded
607
+ var loopId = setInterval(function () {
608
+ // See if the permissions exist
609
+ if (_this._ddlItems && _this._permissionTypes) {
582
610
  // Hide the loading dialog
583
611
  loadingDialog_1.LoadingDialog.hide();
584
- // Call the event
585
- onComplete ? onComplete() : null;
586
- });
587
- // Stop the loop
588
- clearInterval(loopId);
589
- }
590
- }, 10);
591
- }, function () {
592
- // Hide the loading dialog
593
- loadingDialog_1.LoadingDialog.hide();
594
- // Show an error
595
- modal_1.Modal.setHeader("Security Groups");
596
- modal_1.Modal.setBody("Error loading/creating the security groups. Please contact your admin.");
597
- modal_1.Modal.show();
612
+ // Show the modal
613
+ _this.renderModal(function () {
614
+ // Hide the loading dialog
615
+ loadingDialog_1.LoadingDialog.hide();
616
+ // Call the event
617
+ onComplete ? onComplete() : null;
618
+ });
619
+ // Stop the loop
620
+ clearInterval(loopId);
621
+ }
622
+ }, 10);
623
+ }, function () {
624
+ // Hide the loading dialog
625
+ loadingDialog_1.LoadingDialog.hide();
626
+ // Show an error
627
+ modal_1.Modal.setHeader("Security Groups");
628
+ modal_1.Modal.setBody("Error loading/creating the security groups. Please contact your admin.");
629
+ modal_1.Modal.show();
630
+ });
598
631
  });
599
632
  };
600
633
  return ListSecurity;