@esri/hub-common 11.23.1 → 12.0.0-alpha.1

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 (242) hide show
  1. package/dist/esm/ArcGISContext.js +24 -1
  2. package/dist/esm/ArcGISContext.js.map +1 -1
  3. package/dist/esm/ArcGISContextManager.js +48 -0
  4. package/dist/esm/ArcGISContextManager.js.map +1 -1
  5. package/dist/esm/content/compose.js +12 -0
  6. package/dist/esm/content/compose.js.map +1 -1
  7. package/dist/esm/core/HubItemEntity.js +39 -57
  8. package/dist/esm/core/HubItemEntity.js.map +1 -1
  9. package/dist/esm/core/_internal/PropertyMapper.js +10 -2
  10. package/dist/esm/core/_internal/PropertyMapper.js.map +1 -1
  11. package/dist/esm/core/_internal/getBasePropertyMap.js +1 -0
  12. package/dist/esm/core/_internal/getBasePropertyMap.js.map +1 -1
  13. package/dist/esm/core/behaviors/IWithPermissionBehavior.js +0 -68
  14. package/dist/esm/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  15. package/dist/esm/core/fetchHubEntity.js +28 -0
  16. package/dist/esm/core/fetchHubEntity.js.map +1 -0
  17. package/dist/esm/core/getTypeFromEntity.js +26 -0
  18. package/dist/esm/core/getTypeFromEntity.js.map +1 -0
  19. package/dist/esm/core/index.js +2 -1
  20. package/dist/esm/core/index.js.map +1 -1
  21. package/dist/esm/core/types/HubEntity.js +1 -0
  22. package/dist/esm/core/types/HubEntity.js.map +1 -0
  23. package/dist/esm/core/types/HubEntityType.js +1 -0
  24. package/dist/esm/core/types/HubEntityType.js.map +1 -0
  25. package/dist/esm/core/types/ISystemStatus.js +21 -0
  26. package/dist/esm/core/types/ISystemStatus.js.map +1 -0
  27. package/dist/esm/core/types/index.js +3 -2
  28. package/dist/esm/core/types/index.js.map +1 -1
  29. package/dist/esm/index.js +1 -0
  30. package/dist/esm/index.js.map +1 -1
  31. package/dist/esm/initiatives/HubInitiative.js +0 -13
  32. package/dist/esm/initiatives/HubInitiative.js.map +1 -1
  33. package/dist/esm/permissions/HubPermissionPolicies.js +18 -0
  34. package/dist/esm/permissions/HubPermissionPolicies.js.map +1 -0
  35. package/dist/esm/permissions/_internal/checkAuthentication.js +24 -0
  36. package/dist/esm/permissions/_internal/checkAuthentication.js.map +1 -0
  37. package/dist/esm/permissions/_internal/checkEdit.js +35 -0
  38. package/dist/esm/permissions/_internal/checkEdit.js.map +1 -0
  39. package/dist/esm/permissions/_internal/checkEntityPolicy.js +56 -0
  40. package/dist/esm/permissions/_internal/checkEntityPolicy.js.map +1 -0
  41. package/dist/esm/permissions/_internal/checkLicense.js +27 -0
  42. package/dist/esm/permissions/_internal/checkLicense.js.map +1 -0
  43. package/dist/esm/permissions/_internal/checkOwner.js +36 -0
  44. package/dist/esm/permissions/_internal/checkOwner.js.map +1 -0
  45. package/dist/esm/permissions/_internal/checkPrivileges.js +27 -0
  46. package/dist/esm/permissions/_internal/checkPrivileges.js.map +1 -0
  47. package/dist/esm/permissions/_internal/getPolicyResponseCode.js +29 -0
  48. package/dist/esm/permissions/_internal/getPolicyResponseCode.js.map +1 -0
  49. package/dist/esm/permissions/checkPermission.js +88 -0
  50. package/dist/esm/permissions/checkPermission.js.map +1 -0
  51. package/dist/esm/permissions/index.js +5 -0
  52. package/dist/esm/permissions/index.js.map +1 -0
  53. package/dist/esm/permissions/types/HubLicense.js +1 -0
  54. package/dist/esm/permissions/types/HubLicense.js.map +1 -0
  55. package/dist/esm/permissions/types/IAccessResponse.js +1 -0
  56. package/dist/esm/permissions/types/IAccessResponse.js.map +1 -0
  57. package/dist/esm/permissions/types/IEntityPermissionPolicy.js +1 -0
  58. package/dist/esm/permissions/types/IEntityPermissionPolicy.js.map +1 -0
  59. package/dist/esm/permissions/types/IPermissionPolicy.js +1 -0
  60. package/dist/esm/permissions/types/IPermissionPolicy.js.map +1 -0
  61. package/dist/esm/permissions/types/IPolicyCheck.js +1 -0
  62. package/dist/esm/permissions/types/IPolicyCheck.js.map +1 -0
  63. package/dist/esm/permissions/types/Permission.js +24 -0
  64. package/dist/esm/permissions/types/Permission.js.map +1 -0
  65. package/dist/esm/permissions/types/PlatformPrivilege.js +5 -0
  66. package/dist/esm/permissions/types/PlatformPrivilege.js.map +1 -0
  67. package/dist/esm/permissions/types/PolicyResponse.js +4 -0
  68. package/dist/esm/permissions/types/PolicyResponse.js.map +1 -0
  69. package/dist/esm/permissions/types/index.js +9 -0
  70. package/dist/esm/permissions/types/index.js.map +1 -0
  71. package/dist/esm/permissions/utils.js +26 -0
  72. package/dist/esm/permissions/utils.js.map +1 -0
  73. package/dist/esm/projects/HubProject.js +5 -14
  74. package/dist/esm/projects/HubProject.js.map +1 -1
  75. package/dist/esm/projects/_internal/ProjectPermissionPolicies.js +35 -0
  76. package/dist/esm/projects/_internal/ProjectPermissionPolicies.js.map +1 -0
  77. package/dist/esm/projects/_internal.js +43 -0
  78. package/dist/esm/projects/_internal.js.map +1 -0
  79. package/dist/esm/projects/edit.js +115 -0
  80. package/dist/esm/projects/edit.js.map +1 -0
  81. package/dist/esm/projects/fetch.js +104 -0
  82. package/dist/esm/projects/fetch.js.map +1 -0
  83. package/dist/esm/projects/index.js +2 -1
  84. package/dist/esm/projects/index.js.map +1 -1
  85. package/dist/esm/search/Catalog.js.map +1 -1
  86. package/dist/esm/sites/HubSite.js +0 -13
  87. package/dist/esm/sites/HubSite.js.map +1 -1
  88. package/dist/esm/sites/_internal/SitesPermissionPolicies.js +34 -0
  89. package/dist/esm/sites/_internal/SitesPermissionPolicies.js.map +1 -0
  90. package/dist/esm/util.js +3 -1
  91. package/dist/esm/util.js.map +1 -1
  92. package/dist/node/ArcGISContext.js +28 -5
  93. package/dist/node/ArcGISContext.js.map +1 -1
  94. package/dist/node/ArcGISContextManager.js +48 -0
  95. package/dist/node/ArcGISContextManager.js.map +1 -1
  96. package/dist/node/content/compose.js +12 -0
  97. package/dist/node/content/compose.js.map +1 -1
  98. package/dist/node/core/HubItemEntity.js +38 -56
  99. package/dist/node/core/HubItemEntity.js.map +1 -1
  100. package/dist/node/core/_internal/PropertyMapper.js +9 -1
  101. package/dist/node/core/_internal/PropertyMapper.js.map +1 -1
  102. package/dist/node/core/_internal/getBasePropertyMap.js +1 -0
  103. package/dist/node/core/_internal/getBasePropertyMap.js.map +1 -1
  104. package/dist/node/core/behaviors/IWithPermissionBehavior.js +0 -73
  105. package/dist/node/core/behaviors/IWithPermissionBehavior.js.map +1 -1
  106. package/dist/node/core/fetchHubEntity.js +32 -0
  107. package/dist/node/core/fetchHubEntity.js.map +1 -0
  108. package/dist/node/core/getTypeFromEntity.js +30 -0
  109. package/dist/node/core/getTypeFromEntity.js.map +1 -0
  110. package/dist/node/core/index.js +2 -1
  111. package/dist/node/core/index.js.map +1 -1
  112. package/dist/node/core/types/{IHubPermission.js → HubEntity.js} +1 -1
  113. package/dist/node/core/types/HubEntity.js.map +1 -0
  114. package/dist/node/core/types/HubEntityType.js +3 -0
  115. package/dist/node/core/types/HubEntityType.js.map +1 -0
  116. package/dist/node/core/types/ISystemStatus.js +25 -0
  117. package/dist/node/core/types/ISystemStatus.js.map +1 -0
  118. package/dist/node/core/types/index.js +3 -2
  119. package/dist/node/core/types/index.js.map +1 -1
  120. package/dist/node/index.js +1 -0
  121. package/dist/node/index.js.map +1 -1
  122. package/dist/node/initiatives/HubInitiative.js +0 -13
  123. package/dist/node/initiatives/HubInitiative.js.map +1 -1
  124. package/dist/node/permissions/HubPermissionPolicies.js +22 -0
  125. package/dist/node/permissions/HubPermissionPolicies.js.map +1 -0
  126. package/dist/node/permissions/_internal/checkAuthentication.js +28 -0
  127. package/dist/node/permissions/_internal/checkAuthentication.js.map +1 -0
  128. package/dist/node/permissions/_internal/checkEdit.js +39 -0
  129. package/dist/node/permissions/_internal/checkEdit.js.map +1 -0
  130. package/dist/node/permissions/_internal/checkEntityPolicy.js +60 -0
  131. package/dist/node/permissions/_internal/checkEntityPolicy.js.map +1 -0
  132. package/dist/node/permissions/_internal/checkLicense.js +31 -0
  133. package/dist/node/permissions/_internal/checkLicense.js.map +1 -0
  134. package/dist/node/permissions/_internal/checkOwner.js +40 -0
  135. package/dist/node/permissions/_internal/checkOwner.js.map +1 -0
  136. package/dist/node/permissions/_internal/checkPrivileges.js +31 -0
  137. package/dist/node/permissions/_internal/checkPrivileges.js.map +1 -0
  138. package/dist/node/permissions/_internal/getPolicyResponseCode.js +33 -0
  139. package/dist/node/permissions/_internal/getPolicyResponseCode.js.map +1 -0
  140. package/dist/node/permissions/checkPermission.js +92 -0
  141. package/dist/node/permissions/checkPermission.js.map +1 -0
  142. package/dist/node/permissions/index.js +8 -0
  143. package/dist/node/permissions/index.js.map +1 -0
  144. package/dist/node/permissions/types/HubLicense.js +3 -0
  145. package/dist/node/permissions/types/HubLicense.js.map +1 -0
  146. package/dist/node/permissions/types/IAccessResponse.js +3 -0
  147. package/dist/node/permissions/types/IAccessResponse.js.map +1 -0
  148. package/dist/node/permissions/types/IEntityPermissionPolicy.js +3 -0
  149. package/dist/node/permissions/types/IEntityPermissionPolicy.js.map +1 -0
  150. package/dist/node/permissions/types/IPermissionPolicy.js +3 -0
  151. package/dist/node/permissions/types/IPermissionPolicy.js.map +1 -0
  152. package/dist/node/permissions/types/IPolicyCheck.js +3 -0
  153. package/dist/node/permissions/types/IPolicyCheck.js.map +1 -0
  154. package/dist/node/permissions/types/Permission.js +28 -0
  155. package/dist/node/permissions/types/Permission.js.map +1 -0
  156. package/dist/node/permissions/types/PlatformPrivilege.js +7 -0
  157. package/dist/node/permissions/types/PlatformPrivilege.js.map +1 -0
  158. package/dist/node/permissions/types/PolicyResponse.js +6 -0
  159. package/dist/node/permissions/types/PolicyResponse.js.map +1 -0
  160. package/dist/node/permissions/types/index.js +12 -0
  161. package/dist/node/permissions/types/index.js.map +1 -0
  162. package/dist/node/permissions/utils.js +31 -0
  163. package/dist/node/permissions/utils.js.map +1 -0
  164. package/dist/node/projects/HubProject.js +10 -19
  165. package/dist/node/projects/HubProject.js.map +1 -1
  166. package/dist/node/projects/_internal/ProjectPermissionPolicies.js +38 -0
  167. package/dist/node/projects/_internal/ProjectPermissionPolicies.js.map +1 -0
  168. package/dist/node/projects/_internal.js +48 -0
  169. package/dist/node/projects/_internal.js.map +1 -0
  170. package/dist/node/projects/edit.js +122 -0
  171. package/dist/node/projects/edit.js.map +1 -0
  172. package/dist/node/projects/fetch.js +110 -0
  173. package/dist/node/projects/fetch.js.map +1 -0
  174. package/dist/node/projects/index.js +2 -1
  175. package/dist/node/projects/index.js.map +1 -1
  176. package/dist/node/search/Catalog.js.map +1 -1
  177. package/dist/node/sites/HubSite.js +0 -13
  178. package/dist/node/sites/HubSite.js.map +1 -1
  179. package/dist/node/sites/_internal/SitesPermissionPolicies.js +37 -0
  180. package/dist/node/sites/_internal/SitesPermissionPolicies.js.map +1 -0
  181. package/dist/node/util.js +3 -1
  182. package/dist/node/util.js.map +1 -1
  183. package/dist/types/ArcGISContext.d.ts +23 -1
  184. package/dist/types/ArcGISContextManager.d.ts +6 -1
  185. package/dist/types/content/_internal.d.ts +15 -5
  186. package/dist/types/core/HubItemEntity.d.ts +29 -4
  187. package/dist/types/core/behaviors/IWithPermissionBehavior.d.ts +23 -35
  188. package/dist/types/core/behaviors/IWithStoreBehavior.d.ts +10 -10
  189. package/dist/types/core/fetchHubEntity.d.ts +11 -0
  190. package/dist/types/core/getTypeFromEntity.d.ts +8 -0
  191. package/dist/types/core/index.d.ts +2 -1
  192. package/dist/types/core/traits/IWithPermissions.d.ts +3 -3
  193. package/dist/types/core/types/HubEntity.d.ts +5 -0
  194. package/dist/types/core/types/HubEntityType.d.ts +1 -0
  195. package/dist/types/core/types/IHubContent.d.ts +2 -1
  196. package/dist/types/core/types/IHubItemEntity.d.ts +19 -2
  197. package/dist/types/core/types/ISystemStatus.d.ts +22 -0
  198. package/dist/types/core/types/index.d.ts +3 -2
  199. package/dist/types/index.d.ts +1 -0
  200. package/dist/types/initiatives/HubInitiative.d.ts +1 -7
  201. package/dist/types/permissions/HubPermissionPolicies.d.ts +11 -0
  202. package/dist/types/permissions/_internal/checkAuthentication.d.ts +11 -0
  203. package/dist/types/permissions/_internal/checkEdit.d.ts +11 -0
  204. package/dist/types/permissions/_internal/checkEntityPolicy.d.ts +9 -0
  205. package/dist/types/permissions/_internal/checkLicense.d.ts +10 -0
  206. package/dist/types/permissions/_internal/checkOwner.d.ts +11 -0
  207. package/dist/types/permissions/_internal/checkPrivileges.d.ts +11 -0
  208. package/dist/types/permissions/_internal/getPolicyResponseCode.d.ts +7 -0
  209. package/dist/types/permissions/checkPermission.d.ts +11 -0
  210. package/dist/types/permissions/index.d.ts +4 -0
  211. package/dist/types/permissions/types/HubLicense.d.ts +4 -0
  212. package/dist/types/permissions/types/IAccessResponse.d.ts +29 -0
  213. package/dist/types/permissions/types/IEntityPermissionPolicy.d.ts +22 -0
  214. package/dist/types/permissions/types/IPermissionPolicy.d.ts +48 -0
  215. package/dist/types/permissions/types/IPolicyCheck.d.ts +25 -0
  216. package/dist/types/permissions/types/Permission.d.ts +17 -0
  217. package/dist/types/permissions/types/PlatformPrivilege.d.ts +5 -0
  218. package/dist/types/permissions/types/PolicyResponse.d.ts +4 -0
  219. package/dist/types/permissions/types/index.d.ts +8 -0
  220. package/dist/types/permissions/utils.d.ts +18 -0
  221. package/dist/types/projects/HubProject.d.ts +1 -7
  222. package/dist/types/projects/_internal/ProjectPermissionPolicies.d.ts +7 -0
  223. package/dist/types/projects/_internal.d.ts +20 -0
  224. package/dist/types/projects/{HubProjects.d.ts → edit.d.ts} +1 -29
  225. package/dist/types/projects/fetch.d.ts +30 -0
  226. package/dist/types/projects/index.d.ts +2 -1
  227. package/dist/types/sites/HubSite.d.ts +1 -7
  228. package/dist/types/sites/_internal/SitesPermissionPolicies.d.ts +6 -0
  229. package/package.json +1 -1
  230. package/dist/esm/core/PermissionManager.js +0 -60
  231. package/dist/esm/core/PermissionManager.js.map +0 -1
  232. package/dist/esm/core/types/IHubPermission.js +0 -1
  233. package/dist/esm/core/types/IHubPermission.js.map +0 -1
  234. package/dist/esm/projects/HubProjects.js +0 -248
  235. package/dist/esm/projects/HubProjects.js.map +0 -1
  236. package/dist/node/core/PermissionManager.js +0 -64
  237. package/dist/node/core/PermissionManager.js.map +0 -1
  238. package/dist/node/core/types/IHubPermission.js.map +0 -1
  239. package/dist/node/projects/HubProjects.js +0 -258
  240. package/dist/node/projects/HubProjects.js.map +0 -1
  241. package/dist/types/core/PermissionManager.d.ts +0 -43
  242. package/dist/types/core/types/IHubPermission.d.ts +0 -23
@@ -0,0 +1,8 @@
1
+ import { HubEntity } from "./types/HubEntity";
2
+ import { HubEntityType } from "./types/HubEntityType";
3
+ /**
4
+ * Given a HubEntity, return it's HubEntityType
5
+ * @param entity
6
+ * @returns
7
+ */
8
+ export declare function getTypeFromEntity(entity: HubEntity): HubEntityType;
@@ -1,5 +1,6 @@
1
1
  export * from "./traits";
2
2
  export * from "./types";
3
3
  export * from "./behaviors";
4
- export * from "./PermissionManager";
5
4
  export * from "./schemas";
5
+ export * from "./fetchHubEntity";
6
+ export * from "./getTypeFromEntity";
@@ -1,10 +1,10 @@
1
- import { IHubPermission } from "../types";
1
+ import { IEntityPermissionPolicy } from "../../permissions";
2
2
  /**
3
3
  * Adds permissions property to an entity
4
4
  */
5
5
  export interface IWithPermissions {
6
6
  /**
7
- * List of permissions for the entity
7
+ * Array of permission policies that apply to the entity
8
8
  */
9
- permissions: IHubPermission[];
9
+ permissions?: IEntityPermissionPolicy[];
10
10
  }
@@ -0,0 +1,5 @@
1
+ import { IHubInitiative } from "./IHubInitiative";
2
+ import { IHubPage } from "./IHubPage";
3
+ import { IHubProject } from "./IHubProject";
4
+ import { IHubSite } from "./IHubSite";
5
+ export declare type HubEntity = IHubSite | IHubProject | IHubInitiative | IHubPage;
@@ -0,0 +1 @@
1
+ export declare type HubEntityType = "site" | "project" | "initiative" | "page";
@@ -15,7 +15,7 @@ export declare enum PublisherSource {
15
15
  /**
16
16
  * Data model for content
17
17
  */
18
- export interface IHubContent extends Omit<IHubItemEntity, "schemaVersion">, IHubContentEnrichments, IItem {
18
+ export interface IHubContent extends Omit<IHubItemEntity, "schemaVersion" | "permissions">, IHubContentEnrichments, IItem {
19
19
  /**
20
20
  * The underlying portal item referenced by this content
21
21
  */
@@ -40,6 +40,7 @@ export interface IHubContent extends Omit<IHubItemEntity, "schemaVersion">, IHub
40
40
  identifier: string;
41
41
  /**
42
42
  * Content visibility and access control, including groups
43
+ * NOTE: this needs to be reconciled with Hub permission system
43
44
  */
44
45
  permissions: {
45
46
  /** Visibility of the content */
@@ -1,11 +1,11 @@
1
1
  import { IHubEntityBase } from "./IHubEntityBase";
2
2
  import { IHubGeography } from "../../types";
3
3
  import { AccessLevel } from "./types";
4
- import { IWithViewSettings } from "../traits";
4
+ import { IWithPermissions, IWithViewSettings } from "../traits";
5
5
  /**
6
6
  * Properties exposed by Entities that are backed by Items
7
7
  */
8
- export interface IHubItemEntity extends IHubEntityBase {
8
+ export interface IHubItemEntity extends IHubEntityBase, IWithPermissions {
9
9
  /**
10
10
  * Access level of the item ("private" | "org" | "public")
11
11
  */
@@ -29,6 +29,11 @@ export interface IHubItemEntity extends IHubEntityBase {
29
29
  * Extent of the Entity
30
30
  */
31
31
  extent?: number[][];
32
+ /**
33
+ * Platform derived based on current user's access to the entity
34
+ * if defined, it means the user can edit the entity
35
+ */
36
+ itemControl: string;
32
37
  /**
33
38
  * Username of the owner of the item
34
39
  */
@@ -62,4 +67,16 @@ export interface IHubItemEntity extends IHubEntityBase {
62
67
  * Project display properties
63
68
  */
64
69
  view?: IWithViewSettings;
70
+ /**
71
+ * Can current user edit the entity
72
+ * Derived from `item.itemControl` = "admin" | "update"
73
+ * @readonly
74
+ */
75
+ canEdit: boolean;
76
+ /**
77
+ * Can current user delete the entity
78
+ * Derived from `item.itemControl` = "admin"
79
+ * @readonly
80
+ */
81
+ canDelete: boolean;
65
82
  }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * What is the status of a subsystem
3
+ */
4
+ export declare type SystemStatus = "online" | "offline" | "maintenance" | "not-available";
5
+ /**
6
+ * Hash of subsystems and their status
7
+ */
8
+ export declare type HubSystemStatus = {
9
+ [key in HubSubsystem]: SystemStatus;
10
+ };
11
+ declare const validSubsystems: readonly ["discussions", "events", "initiatives", "items", "metrics", "notifications", "pages", "projects", "search", "sites"];
12
+ /**
13
+ * Defines values for HubSubsystem
14
+ */
15
+ export declare type HubSubsystem = typeof validSubsystems[number];
16
+ /**
17
+ * Validate a Subsystem
18
+ * @param subsystem
19
+ * @returns
20
+ */
21
+ export declare function isSubsystem(maybeSubsystem: string): boolean;
22
+ export {};
@@ -1,3 +1,5 @@
1
+ export * from "./HubEntity";
2
+ export * from "./HubEntityType";
1
3
  export * from "./IHubContent";
2
4
  export * from "./IHubContentEnrichments";
3
5
  export * from "./IHubEntityBase";
@@ -13,6 +15,5 @@ export * from "./IHubSiteTheme";
13
15
  export * from "./IHubTimeline";
14
16
  export * from "./IItemEnrichments";
15
17
  export * from "./IServerEnrichments";
18
+ export * from "./ISystemStatus";
16
19
  export * from "./types";
17
- export * from "./IHubPermission";
18
- export * from "../traits/IWithViewSettings";
@@ -16,6 +16,7 @@ export * from "./models";
16
16
  export * from "./objects";
17
17
  export * from "./org";
18
18
  export * from "./pages";
19
+ export * from "./permissions";
19
20
  export * from "./projects";
20
21
  export * from "./request";
21
22
  export * from "./resources";
@@ -1,4 +1,4 @@
1
- import { IHubInitiative, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior } from "../core";
1
+ import { IHubInitiative, IWithPermissionBehavior, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior } from "../core";
2
2
  import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
4
  import { HubItemEntity } from "../core/HubItemEntity";
@@ -7,7 +7,6 @@ import { HubItemEntity } from "../core/HubItemEntity";
7
7
  */
8
8
  export declare class HubInitiative extends HubItemEntity<IHubInitiative> implements IWithStoreBehavior<IHubInitiative>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
9
9
  private _catalog;
10
- private _permissionManager;
11
10
  /**
12
11
  * Private constructor so we don't have `new` all over the place. Allows for
13
12
  * more flexibility in how we create the HubInitiativeManager over time.
@@ -19,11 +18,6 @@ export declare class HubInitiative extends HubItemEntity<IHubInitiative> impleme
19
18
  * @returns Catalog
20
19
  */
21
20
  get catalog(): Catalog;
22
- /**
23
- * PermissionManager instance for this Initiative. Note: Do not hold direct references to this object; always access it from the Initiative.
24
- * @returns PermissionManager
25
- */
26
- get permissions(): PermissionManager;
27
21
  /**
28
22
  * Create an instance from an IHubInitiative object
29
23
  * @param json - JSON object to create a HubInitiative from
@@ -0,0 +1,11 @@
1
+ import { IPermissionPolicy, Permission } from "./types";
2
+ /**
3
+ * All the permission policies for the Hub
4
+ */
5
+ export declare const HubPermissionsPolicies: IPermissionPolicy[];
6
+ /**
7
+ * Get the policies defined for a specific permission
8
+ * @param permission
9
+ * @returns
10
+ */
11
+ export declare function getPermissionPolicy(permission: Permission): IPermissionPolicy;
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { HubEntity } from "../../core";
3
+ import { IPermissionPolicy, IPolicyCheck } from "../types";
4
+ /**
5
+ * Validate authentication policy
6
+ * @param policy
7
+ * @param context
8
+ * @param entity
9
+ * @returns
10
+ */
11
+ export declare function checkAuthentication(policy: IPermissionPolicy, context: IArcGISContext, entity?: HubEntity): IPolicyCheck[];
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { HubEntity } from "../../core";
3
+ import { IPermissionPolicy, IPolicyCheck } from "../types";
4
+ /**
5
+ * Validate entityEdit policy
6
+ * @param policy
7
+ * @param context
8
+ * @param entity
9
+ * @returns
10
+ */
11
+ export declare function checkEdit(policy: IPermissionPolicy, context: IArcGISContext, entity?: HubEntity): IPolicyCheck[];
@@ -0,0 +1,9 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { IPolicyCheck, IEntityPermissionPolicy } from "../types";
3
+ /**
4
+ * Validate user meets entity policy
5
+ * @param policy
6
+ * @param context
7
+ * @returns
8
+ */
9
+ export declare function checkEntityPolicy(policy: IEntityPermissionPolicy, context: IArcGISContext): IPolicyCheck;
@@ -0,0 +1,10 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { IPermissionPolicy, IPolicyCheck } from "../types";
3
+ /**
4
+ * Validate license policy
5
+ * @param policy
6
+ * @param response
7
+ * @param context
8
+ * @returns
9
+ */
10
+ export declare function checkLicense(policy: IPermissionPolicy, context: IArcGISContext): IPolicyCheck[];
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { HubEntity } from "../../core";
3
+ import { IPermissionPolicy, IPolicyCheck } from "../types";
4
+ /**
5
+ * Validate entityOwner policy
6
+ * @param policy
7
+ * @param context
8
+ * @param entity
9
+ * @returns
10
+ */
11
+ export declare function checkOwner(policy: IPermissionPolicy, context: IArcGISContext, entity?: HubEntity): IPolicyCheck[];
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../../ArcGISContext";
2
+ import { HubEntity } from "../../core";
3
+ import { IPermissionPolicy, IPolicyCheck } from "../types";
4
+ /**
5
+ * Validate privilege policy
6
+ * @param policy
7
+ * @param context
8
+ * @param entity
9
+ * @returns
10
+ */
11
+ export declare function checkPrivileges(policy: IPermissionPolicy, context: IArcGISContext, entity?: HubEntity): IPolicyCheck[];
@@ -0,0 +1,7 @@
1
+ import { PolicyResponse } from "../types";
2
+ /**
3
+ * Get a code that can be used for i18n or other purposes, based on the PolicyResponse
4
+ * @param response
5
+ * @returns
6
+ */
7
+ export declare function getPolicyResponseCode(response: PolicyResponse): string;
@@ -0,0 +1,11 @@
1
+ import { IArcGISContext } from "../ArcGISContext";
2
+ import { HubEntity } from "../core";
3
+ import { IAccessResponse, Permission } from "./types";
4
+ /**
5
+ * Check a permission against the system policies, and possibly an entity policy
6
+ * @param permission
7
+ * @param context
8
+ * @param entity
9
+ * @returns
10
+ */
11
+ export declare function checkPermission(permission: Permission, context: IArcGISContext, entity?: HubEntity): IAccessResponse;
@@ -0,0 +1,4 @@
1
+ export * from "./HubPermissionPolicies";
2
+ export * from "./checkPermission";
3
+ export * from "./utils";
4
+ export * from "./types";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Defines the values for hub license types
3
+ */
4
+ export declare type HubLicense = "hub-basic" | "hub-premium" | "enterprise-sites";
@@ -0,0 +1,29 @@
1
+ import { Permission } from "./Permission";
2
+ import { IPolicyCheck } from "./IPolicyCheck";
3
+ import { PolicyResponse } from "./PolicyResponse";
4
+ /**
5
+ * Response from a permission check
6
+ */
7
+ export interface IAccessResponse {
8
+ /**
9
+ * Permission being checked
10
+ */
11
+ permission: Permission;
12
+ /**
13
+ * Is the user allowed to perform the action
14
+ */
15
+ access: boolean;
16
+ /**
17
+ * Code for the access response. Used for i18n and UX level messages
18
+ */
19
+ code: string;
20
+ /**
21
+ * Reason for the access response
22
+ */
23
+ response: PolicyResponse;
24
+ /**
25
+ * List of all the policies that were checked, and their responses
26
+ * For debugging / observability
27
+ */
28
+ checks: IPolicyCheck[];
29
+ }
@@ -0,0 +1,22 @@
1
+ import { Permission } from "./Permission";
2
+ /**
3
+ * Association of a Permission with a set of collaborators
4
+ */
5
+ export interface IEntityPermissionPolicy {
6
+ /**
7
+ * Permission being granted
8
+ */
9
+ permission: Permission;
10
+ /**
11
+ * Type of the collaboration - org, group, group-admin or user
12
+ */
13
+ collaborationType: CollaborationType;
14
+ /**
15
+ * Id of the collaboration set
16
+ */
17
+ collaborationId: string;
18
+ }
19
+ /**
20
+ * Type of collaboration set. Used when associating a permission with a set of collaborators
21
+ */
22
+ export declare type CollaborationType = "user" | "group" | "group-admin" | "org";
@@ -0,0 +1,48 @@
1
+ import { HubLicense } from "./HubLicense";
2
+ import { HubSubsystem } from "../../core/types/ISystemStatus";
3
+ import { Permission } from "./Permission";
4
+ import { PlatformPrivilege } from "./PlatformPrivilege";
5
+ /**
6
+ * Defines a system level policy for a specific permission.
7
+ * All conditions must be met for the permission to be granted. Additinonal conditions may be added by an entity to further
8
+ * limit access when the permission is checed in the contex to the entity.
9
+ * e.g. "hub:project:create" in the context of an Initiative, may further restrict to members of a specfic group
10
+ */
11
+ export interface IPermissionPolicy {
12
+ /**
13
+ * Permission being defined
14
+ */
15
+ permission: Permission;
16
+ /**
17
+ * What subsystems are required to be online for this permission to be granted
18
+ */
19
+ subsystems: HubSubsystem[];
20
+ /**
21
+ * Must the user authenticated?
22
+ */
23
+ authenticated: boolean;
24
+ /**
25
+ * What licenses are required for this permission to be granted.
26
+ * This is checking the licese of the current user's org. It is not transitive to the entity being accessed.
27
+ * e.g. If a user is in a Partner "hub-basic" org, they can not create "premium" entities (e.g. Projects)
28
+ */
29
+ licenses: HubLicense[];
30
+ /**
31
+ * Any platform level privileges required for this permission to be granted
32
+ * e.g. "portal:user:createItem"
33
+ */
34
+ privileges?: PlatformPrivilege[];
35
+ /**
36
+ * Does the user need to be in a specific platform role to be granted this permission?
37
+ * This is likely extremely rare.
38
+ */
39
+ roles?: string[];
40
+ /**
41
+ * Does the user require edit access to the entity to be granted this permission?
42
+ */
43
+ entityEdit?: boolean;
44
+ /**
45
+ * Does the user need to be the owner of the entity to be granted this permission?
46
+ */
47
+ entityOwner?: boolean;
48
+ }
@@ -0,0 +1,25 @@
1
+ import { PolicyResponse } from "./PolicyResponse";
2
+ /**
3
+ * Information about a specific policy check, and its response
4
+ * Used for debugging / observability
5
+ */
6
+ export interface IPolicyCheck {
7
+ /**
8
+ * Description of the policy being checked
9
+ * e.g. License Required: "hub-premium"
10
+ */
11
+ name: string;
12
+ /**
13
+ * Value determined for the current user
14
+ * e.g. "hub-basic"
15
+ */
16
+ value: string;
17
+ /**
18
+ * Policy Response code, for i18n
19
+ */
20
+ code: string;
21
+ /**
22
+ * Policy Response string
23
+ */
24
+ response: PolicyResponse;
25
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Defines the values for Permissions
3
+ * Note: This needs to be managed as a single list or typechecking does not work
4
+ * We use an array so we can check for valid permissions
5
+ */
6
+ declare const validPermissions: readonly ["hub:site:create", "hub:site:delete", "hub:site:edit", "hub:site:view", "hub:project:create", "hub:project:delete", "hub:project:edit", "hub:project:view"];
7
+ /**
8
+ * Defines the possible values for Permissions
9
+ */
10
+ export declare type Permission = typeof validPermissions[number];
11
+ /**
12
+ * Validate a Permission
13
+ * @param permission
14
+ * @returns
15
+ */
16
+ export declare function isPermission(maybePermission: string): boolean;
17
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type that defines Platform Privileges
3
+ * TODO: Ensure this is a complete list
4
+ */
5
+ export declare type PlatformPrivilege = "opendata:user:designateGroup" | "opendata:user:openDataAdmin" | "portal:admin:assignToGroups" | "portal:admin:categorizeItems" | "portal:admin:changeUserRoles" | "portal:admin:createGPWebhook" | "portal:admin:createUpdateCapableGroup" | "portal:admin:deleteGroups" | "portal:admin:deleteItems" | "portal:admin:deleteUsers" | "portal:admin:disableUsers" | "portal:admin:inviteUsers" | "portal:admin:manageCollaborations" | "portal:admin:manageCredits" | "portal:admin:manageEnterpriseGroups" | "portal:admin:manageLicenses" | "portal:admin:manageRoles" | "portal:admin:manageSecurity" | "portal:admin:manageServers" | "portal:admin:manageUtilityServices" | "portal:admin:manageWebhooks" | "portal:admin:manageWebsite" | "portal:admin:reassignGroups" | "portal:admin:reassignItems" | "portal:admin:reassignUsers" | "portal:admin:shareToGroup" | "portal:admin:shareToOrg" | "portal:admin:shareToPublic" | "portal:admin:updateGroups" | "portal:admin:updateItemCategorySchema" | "portal:admin:updateItems" | "portal:admin:updateMemberCategorySchema" | "portal:admin:updateUsers" | "portal:admin:viewGroups" | "portal:admin:viewItems" | "portal:admin:viewUsers" | "portal:publisher:bulkPublishFromDataStores" | "portal:publisher:createFeatureWebhook" | "portal:publisher:publishBigDataAnalytics" | "portal:publisher:publishDynamicImagery" | "portal:publisher:publishFeatures" | "portal:publisher:publishFeeds" | "portal:publisher:publishKnowledgeGraph" | "portal:publisher:publishRealTimeAnalytics" | "portal:publisher:publishScenes" | "portal:publisher:publishServerGPServices" | "portal:publisher:publishServerServices" | "portal:publisher:publishTiledImagery" | "portal:publisher:publishTiles" | "portal:publisher:registerDataStores" | "portal:user:addExternalMembersToGroup" | "portal:user:categorizeItems" | "portal:user:createGroup" | "portal:user:createItem" | "portal:user:invitePartneredCollaborationMembers" | "portal:user:joinGroup" | "portal:user:joinNonOrgGroup" | "portal:user:reassignItems" | "portal:user:receiveItems" | "portal:user:runWebTool" | "portal:user:shareGroupToOrg" | "portal:user:shareGroupToPublic" | "portal:user:shareToGroup" | "portal:user:shareToOrg" | "portal:user:shareToPublic" | "portal:user:viewHostedFeatureServices" | "portal:user:viewHostedTileServices" | "portal:user:viewOrgGroups" | "portal:user:viewOrgItems" | "portal:user:viewOrgUsers" | "portal:user:viewTracks";
@@ -0,0 +1,4 @@
1
+ /**`
2
+ * Human readable response from a policy check
3
+ */
4
+ export declare type PolicyResponse = "granted" | "org-member" | "not-org-member" | "group-member" | "not-group-member" | "not-group-admin" | "is-user" | "not-owner" | "not-licensed" | "not-licensed-available" | "not-available" | "not-granted" | "no-edit-access" | "invalid-permission" | "privilege-required" | "system-offline" | "system-maintenance" | "entity-required" | "not-authenticated";
@@ -0,0 +1,8 @@
1
+ export * from "./HubLicense";
2
+ export * from "./IAccessResponse";
3
+ export * from "./IEntityPermissionPolicy";
4
+ export * from "./IPermissionPolicy";
5
+ export * from "./IPolicyCheck";
6
+ export * from "./Permission";
7
+ export * from "./PlatformPrivilege";
8
+ export * from "./PolicyResponse";
@@ -0,0 +1,18 @@
1
+ import { IEntityPermissionPolicy, Permission } from "./types";
2
+ /**
3
+ * Add a policy to an array of entity policies
4
+ * Returns a new array
5
+ * @param permissions
6
+ * @param policy
7
+ * @returns
8
+ */
9
+ export declare function addPermissionPolicy(permissions: IEntityPermissionPolicy[], policy: IEntityPermissionPolicy): IEntityPermissionPolicy[];
10
+ /**
11
+ * Remove a policy from an array of entity policies
12
+ * Returns a new array
13
+ * @param permissions
14
+ * @param permission
15
+ * @param id
16
+ * @returns
17
+ */
18
+ export declare function removePermissionPolicy(permissions: IEntityPermissionPolicy[], permission: Permission, id: string): IEntityPermissionPolicy[];
@@ -1,4 +1,4 @@
1
- import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, PermissionManager, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions } from "../core";
1
+ import { IHubProject, IWithPermissionBehavior, IWithCatalogBehavior, IWithStoreBehavior, IWithSharingBehavior, UiSchemaElementOptions } from "../core";
2
2
  import { Catalog } from "../search/Catalog";
3
3
  import { IArcGISContext } from "../ArcGISContext";
4
4
  import { HubItemEntity } from "../core/HubItemEntity";
@@ -8,7 +8,6 @@ import { EditorConfigType, IEditorConfig } from "../core/behaviors/IWithEditorBe
8
8
  */
9
9
  export declare class HubProject extends HubItemEntity<IHubProject> implements IWithStoreBehavior<IHubProject>, IWithPermissionBehavior, IWithCatalogBehavior, IWithSharingBehavior {
10
10
  private _catalog;
11
- private _permissionManager;
12
11
  /**
13
12
  * Private constructor so we don't have `new` all over the place. Allows for
14
13
  * more flexibility in how we create the HubProjectManager over time.
@@ -20,11 +19,6 @@ export declare class HubProject extends HubItemEntity<IHubProject> implements IW
20
19
  * @returns
21
20
  */
22
21
  get catalog(): Catalog;
23
- /**
24
- * PermissionManager instance for this project. Note: Do not hold direct references to this object; always access it from the project.
25
- * @returns
26
- */
27
- get permissions(): PermissionManager;
28
22
  /**
29
23
  * Create an instance from an IHubProject object
30
24
  * @param json - JSON object to create a HubProject from
@@ -0,0 +1,7 @@
1
+ import { IPermissionPolicy } from "../../permissions/types";
2
+ /**
3
+ * Project Permission Policies
4
+ * These define the requirements any user must meet to perform related actions
5
+ * @private
6
+ */
7
+ export declare const ProjectPermissionPolicies: IPermissionPolicy[];
@@ -0,0 +1,20 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IHubProject } from "../core";
3
+ import { IPropertyMap } from "../core/_internal/PropertyMapper";
4
+ import { IModel } from "../types";
5
+ /**
6
+ * Given a model and a project, set various computed properties that can't be directly mapped
7
+ * @private
8
+ * @param model
9
+ * @param project
10
+ * @param requestOptions
11
+ * @returns
12
+ */
13
+ export declare function computeProps(model: IModel, project: Partial<IHubProject>, requestOptions: IRequestOptions): IHubProject;
14
+ /**
15
+ * Returns an Array of IPropertyMap objects
16
+ * that define the projection of properties from a IModel to an IHubProject
17
+ * @returns
18
+ * @private
19
+ */
20
+ export declare function getPropertyMap(): IPropertyMap[];
@@ -1,9 +1,6 @@
1
1
  import { IUserRequestOptions } from "@esri/arcgis-rest-auth";
2
- import { IHubRequestOptions, EditorConfigType, UiSchemaElementOptions, IEditorConfig } from "../index";
3
- import { IItem } from "@esri/arcgis-rest-portal";
4
- import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { EditorConfigType, UiSchemaElementOptions, IEditorConfig } from "../index";
5
3
  import { IHubProject } from "../core/types";
6
- import { IHubSearchResult } from "../search";
7
4
  /**
8
5
  * @private
9
6
  * Create a new Hub Project item
@@ -21,13 +18,6 @@ export declare function createProject(partialProject: Partial<IHubProject>, requ
21
18
  * @param requestOptions
22
19
  */
23
20
  export declare function updateProject(project: IHubProject, requestOptions: IUserRequestOptions): Promise<IHubProject>;
24
- /**
25
- * @private
26
- * Get a Hub Project by id or slug
27
- * @param identifier item id or slug
28
- * @param requestOptions
29
- */
30
- export declare function fetchProject(identifier: string, requestOptions: IRequestOptions): Promise<IHubProject>;
31
21
  /**
32
22
  * @private
33
23
  * Remove a Hub Project
@@ -35,24 +25,6 @@ export declare function fetchProject(identifier: string, requestOptions: IReques
35
25
  * @param requestOptions
36
26
  */
37
27
  export declare function deleteProject(id: string, requestOptions: IUserRequestOptions): Promise<void>;
38
- /**
39
- * @private
40
- * Convert an Hub Project Item into a Hub Project, fetching any additional
41
- * information that may be required
42
- * @param item
43
- * @param auth
44
- * @returns
45
- */
46
- export declare function convertItemToProject(item: IItem, requestOptions: IRequestOptions): Promise<IHubProject>;
47
- /**
48
- * @private
49
- * Fetch project specific enrichments
50
- * @param item
51
- * @param include
52
- * @param requestOptions
53
- * @returns
54
- */
55
- export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
56
28
  /**
57
29
  * Get the editor config for for the HubProject entity.
58
30
  * @param i18nScope Translation scope to be interpolated into the schemas
@@ -0,0 +1,30 @@
1
+ import { IRequestOptions } from "@esri/arcgis-rest-request";
2
+ import { IItem } from "@esri/arcgis-rest-portal";
3
+ import { IHubProject } from "../core";
4
+ import { IHubSearchResult } from "../search";
5
+ import { IHubRequestOptions } from "../types";
6
+ /**
7
+ * @private
8
+ * Get a Hub Project by id or slug
9
+ * @param identifier item id or slug
10
+ * @param requestOptions
11
+ */
12
+ export declare function fetchProject(identifier: string, requestOptions: IRequestOptions): Promise<IHubProject>;
13
+ /**
14
+ * @private
15
+ * Convert an Hub Project Item into a Hub Project, fetching any additional
16
+ * information that may be required
17
+ * @param item
18
+ * @param auth
19
+ * @returns
20
+ */
21
+ export declare function convertItemToProject(item: IItem, requestOptions: IRequestOptions): Promise<IHubProject>;
22
+ /**
23
+ * @private
24
+ * Fetch project specific enrichments
25
+ * @param item
26
+ * @param include
27
+ * @param requestOptions
28
+ * @returns
29
+ */
30
+ export declare function enrichProjectSearchResult(item: IItem, include: string[], requestOptions: IHubRequestOptions): Promise<IHubSearchResult>;
@@ -1,2 +1,3 @@
1
- export * from "./HubProjects";
2
1
  export * from "./HubProject";
2
+ export * from "./edit";
3
+ export * from "./fetch";