@sitevision/api 2024.9.2 → 2024.10.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.
- package/package.json +2 -2
- package/server/NodeTypeUtil/index.d.ts +18 -0
- package/server/SystemUserUtil/index.d.ts +49 -1
- package/server/SystemUserUtil/index.js +1 -0
- package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.d.ts +14 -0
- package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitevision/api",
|
|
3
|
-
"version": "2024.
|
|
3
|
+
"version": "2024.10.1",
|
|
4
4
|
"author": "Sitevision AB",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"access": "public",
|
|
31
31
|
"directory": "dist"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "b6fdc8a76630adf0ac7bc20efce1a39bf3dacd4c"
|
|
34
34
|
}
|
|
@@ -1248,6 +1248,18 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
|
|
|
1248
1248
|
*/
|
|
1249
1249
|
METADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE: "sv:metadataMultipleTargetAudienceDefinition";
|
|
1250
1250
|
|
|
1251
|
+
/**
|
|
1252
|
+
* The primary node type name for the geolocation type
|
|
1253
|
+
* @since Sitevision 2024.10.1
|
|
1254
|
+
*/
|
|
1255
|
+
GEOLOCATION_TYPE: "sv:geolocation";
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* The primary node type name for the metadata geolocation definition type
|
|
1259
|
+
* @since Sitevision 2024.10.1
|
|
1260
|
+
*/
|
|
1261
|
+
METADATA_GEOLOCATION_DEFINITION_TYPE: "sv:metadataGeolocationDefinition";
|
|
1262
|
+
|
|
1251
1263
|
/**
|
|
1252
1264
|
* Checks if a node is a layout.
|
|
1253
1265
|
* @param aNode the node to be checked
|
|
@@ -1351,6 +1363,11 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
|
|
|
1351
1363
|
* <li>The <em>Extractor</em> user (i.e. default "Web archive" user)</li>
|
|
1352
1364
|
* <li>The <em>Anonymized</em> user (i.e. an anonymized user)</li>
|
|
1353
1365
|
* </ul>
|
|
1366
|
+
*
|
|
1367
|
+
* <p>
|
|
1368
|
+
* <em>Tip!</em> Use the {@link senselogic.sitevision.api.user.SystemUserUtil SystemUserUtil} utility to check
|
|
1369
|
+
* if a user is a specific build-in system user.
|
|
1370
|
+
* </p>
|
|
1354
1371
|
* @param aNode the node to be checked
|
|
1355
1372
|
* @return whether aNode is a {@link #SYSTEM_USER_TYPE sv:systemUser} or not.
|
|
1356
1373
|
* @see #isAnyUserType(Node)
|
|
@@ -1607,6 +1624,7 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
|
|
|
1607
1624
|
* <li>{@link #METADATA_SYSTEM_TEXT_DEFINITION_TYPE sv:metadataSystemTextDefinition}</li>
|
|
1608
1625
|
* <li>{@link #METADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE sv:metadataSingleTargetAudienceDefinition}</li>
|
|
1609
1626
|
* <li>{@link #METADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE sv:metadataMultipleTargetAudienceDefinition}</li>
|
|
1627
|
+
* <li>{@link #METADATA_GEOLOCATION_DEFINITION_TYPE sv:metadataGeolocationDefinition}</li>
|
|
1610
1628
|
* </ul>
|
|
1611
1629
|
* @param aNode the node to be checked
|
|
1612
1630
|
* @return whether aNode is a "metadata definition node" or not.
|
|
@@ -5,7 +5,7 @@ import type { Node } from "../../types/javax/jcr/Node";
|
|
|
5
5
|
*
|
|
6
6
|
* <p>
|
|
7
7
|
* This interface handles nodes with primary node type <code>sv:systemUser</code>, i.e. the
|
|
8
|
-
* <em>Anonymous</em>, <em>System</em>, <em>Indexer</em> and <em>Extractor</em> user.
|
|
8
|
+
* <em>Anonymous</em>, <em>System</em>, <em>Indexer</em>, <em>Validator</em> and <em>Extractor</em> user.
|
|
9
9
|
* </p>
|
|
10
10
|
*
|
|
11
11
|
* <p>
|
|
@@ -17,6 +17,54 @@ import type { Node } from "../../types/javax/jcr/Node";
|
|
|
17
17
|
* @since Sitevision 3.6
|
|
18
18
|
*/
|
|
19
19
|
export interface SystemUserUtil {
|
|
20
|
+
/**
|
|
21
|
+
* Checks if current user is any system user (Anonymous, System, Indexer, Validator, Extractor).
|
|
22
|
+
*
|
|
23
|
+
* <p>
|
|
24
|
+
* This is a convenience method that is <strong>much more efficient</strong> than checking for each system user type instance separately.
|
|
25
|
+
* </p>
|
|
26
|
+
* <p>
|
|
27
|
+
* Javascript code that uses <code>SystemUserUtil</code> like this:
|
|
28
|
+
* </p><pre><code>const isLoggedInHuman = () => {
|
|
29
|
+
* return (
|
|
30
|
+
* !systemUserUtil.isAnonymous() &&
|
|
31
|
+
* !systemUserUtil.isSystem() &&
|
|
32
|
+
* !systemUserUtil.isIndexer() &&
|
|
33
|
+
* !systemUserUtil.isValidator() &&
|
|
34
|
+
* !systemUserUtil.isExtractor()
|
|
35
|
+
* );
|
|
36
|
+
* };</code></pre><p>
|
|
37
|
+
* Should be replaced with code that uses this method instead:
|
|
38
|
+
* </p><pre><code>const isLoggedInHuman = () => {
|
|
39
|
+
* return !systemUserUtil.isAnySystemUser();
|
|
40
|
+
* };</code></pre>
|
|
41
|
+
*
|
|
42
|
+
* <p>
|
|
43
|
+
* <em>Note! This method does NOT produce a reliable result if called during the authentication process
|
|
44
|
+
* (i.e. from a JAAS filter or JAAS module) since it relies on a fully loaded current user (as of
|
|
45
|
+
* {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentUser()}).</em>
|
|
46
|
+
* </p>
|
|
47
|
+
* @return returns true if the current user is any system user (Anonymous, System, Indexer, Validator, Extractor), false otherwise
|
|
48
|
+
* @see #isAnySystemUser(Node)
|
|
49
|
+
* @since Sitevision 2024.10.1
|
|
50
|
+
*/
|
|
51
|
+
isAnySystemUser(): boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Checks if a user node is any system user (Anonymous, System, Validator, Indexer, Extractor).
|
|
55
|
+
*
|
|
56
|
+
* <p>
|
|
57
|
+
* This is a convenience method that checks if a given user node is any system user
|
|
58
|
+
* (Anonymous, System, Validator, Indexer, Extractor). Note that method is equivalent to checking the node <em>type</em>
|
|
59
|
+
* via {@link senselogic.sitevision.api.node.NodeTypeUtil#isSystemUser(Node) NodeTypeUtil.isSystemUser(aUserNode)}.
|
|
60
|
+
* </p>
|
|
61
|
+
* @param aUserNode a user node
|
|
62
|
+
* @return returns true if aUserNode is any system user (Anonymous, System, Validator, Indexer, Extractor), false otherwise
|
|
63
|
+
* @see senselogic.sitevision.api.node.NodeTypeUtil#isSystemUser(Node)
|
|
64
|
+
* @since Sitevision 2024.10.1
|
|
65
|
+
*/
|
|
66
|
+
isAnySystemUser(aUserNode: Node): boolean;
|
|
67
|
+
|
|
20
68
|
/**
|
|
21
69
|
* Checks if current user is anonymous (not authenticated).
|
|
22
70
|
*
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _default = exports["default"] = {
|
|
8
|
+
isAnySystemUser: function isAnySystemUser() {},
|
|
8
9
|
isAnonymous: function isAnonymous() {},
|
|
9
10
|
isSystem: function isSystem() {},
|
|
10
11
|
isIndexer: function isIndexer() {},
|
|
@@ -1387,4 +1387,18 @@ export type NodeTypeUtilConstants = {
|
|
|
1387
1387
|
* @since SiteVision 2024.09.2
|
|
1388
1388
|
*/
|
|
1389
1389
|
getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE(): string;
|
|
1390
|
+
|
|
1391
|
+
/**
|
|
1392
|
+
* Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#GEOLOCATION_TYPE}.
|
|
1393
|
+
* @return {@link senselogic.sitevision.api.node.NodeTypeUtil#GEOLOCATION_TYPE}
|
|
1394
|
+
* @since SiteVision 2024.10.1
|
|
1395
|
+
*/
|
|
1396
|
+
getGEOLOCATION_TYPE(): string;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_GEOLOCATION_DEFINITION_TYPE}.
|
|
1400
|
+
* @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_GEOLOCATION_DEFINITION_TYPE}
|
|
1401
|
+
* @since SiteVision 2024.10.1
|
|
1402
|
+
*/
|
|
1403
|
+
getMETADATA_GEOLOCATION_DEFINITION_TYPE(): string;
|
|
1390
1404
|
};
|
|
@@ -205,5 +205,7 @@ var _default = exports["default"] = {
|
|
|
205
205
|
getTARGET_AUDIENCE_TYPE: function getTARGET_AUDIENCE_TYPE() {},
|
|
206
206
|
getTARGET_AUDIENCE_GROUP_TYPE: function getTARGET_AUDIENCE_GROUP_TYPE() {},
|
|
207
207
|
getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_SINGLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
|
|
208
|
-
getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE() {}
|
|
208
|
+
getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE: function getMETADATA_MULTIPLE_TARGET_AUDIENCE_DEFINITION_TYPE() {},
|
|
209
|
+
getGEOLOCATION_TYPE: function getGEOLOCATION_TYPE() {},
|
|
210
|
+
getMETADATA_GEOLOCATION_DEFINITION_TYPE: function getMETADATA_GEOLOCATION_DEFINITION_TYPE() {}
|
|
209
211
|
};
|