@esri/hub-common 13.46.2 → 14.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/dist/esm/ArcGISContext.js +8 -10
- package/dist/esm/ArcGISContext.js.map +1 -1
- package/dist/esm/ArcGISContextManager.js +8 -62
- package/dist/esm/ArcGISContextManager.js.map +1 -1
- package/dist/esm/content/_internal/ContentBusinessRules.js +3 -40
- package/dist/esm/content/_internal/ContentBusinessRules.js.map +1 -1
- package/dist/esm/content/_internal/getPropertyMap.js +1 -5
- package/dist/esm/content/_internal/getPropertyMap.js.map +1 -1
- package/dist/esm/core/HubItemEntity.js +0 -11
- package/dist/esm/core/HubItemEntity.js.map +1 -1
- package/dist/esm/core/types/ISystemStatus.js +0 -26
- package/dist/esm/core/types/ISystemStatus.js.map +1 -1
- package/dist/esm/discussions/_internal/DiscussionBusinessRules.js +0 -42
- package/dist/esm/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
- package/dist/esm/discussions/_internal/computeProps.js +0 -5
- package/dist/esm/discussions/_internal/computeProps.js.map +1 -1
- package/dist/esm/groups/_internal/GroupBusinessRules.js +0 -41
- package/dist/esm/groups/_internal/GroupBusinessRules.js.map +1 -1
- package/dist/esm/groups/_internal/computeProps.js +0 -5
- package/dist/esm/groups/_internal/computeProps.js.map +1 -1
- package/dist/esm/groups/_internal/getPropertyMap.js +1 -0
- package/dist/esm/groups/_internal/getPropertyMap.js.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js +0 -48
- package/dist/esm/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
- package/dist/esm/initiatives/_internal/computeProps.js +3 -7
- package/dist/esm/initiatives/_internal/computeProps.js.map +1 -1
- package/dist/esm/initiatives/_internal/getPropertyMap.js +4 -4
- package/dist/esm/initiatives/_internal/getPropertyMap.js.map +1 -1
- package/dist/esm/pages/_internal/PageBusinessRules.js +0 -42
- package/dist/esm/pages/_internal/PageBusinessRules.js.map +1 -1
- package/dist/esm/pages/_internal/computeProps.js +3 -7
- package/dist/esm/pages/_internal/computeProps.js.map +1 -1
- package/dist/esm/permissions/HubPermissionPolicies.js +3 -5
- package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/esm/permissions/PlatformPermissionPolicies.js +100 -100
- package/dist/esm/permissions/PlatformPermissionPolicies.js.map +1 -1
- package/dist/esm/permissions/_internal/getPolicyResponseCode.js +0 -4
- package/dist/esm/permissions/_internal/getPolicyResponseCode.js.map +1 -1
- package/dist/esm/permissions/_internal/processEntityFeatures.js.map +1 -1
- package/dist/esm/permissions/checkPermission.js +7 -3
- package/dist/esm/permissions/checkPermission.js.map +1 -1
- package/dist/esm/projects/_internal/ProjectBusinessRules.js +1 -55
- package/dist/esm/projects/_internal/ProjectBusinessRules.js.map +1 -1
- package/dist/esm/projects/_internal/computeProps.js +3 -7
- package/dist/esm/projects/_internal/computeProps.js.map +1 -1
- package/dist/esm/projects/_internal/getPropertyMap.js +2 -2
- package/dist/esm/projects/_internal/getPropertyMap.js.map +1 -1
- package/dist/esm/sites/_internal/SiteBusinessRules.js +0 -48
- package/dist/esm/sites/_internal/SiteBusinessRules.js.map +1 -1
- package/dist/esm/sites/_internal/computeProps.js +3 -8
- package/dist/esm/sites/_internal/computeProps.js.map +1 -1
- package/dist/esm/sites/_internal/getPropertyMap.js +4 -8
- package/dist/esm/sites/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/ArcGISContext.js +8 -10
- package/dist/node/ArcGISContext.js.map +1 -1
- package/dist/node/ArcGISContextManager.js +8 -62
- package/dist/node/ArcGISContextManager.js.map +1 -1
- package/dist/node/content/_internal/ContentBusinessRules.js +4 -41
- package/dist/node/content/_internal/ContentBusinessRules.js.map +1 -1
- package/dist/node/content/_internal/getPropertyMap.js +1 -5
- package/dist/node/content/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/core/HubItemEntity.js +0 -11
- package/dist/node/core/HubItemEntity.js.map +1 -1
- package/dist/node/core/types/ISystemStatus.js +1 -28
- package/dist/node/core/types/ISystemStatus.js.map +1 -1
- package/dist/node/discussions/_internal/DiscussionBusinessRules.js +1 -43
- package/dist/node/discussions/_internal/DiscussionBusinessRules.js.map +1 -1
- package/dist/node/discussions/_internal/computeProps.js +0 -5
- package/dist/node/discussions/_internal/computeProps.js.map +1 -1
- package/dist/node/groups/_internal/GroupBusinessRules.js +1 -42
- package/dist/node/groups/_internal/GroupBusinessRules.js.map +1 -1
- package/dist/node/groups/_internal/computeProps.js +0 -5
- package/dist/node/groups/_internal/computeProps.js.map +1 -1
- package/dist/node/groups/_internal/getPropertyMap.js +1 -0
- package/dist/node/groups/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/index.js +0 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/initiatives/_internal/InitiativeBusinessRules.js +1 -49
- package/dist/node/initiatives/_internal/InitiativeBusinessRules.js.map +1 -1
- package/dist/node/initiatives/_internal/computeProps.js +3 -7
- package/dist/node/initiatives/_internal/computeProps.js.map +1 -1
- package/dist/node/initiatives/_internal/getPropertyMap.js +4 -4
- package/dist/node/initiatives/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/pages/_internal/PageBusinessRules.js +1 -43
- package/dist/node/pages/_internal/PageBusinessRules.js.map +1 -1
- package/dist/node/pages/_internal/computeProps.js +3 -7
- package/dist/node/pages/_internal/computeProps.js.map +1 -1
- package/dist/node/permissions/HubPermissionPolicies.js +3 -5
- package/dist/node/permissions/HubPermissionPolicies.js.map +1 -1
- package/dist/node/permissions/PlatformPermissionPolicies.js +100 -100
- package/dist/node/permissions/PlatformPermissionPolicies.js.map +1 -1
- package/dist/node/permissions/_internal/getPolicyResponseCode.js +0 -4
- package/dist/node/permissions/_internal/getPolicyResponseCode.js.map +1 -1
- package/dist/node/permissions/_internal/processEntityFeatures.js.map +1 -1
- package/dist/node/permissions/checkPermission.js +7 -3
- package/dist/node/permissions/checkPermission.js.map +1 -1
- package/dist/node/projects/_internal/ProjectBusinessRules.js +2 -56
- package/dist/node/projects/_internal/ProjectBusinessRules.js.map +1 -1
- package/dist/node/projects/_internal/computeProps.js +3 -7
- package/dist/node/projects/_internal/computeProps.js.map +1 -1
- package/dist/node/projects/_internal/getPropertyMap.js +2 -2
- package/dist/node/projects/_internal/getPropertyMap.js.map +1 -1
- package/dist/node/sites/_internal/SiteBusinessRules.js +1 -49
- package/dist/node/sites/_internal/SiteBusinessRules.js.map +1 -1
- package/dist/node/sites/_internal/computeProps.js +3 -8
- package/dist/node/sites/_internal/computeProps.js.map +1 -1
- package/dist/node/sites/_internal/getPropertyMap.js +4 -8
- package/dist/node/sites/_internal/getPropertyMap.js.map +1 -1
- package/dist/types/ArcGISContext.d.ts +16 -17
- package/dist/types/ArcGISContextManager.d.ts +7 -7
- package/dist/types/content/_internal/ContentBusinessRules.d.ts +3 -16
- package/dist/types/content/_internal/internalContentUtils.d.ts +8 -9
- package/dist/types/core/HubItemEntity.d.ts +2 -9
- package/dist/types/core/behaviors/IWithPermissionBehavior.d.ts +0 -11
- package/dist/types/core/traits/IWithPermissions.d.ts +3 -7
- package/dist/types/core/types/ISystemStatus.d.ts +1 -21
- package/dist/types/discussions/_internal/DiscussionBusinessRules.d.ts +0 -17
- package/dist/types/groups/_internal/GroupBusinessRules.d.ts +0 -16
- package/dist/types/index.d.ts +0 -1
- package/dist/types/initiatives/_internal/InitiativeBusinessRules.d.ts +2 -17
- package/dist/types/pages/_internal/PageBusinessRules.d.ts +2 -19
- package/dist/types/permissions/_internal/processEntityFeatures.d.ts +2 -2
- package/dist/types/permissions/checkPermission.d.ts +12 -2
- package/dist/types/permissions/types/IPermissionAccessResponse.d.ts +1 -2
- package/dist/types/permissions/types/IPermissionPolicy.d.ts +10 -9
- package/dist/types/permissions/types/PolicyResponse.d.ts +1 -1
- package/dist/types/projects/_internal/ProjectBusinessRules.d.ts +2 -19
- package/dist/types/sites/_internal/SiteBusinessRules.d.ts +2 -19
- package/package.json +1 -1
- package/dist/esm/capabilities/_internal/checkCapabilityAccess.js +0 -49
- package/dist/esm/capabilities/_internal/checkCapabilityAccess.js.map +0 -1
- package/dist/esm/capabilities/_internal/index.js +0 -2
- package/dist/esm/capabilities/_internal/index.js.map +0 -1
- package/dist/esm/capabilities/checkCapability.js +0 -53
- package/dist/esm/capabilities/checkCapability.js.map +0 -1
- package/dist/esm/capabilities/getWorkspaceCapabilities.js +0 -48
- package/dist/esm/capabilities/getWorkspaceCapabilities.js.map +0 -1
- package/dist/esm/capabilities/index.js +0 -5
- package/dist/esm/capabilities/index.js.map +0 -1
- package/dist/esm/capabilities/processEntityCapabilities.js +0 -27
- package/dist/esm/capabilities/processEntityCapabilities.js.map +0 -1
- package/dist/esm/capabilities/types.js +0 -26
- package/dist/esm/capabilities/types.js.map +0 -1
- package/dist/node/capabilities/_internal/checkCapabilityAccess.js +0 -53
- package/dist/node/capabilities/_internal/checkCapabilityAccess.js.map +0 -1
- package/dist/node/capabilities/_internal/index.js +0 -5
- package/dist/node/capabilities/_internal/index.js.map +0 -1
- package/dist/node/capabilities/checkCapability.js +0 -57
- package/dist/node/capabilities/checkCapability.js.map +0 -1
- package/dist/node/capabilities/getWorkspaceCapabilities.js +0 -52
- package/dist/node/capabilities/getWorkspaceCapabilities.js.map +0 -1
- package/dist/node/capabilities/index.js +0 -8
- package/dist/node/capabilities/index.js.map +0 -1
- package/dist/node/capabilities/processEntityCapabilities.js +0 -31
- package/dist/node/capabilities/processEntityCapabilities.js.map +0 -1
- package/dist/node/capabilities/types.js +0 -30
- package/dist/node/capabilities/types.js.map +0 -1
- package/dist/types/capabilities/_internal/checkCapabilityAccess.d.ts +0 -11
- package/dist/types/capabilities/_internal/index.d.ts +0 -1
- package/dist/types/capabilities/checkCapability.d.ts +0 -10
- package/dist/types/capabilities/getWorkspaceCapabilities.d.ts +0 -16
- package/dist/types/capabilities/index.d.ts +0 -4
- package/dist/types/capabilities/processEntityCapabilities.d.ts +0 -8
- package/dist/types/capabilities/types.d.ts +0 -57
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hub System Capabilities
|
|
3
|
-
*/
|
|
4
|
-
const validCapabilities = [
|
|
5
|
-
"collaboration",
|
|
6
|
-
"dashboard",
|
|
7
|
-
"details",
|
|
8
|
-
"discussions",
|
|
9
|
-
"events",
|
|
10
|
-
"followers",
|
|
11
|
-
"overview",
|
|
12
|
-
"settings",
|
|
13
|
-
"teams",
|
|
14
|
-
"metrics",
|
|
15
|
-
"members",
|
|
16
|
-
"content",
|
|
17
|
-
];
|
|
18
|
-
/**
|
|
19
|
-
* Validate a capability. This is used because the libary can be used outside of typescript and we want to be able to return a message is the string passed in is not a valid capability
|
|
20
|
-
* @param Capability
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
export function isCapability(maybeCapability) {
|
|
24
|
-
return validCapabilities.includes(maybeCapability);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/capabilities/types.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACxB,eAAe;IACf,WAAW;IACX,SAAS;IACT,aAAa;IACb,QAAQ;IACR,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;CACD,CAAC;AAOX;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,eAAuB;IAClD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,eAA6B,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkCapabilityAccess = void 0;
|
|
4
|
-
const permissions_1 = require("../../permissions");
|
|
5
|
-
/**
|
|
6
|
-
* Check an individual capability access rule
|
|
7
|
-
* @param rule
|
|
8
|
-
* @param context
|
|
9
|
-
* @param entity
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
function checkCapabilityAccess(rule, context, entity) {
|
|
13
|
-
// tslint:disable-next-line: no-console
|
|
14
|
-
console.warn(`DEPRECATION: checkCapabilityAccess is deprecated. Use checkFeatureAccess instead.`);
|
|
15
|
-
// check if the capability is disabled for the entity; we default to false
|
|
16
|
-
const value = entity.capabilities[rule.capability] || false;
|
|
17
|
-
// if disabled, then access is denied
|
|
18
|
-
if (!value) {
|
|
19
|
-
return {
|
|
20
|
-
capability: rule.capability,
|
|
21
|
-
access: false,
|
|
22
|
-
code: "disabled",
|
|
23
|
-
response: "not-available",
|
|
24
|
-
message: `Owner ${entity.owner} has disabled ${rule.capability} capability.`,
|
|
25
|
-
responses: [],
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// check each permission in the rule
|
|
30
|
-
const chks = rule.permissions.map((permission) => {
|
|
31
|
-
return permissions_1.checkPermission(permission, context, entity);
|
|
32
|
-
});
|
|
33
|
-
// default to last check
|
|
34
|
-
let accessCheck = chks[chks.length - 1];
|
|
35
|
-
// if all checks are true, then access is granted
|
|
36
|
-
const access = chks.every((chk) => chk.access);
|
|
37
|
-
if (!access) {
|
|
38
|
-
// get the first failed check and use it's values in the response
|
|
39
|
-
accessCheck = chks.find((chk) => !chk.access);
|
|
40
|
-
}
|
|
41
|
-
// construct the response
|
|
42
|
-
return {
|
|
43
|
-
capability: rule.capability,
|
|
44
|
-
access: accessCheck.access,
|
|
45
|
-
code: accessCheck.code,
|
|
46
|
-
response: accessCheck.response,
|
|
47
|
-
message: accessCheck.message,
|
|
48
|
-
responses: chks,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
exports.checkCapabilityAccess = checkCapabilityAccess;
|
|
53
|
-
//# sourceMappingURL=checkCapabilityAccess.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkCapabilityAccess.js","sourceRoot":"","sources":["../../../../src/capabilities/_internal/checkCapabilityAccess.ts"],"names":[],"mappings":";;;AAEA,mDAA+E;AAG/E;;;;;;GAMG;AACH,SAAgB,qBAAqB,CACnC,IAA2B,EAC3B,OAAuB,EACvB,MAAkC;IAElC,uCAAuC;IACvC,OAAO,CAAC,IAAI,CACV,mFAAmF,CACpF,CAAC;IACF,0EAA0E;IAC1E,MAAM,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC;IAC5D,qCAAqC;IACrC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,eAAe;YACzB,OAAO,EAAE,SAAS,MAAM,CAAC,KAAK,iBAAiB,IAAI,CAAC,UAAU,cAAc;YAC5E,SAAS,EAAE,EAAE;SACd,CAAC;KACH;SAAM;QACL,oCAAoC;QACpC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;YAC/C,OAAO,6BAAe,CAAC,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;QACH,wBAAwB;QACxB,IAAI,WAAW,GAA8B,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACnE,iDAAiD;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAE/C,IAAI,CAAC,MAAM,EAAE;YACX,iEAAiE;YACjE,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;SAC/C;QACD,yBAAyB;QACzB,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,QAAQ,EAAE,WAAW,CAAC,QAAQ;YAC9B,OAAO,EAAE,WAAW,CAAC,OAAO;YAC5B,SAAS,EAAE,IAAI;SAChB,CAAC;KACH;AACH,CAAC;AA7CD,sDA6CC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/capabilities/_internal/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkCapability = void 0;
|
|
4
|
-
const types_1 = require("./types");
|
|
5
|
-
const getWorkspaceCapabilities_1 = require("./getWorkspaceCapabilities");
|
|
6
|
-
const _internal_1 = require("./_internal");
|
|
7
|
-
// Any of these causes checkCapability to not be defined in tests
|
|
8
|
-
// import { getTypeFromEntity } from "../index";
|
|
9
|
-
// import { getTypeFromEntity } from "../core";
|
|
10
|
-
// import { getTypeFromEntity } from "../core/index";
|
|
11
|
-
// This direct import resolves the problem
|
|
12
|
-
const getTypeFromEntity_1 = require("../core/getTypeFromEntity");
|
|
13
|
-
/**
|
|
14
|
-
* Check if a capability is enabled for a given entity and if the current user has necessary permissions to access it
|
|
15
|
-
* @param capability
|
|
16
|
-
* @param context
|
|
17
|
-
* @param entity
|
|
18
|
-
* @returns
|
|
19
|
-
*/
|
|
20
|
-
function checkCapability(capability, context, entity) {
|
|
21
|
-
/* tslint:disable-next-line: no-console */
|
|
22
|
-
console.warn(`DEPRECATION: checkCapability is deprecated. Use checkPermission instead.`);
|
|
23
|
-
const entityType = getTypeFromEntity_1.getTypeFromEntity(entity);
|
|
24
|
-
// Find the rule for the given entity type and capability
|
|
25
|
-
const isValid = types_1.isCapability(capability);
|
|
26
|
-
if (isValid) {
|
|
27
|
-
const rule = getWorkspaceCapabilities_1.CapabilityPermissions.find((e) => e.entity === entityType && e.capability === capability);
|
|
28
|
-
if (rule) {
|
|
29
|
-
// check each capability access rule
|
|
30
|
-
return _internal_1.checkCapabilityAccess(rule, context, entity);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// No rule found
|
|
34
|
-
return {
|
|
35
|
-
capability,
|
|
36
|
-
access: false,
|
|
37
|
-
code: "disabled",
|
|
38
|
-
response: "not-available",
|
|
39
|
-
message: `Capability "${capability}" is not defined for ${entityType}.`,
|
|
40
|
-
responses: [],
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// Invlaid Capability
|
|
46
|
-
return {
|
|
47
|
-
capability,
|
|
48
|
-
access: false,
|
|
49
|
-
code: "disabled",
|
|
50
|
-
response: "invalid-capability",
|
|
51
|
-
message: `Value "${capability}" is not a valid Hub Capability.`,
|
|
52
|
-
responses: [],
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
exports.checkCapability = checkCapability;
|
|
57
|
-
//# sourceMappingURL=checkCapability.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkCapability.js","sourceRoot":"","sources":["../../../src/capabilities/checkCapability.ts"],"names":[],"mappings":";;;AAAA,mCAA8E;AAC9E,yEAAmE;AACnE,2CAAoD;AAOpD,iEAAiE;AACjE,gDAAgD;AAChD,+CAA+C;AAC/C,qDAAqD;AACrD,0CAA0C;AAC1C,iEAA8D;AAE9D;;;;;;GAMG;AACH,SAAgB,eAAe,CAC7B,UAAsB,EACtB,OAAuB,EACvB,MAAkC;IAElC,0CAA0C;IAC1C,OAAO,CAAC,IAAI,CACV,0EAA0E,CAC3E,CAAC;IACF,MAAM,UAAU,GAAkB,qCAAiB,CAAC,MAAM,CAAC,CAAC;IAC5D,yDAAyD;IACzD,MAAM,OAAO,GAAG,oBAAY,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,OAAO,EAAE;QACX,MAAM,IAAI,GAAG,gDAAqB,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,IAAI,CAAC,CAAC,UAAU,KAAK,UAAU,CAC9D,CAAC;QACF,IAAI,IAAI,EAAE;YACR,oCAAoC;YACpC,OAAO,iCAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;SACrD;aAAM;YACL,gBAAgB;YAChB,OAAO;gBACL,UAAU;gBACV,MAAM,EAAE,KAAK;gBACb,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,eAAe;gBACzB,OAAO,EAAE,eAAe,UAAU,wBAAwB,UAAU,GAAG;gBACvE,SAAS,EAAE,EAAE;aACe,CAAC;SAChC;KACF;SAAM;QACL,qBAAqB;QACrB,OAAO;YACL,UAAU;YACV,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,oBAAoB;YAC9B,OAAO,EAAE,UAAU,UAAU,kCAAkC;YAC/D,SAAS,EAAE,EAAE;SACe,CAAC;KAChC;AACH,CAAC;AAzCD,0CAyCC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWorkspaceCapabilities = exports.CapabilityPermissions = void 0;
|
|
4
|
-
const getTypeFromEntity_1 = require("../core/getTypeFromEntity");
|
|
5
|
-
const ProjectBusinessRules_1 = require("../projects/_internal/ProjectBusinessRules");
|
|
6
|
-
const checkCapabilityAccess_1 = require("./_internal/checkCapabilityAccess");
|
|
7
|
-
const InitiativeBusinessRules_1 = require("../initiatives/_internal/InitiativeBusinessRules");
|
|
8
|
-
const DiscussionBusinessRules_1 = require("../discussions/_internal/DiscussionBusinessRules");
|
|
9
|
-
const SiteBusinessRules_1 = require("../sites/_internal/SiteBusinessRules");
|
|
10
|
-
const ContentBusinessRules_1 = require("../content/_internal/ContentBusinessRules");
|
|
11
|
-
const GroupBusinessRules_1 = require("../groups/_internal/GroupBusinessRules");
|
|
12
|
-
const PageBusinessRules_1 = require("../pages/_internal/PageBusinessRules");
|
|
13
|
-
/**
|
|
14
|
-
* List of all the Capability Permissions in the Hub System
|
|
15
|
-
* These are defined in the entity specific modules files
|
|
16
|
-
*/
|
|
17
|
-
exports.CapabilityPermissions = [
|
|
18
|
-
...ProjectBusinessRules_1.ProjectCapabilityPermissions,
|
|
19
|
-
...InitiativeBusinessRules_1.InitiativeCapabilityPermissions,
|
|
20
|
-
...SiteBusinessRules_1.SiteCapabilityPermissions,
|
|
21
|
-
...DiscussionBusinessRules_1.DiscussionCapabilityPermissions,
|
|
22
|
-
...ContentBusinessRules_1.ContentCapabilityPermissions,
|
|
23
|
-
...GroupBusinessRules_1.GroupCapabilityPermissions,
|
|
24
|
-
...PageBusinessRules_1.PageCapabilityPermissions,
|
|
25
|
-
];
|
|
26
|
-
/**
|
|
27
|
-
* DEPRECATED: Return the capabilities that are granted to the current user for a given entity
|
|
28
|
-
* This is used by the Hub Components to determine which Workspace Navigation Links to show
|
|
29
|
-
* @param entity
|
|
30
|
-
* @param context
|
|
31
|
-
* @returns
|
|
32
|
-
*/
|
|
33
|
-
function getWorkspaceCapabilities(entity, context) {
|
|
34
|
-
/* tslint:disable-next-line: no-console */
|
|
35
|
-
console.warn(`DEPRECATION: Capabilities is deprecated. Use Permissions instead.`);
|
|
36
|
-
const entityType = getTypeFromEntity_1.getTypeFromEntity(entity);
|
|
37
|
-
// filter to the rules for the given entity type
|
|
38
|
-
const capabilityAccessRules = exports.CapabilityPermissions.filter((e) => e.entity === entityType);
|
|
39
|
-
// check each capability access rule
|
|
40
|
-
const responses = capabilityAccessRules.map((rule) => {
|
|
41
|
-
return checkCapabilityAccess_1.checkCapabilityAccess(rule, context, entity);
|
|
42
|
-
});
|
|
43
|
-
// map out those capabilities that are granted so consumers can easily work with that list
|
|
44
|
-
const granted = responses.filter((r) => r.access).map((r) => r.capability);
|
|
45
|
-
// return the full response with the details and the granted capabilities list
|
|
46
|
-
return {
|
|
47
|
-
granted,
|
|
48
|
-
details: responses,
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
exports.getWorkspaceCapabilities = getWorkspaceCapabilities;
|
|
52
|
-
//# sourceMappingURL=getWorkspaceCapabilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkspaceCapabilities.js","sourceRoot":"","sources":["../../../src/capabilities/getWorkspaceCapabilities.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAE9D,qFAA0F;AAC1F,6EAA0E;AAC1E,8FAAmG;AACnG,8FAAmG;AACnG,4EAAiF;AACjF,oFAAyF;AAGzF,+EAAoF;AACpF,4EAAiF;AAEjF;;;GAGG;AACU,QAAA,qBAAqB,GAA4B;IAC5D,GAAG,mDAA4B;IAC/B,GAAG,yDAA+B;IAClC,GAAG,6CAAyB;IAC5B,GAAG,yDAA+B;IAClC,GAAG,mDAA4B;IAC/B,GAAG,+CAA0B;IAC7B,GAAG,6CAAyB;CAC7B,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,MAAiB,EACjB,OAAuB;IAEvB,0CAA0C;IAC1C,OAAO,CAAC,IAAI,CACV,mEAAmE,CACpE,CAAC;IACF,MAAM,UAAU,GAAkB,qCAAiB,CAAC,MAAM,CAAC,CAAC;IAC5D,gDAAgD;IAChD,MAAM,qBAAqB,GAAG,6BAAqB,CAAC,MAAM,CACxD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAC/B,CAAC;IAEF,oCAAoC;IACpC,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACnD,OAAO,6CAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IACH,0FAA0F;IAC1F,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3E,8EAA8E;IAC9E,OAAO;QACL,OAAO;QACP,OAAO,EAAE,SAAS;KACnB,CAAC;AACJ,CAAC;AAzBD,4DAyBC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./processEntityCapabilities"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./getWorkspaceCapabilities"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./checkCapability"), exports);
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/capabilities/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,sEAA4C;AAC5C,qEAA2C;AAC3C,4DAAkC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processEntityCapabilities = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Take an entity's capabilities and merge them with the default capabilities ensuring that only the capabilities defined in the business rules are allowed through.
|
|
6
|
-
* @param entityCapabilities
|
|
7
|
-
* @param defaultCapabilities
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
function processEntityCapabilities(entityCapabilities, defaultCapabilities) {
|
|
11
|
-
/* tslint:disable-next-line: no-console */
|
|
12
|
-
console.warn(`DEPRECATION: Capabilities is deprecated. Use Permissions instead.`);
|
|
13
|
-
// Extend the default capabilities with the entity capabilities
|
|
14
|
-
const capabilities = Object.assign(Object.assign({}, defaultCapabilities), entityCapabilities);
|
|
15
|
-
// Remove any capabilities that are not in the default capabilities hash.
|
|
16
|
-
// this prevents enabling capabilities that are not defined in hub business rules
|
|
17
|
-
const defaultKeys = Object.keys(defaultCapabilities);
|
|
18
|
-
const keysToRemove = Object.keys(capabilities).reduce((acc, key) => {
|
|
19
|
-
if (!defaultKeys.includes(key)) {
|
|
20
|
-
acc.push(key);
|
|
21
|
-
}
|
|
22
|
-
return acc;
|
|
23
|
-
}, []);
|
|
24
|
-
// remove any keys that are not in the default capabilities hash
|
|
25
|
-
keysToRemove.forEach((key) => {
|
|
26
|
-
delete capabilities[key];
|
|
27
|
-
});
|
|
28
|
-
return capabilities;
|
|
29
|
-
}
|
|
30
|
-
exports.processEntityCapabilities = processEntityCapabilities;
|
|
31
|
-
//# sourceMappingURL=processEntityCapabilities.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processEntityCapabilities.js","sourceRoot":"","sources":["../../../src/capabilities/processEntityCapabilities.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,yBAAyB,CACvC,kBAAsC,EACtC,mBAAuC;IAEvC,0CAA0C;IAC1C,OAAO,CAAC,IAAI,CACV,mEAAmE,CACpE,CAAC;IACF,+DAA+D;IAC/D,MAAM,YAAY,mCAAQ,mBAAmB,GAAK,kBAAkB,CAAE,CAAC;IAEvE,yEAAyE;IACzE,iFAAiF;IACjF,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACrD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACjE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC9B,GAAG,CAAC,IAAI,CAAC,GAAiB,CAAC,CAAC;SAC7B;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,gEAAgE;IAChE,YAAY,CAAC,OAAO,CAAC,CAAC,GAAe,EAAE,EAAE;QACvC,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,OAAO,YAAY,CAAC;AACtB,CAAC;AAzBD,8DAyBC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCapability = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Hub System Capabilities
|
|
6
|
-
*/
|
|
7
|
-
const validCapabilities = [
|
|
8
|
-
"collaboration",
|
|
9
|
-
"dashboard",
|
|
10
|
-
"details",
|
|
11
|
-
"discussions",
|
|
12
|
-
"events",
|
|
13
|
-
"followers",
|
|
14
|
-
"overview",
|
|
15
|
-
"settings",
|
|
16
|
-
"teams",
|
|
17
|
-
"metrics",
|
|
18
|
-
"members",
|
|
19
|
-
"content",
|
|
20
|
-
];
|
|
21
|
-
/**
|
|
22
|
-
* Validate a capability. This is used because the libary can be used outside of typescript and we want to be able to return a message is the string passed in is not a valid capability
|
|
23
|
-
* @param Capability
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
function isCapability(maybeCapability) {
|
|
27
|
-
return validCapabilities.includes(maybeCapability);
|
|
28
|
-
}
|
|
29
|
-
exports.isCapability = isCapability;
|
|
30
|
-
//# sourceMappingURL=types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/capabilities/types.ts"],"names":[],"mappings":";;;AAQA;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACxB,eAAe;IACf,WAAW;IACX,SAAS;IACT,aAAa;IACb,QAAQ;IACR,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,SAAS;IACT,SAAS;IACT,SAAS;CACD,CAAC;AAOX;;;;GAIG;AACH,SAAgB,YAAY,CAAC,eAAuB;IAClD,OAAO,iBAAiB,CAAC,QAAQ,CAAC,eAA6B,CAAC,CAAC;AACnE,CAAC;AAFD,oCAEC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IArcGISContext } from "../../ArcGISContext";
|
|
2
|
-
import { HubEntity, IHubItemEntity } from "../../core";
|
|
3
|
-
import { ICapabilityAccessResponse, ICapabilityPermission } from "../types";
|
|
4
|
-
/**
|
|
5
|
-
* Check an individual capability access rule
|
|
6
|
-
* @param rule
|
|
7
|
-
* @param context
|
|
8
|
-
* @param entity
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
export declare function checkCapabilityAccess(rule: ICapabilityPermission, context: IArcGISContext, entity: IHubItemEntity | HubEntity): ICapabilityAccessResponse;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./checkCapabilityAccess";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Capability, ICapabilityAccessResponse } from "./types";
|
|
2
|
-
import { IArcGISContext, HubEntity, IHubItemEntity } from "../index";
|
|
3
|
-
/**
|
|
4
|
-
* Check if a capability is enabled for a given entity and if the current user has necessary permissions to access it
|
|
5
|
-
* @param capability
|
|
6
|
-
* @param context
|
|
7
|
-
* @param entity
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
export declare function checkCapability(capability: Capability, context: IArcGISContext, entity: IHubItemEntity | HubEntity): ICapabilityAccessResponse;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { IWorkspaceCapabilityResponse, ICapabilityPermission } from "./types";
|
|
2
|
-
import { HubEntity } from "../core";
|
|
3
|
-
import { IArcGISContext } from "../ArcGISContext";
|
|
4
|
-
/**
|
|
5
|
-
* List of all the Capability Permissions in the Hub System
|
|
6
|
-
* These are defined in the entity specific modules files
|
|
7
|
-
*/
|
|
8
|
-
export declare const CapabilityPermissions: ICapabilityPermission[];
|
|
9
|
-
/**
|
|
10
|
-
* DEPRECATED: Return the capabilities that are granted to the current user for a given entity
|
|
11
|
-
* This is used by the Hub Components to determine which Workspace Navigation Links to show
|
|
12
|
-
* @param entity
|
|
13
|
-
* @param context
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare function getWorkspaceCapabilities(entity: HubEntity, context: IArcGISContext): IWorkspaceCapabilityResponse;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { EntityCapabilities } from "./types";
|
|
2
|
-
/**
|
|
3
|
-
* Take an entity's capabilities and merge them with the default capabilities ensuring that only the capabilities defined in the business rules are allowed through.
|
|
4
|
-
* @param entityCapabilities
|
|
5
|
-
* @param defaultCapabilities
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
export declare function processEntityCapabilities(entityCapabilities: EntityCapabilities, defaultCapabilities: EntityCapabilities): EntityCapabilities;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { HubEntityType, IPermissionAccessResponse, Permission } from "../index";
|
|
2
|
-
import { IAccessResponse } from "../core/types/IAccessResponse";
|
|
3
|
-
/**
|
|
4
|
-
* Hub System Capabilities
|
|
5
|
-
*/
|
|
6
|
-
declare const validCapabilities: readonly ["collaboration", "dashboard", "details", "discussions", "events", "followers", "overview", "settings", "teams", "metrics", "members", "content"];
|
|
7
|
-
/**
|
|
8
|
-
* Defines the possible values for Capability
|
|
9
|
-
*/
|
|
10
|
-
export declare type Capability = (typeof validCapabilities)[number];
|
|
11
|
-
/**
|
|
12
|
-
* Validate a capability. This is used because the libary can be used outside of typescript and we want to be able to return a message is the string passed in is not a valid capability
|
|
13
|
-
* @param Capability
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
export declare function isCapability(maybeCapability: string): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Hash of with keys constrained to Capability
|
|
19
|
-
*/
|
|
20
|
-
export declare type EntityCapabilities = {
|
|
21
|
-
[key in Capability]?: boolean;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Defines the permissions required to access a specific capability, for a specific entity type
|
|
25
|
-
*/
|
|
26
|
-
export interface ICapabilityPermission {
|
|
27
|
-
entity: HubEntityType;
|
|
28
|
-
capability: Capability;
|
|
29
|
-
permissions: Permission[];
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Response from checking a Capability
|
|
33
|
-
*/
|
|
34
|
-
export interface ICapabilityAccessResponse extends IAccessResponse {
|
|
35
|
-
/**
|
|
36
|
-
* Capability being checked
|
|
37
|
-
*/
|
|
38
|
-
capability: Capability;
|
|
39
|
-
/**
|
|
40
|
-
* Individual permission check responses. Used for observability
|
|
41
|
-
*/
|
|
42
|
-
responses: IPermissionAccessResponse[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* All capability checks for an Entity's workspace
|
|
46
|
-
*/
|
|
47
|
-
export interface IWorkspaceCapabilityResponse {
|
|
48
|
-
/**
|
|
49
|
-
* Array of capabilities the current user has access to, in the context of a given entity
|
|
50
|
-
*/
|
|
51
|
-
granted: Capability[];
|
|
52
|
-
/**
|
|
53
|
-
* Detailed checks for each capability. Used for observability
|
|
54
|
-
*/
|
|
55
|
-
details: ICapabilityAccessResponse[];
|
|
56
|
-
}
|
|
57
|
-
export {};
|