@edular/permissions 8.11.0 → 9.0.0

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/lib/helpers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DepartmentPermissionTarget, PermissionDetails, PermissionType, ProfilePermissionsDetails } from './constants';
2
- export declare const checkIfProfileHasNeededPermissions: (profilePermissions: ProfilePermissionsDetails, permissionIds: number[]) => boolean;
2
+ export declare const checkIfProfileHasNeededPermissions: (profilePermissions: ProfilePermissionsDetails, permissionIds?: number[]) => boolean;
3
3
  export declare const getEnabledPermissionsForTarget: (permissions: PermissionDetails[], target: DepartmentPermissionTarget, type: PermissionType) => PermissionDetails[];
4
4
  export declare const checkPermissionsForSubunits: (permissions: PermissionDetails[], target: DepartmentPermissionTarget, type: PermissionType, subunitIds: number[]) => boolean;
5
5
  export declare const checkPermissionsForDepartments: (permissions: PermissionDetails[], target: DepartmentPermissionTarget, type: PermissionType, departmentIds: number[]) => boolean;
package/lib/helpers.js CHANGED
@@ -3,13 +3,14 @@ exports.__esModule = true;
3
3
  exports.checkPermissionsForDepartments = exports.checkPermissionsForSubunits = exports.getEnabledPermissionsForTarget = exports.checkIfProfileHasNeededPermissions = void 0;
4
4
  var constants_1 = require("./constants");
5
5
  var checkIfProfileHasNeededPermissions = function (profilePermissions, permissionIds) {
6
- if (permissionIds.length === 0) {
7
- return false;
8
- }
6
+ if (permissionIds === void 0) { permissionIds = []; }
9
7
  if (profilePermissions.type === constants_1.UserProfileType.Admin ||
10
8
  profilePermissions.type === constants_1.UserProfileType.ApiKey) {
11
9
  return true;
12
10
  }
11
+ if (permissionIds.length === 0) {
12
+ return false;
13
+ }
13
14
  return permissionIds.every(function (permissionId) {
14
15
  return profilePermissions.enabledPermissionIds.includes(permissionId);
15
16
  });
@@ -528,6 +528,10 @@ export declare const Permissions: {
528
528
  Edit: number;
529
529
  View: number;
530
530
  };
531
+ Sms: {
532
+ View: number;
533
+ Edit: number;
534
+ };
531
535
  };
532
536
  Modules: {
533
537
  Academics: {
@@ -530,6 +530,10 @@ exports.Permissions = {
530
530
  Delete: 6071,
531
531
  Edit: 6072,
532
532
  View: 6073
533
+ },
534
+ Sms: {
535
+ View: 6112,
536
+ Edit: 6113
533
537
  }
534
538
  },
535
539
  Modules: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edular/permissions",
3
- "version": "8.11.0",
3
+ "version": "9.0.0",
4
4
  "author": "Edular",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",