@memberjunction/core-entities 2.18.3 → 2.19.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcePermissionSubclass.d.ts","sourceRoot":"","sources":["../../../src/custom/ResourcePermissions/ResourcePermissionSubclass.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ResourcePermissionSubclass.d.ts","sourceRoot":"","sources":["../../../src/custom/ResourcePermissions/ResourcePermissionSubclass.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,iBAAiB,EAAyC,MAAM,sBAAsB,CAAC;AAE1H,OAAO,EAAE,wBAAwB,EAAsC,MAAM,mCAAmC,CAAC;AAGjH;;GAEG;AACH,qBACa,gCAAiC,SAAQ,wBAAwB;IAC1E;;;;;;OAMG;IACY,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAmFrE"}
|
|
@@ -23,22 +23,23 @@ let ResourcePermissionEntityExtended = class ResourcePermissionEntityExtended ex
|
|
|
23
23
|
* @param options
|
|
24
24
|
*/
|
|
25
25
|
async Save(options) {
|
|
26
|
-
const
|
|
27
|
-
if (
|
|
26
|
+
const p = this.ProviderToUse;
|
|
27
|
+
if (p.ProviderType === 'Database') {
|
|
28
28
|
// operating on the server side so we can do the notification logic
|
|
29
29
|
// first check to see if we're a new record and the status is "Requested"
|
|
30
30
|
const newRequest = !this.IsSaved && this.Status === 'Requested';
|
|
31
31
|
const statusField = this.Fields.find(f => f.Name.trim().toLowerCase() === 'status');
|
|
32
32
|
const statusChangedfromRequested = this.IsSaved && statusField.Dirty && statusField.OldValue.trim().toLowerCase() === 'requested';
|
|
33
33
|
// just in case, config the engine but it probably already has been configured in which case nothing will happen
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
34
|
+
const engine = ResourcePermissionEngine_1.ResourcePermissionEngine.GetProviderInstance(p, ResourcePermissionEngine_1.ResourcePermissionEngine);
|
|
35
|
+
await engine.Config(false, this.ContextCurrentUser);
|
|
36
|
+
const rt = engine.ResourceTypes.find((rt) => rt.ID === this.ResourceTypeID);
|
|
37
|
+
const rtEntityRecord = engine.ResourceTypes.find((rt) => rt.Name.trim().toLowerCase() === "records");
|
|
37
38
|
// now get the field names for the given resource type based on its entity metadata with this helper method in the engine
|
|
38
|
-
const resourceTypeFields =
|
|
39
|
+
const resourceTypeFields = engine.GetResourceTypeInfoFields(this.ResourceTypeID);
|
|
39
40
|
if (resourceTypeFields && resourceTypeFields.NameFieldName && resourceTypeFields.OwnerIDFieldName) {
|
|
40
41
|
// grab the data from the resource record itself so we have it for the notification so it is easy for the user to read
|
|
41
|
-
const resourceRecord = await
|
|
42
|
+
const resourceRecord = await p.GetEntityObject(rt.Entity, this.ContextCurrentUser);
|
|
42
43
|
const ck = new core_1.CompositeKey([
|
|
43
44
|
{
|
|
44
45
|
FieldName: resourceTypeFields.PrimaryKeyFieldName,
|
|
@@ -54,10 +55,10 @@ let ResourcePermissionEntityExtended = class ResourcePermissionEntityExtended ex
|
|
|
54
55
|
// after we call super.Save() to actually save the record
|
|
55
56
|
if (await super.Save(options)) {
|
|
56
57
|
// now proceed with workflow logic if we saved
|
|
57
|
-
const notification = await
|
|
58
|
+
const notification = await p.GetEntityObject('User Notifications', this.ContextCurrentUser);
|
|
58
59
|
if (newRequest) {
|
|
59
60
|
// notify the owner of the resource that a new request was made
|
|
60
|
-
const user = await
|
|
61
|
+
const user = await p.GetEntityObject('Users', this.ContextCurrentUser);
|
|
61
62
|
await user.Load(this.UserID);
|
|
62
63
|
notification.Title = `New Request for Access to ${this.ResourceType}`;
|
|
63
64
|
notification.Message = `A new request for access to ${this.ResourceType} record "${recordName}" has been made by ${user.Name} (${user.Email})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourcePermissionSubclass.js","sourceRoot":"","sources":["../../../src/custom/ResourcePermissions/ResourcePermissionSubclass.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+
|
|
1
|
+
{"version":3,"file":"ResourcePermissionSubclass.js","sourceRoot":"","sources":["../../../src/custom/ResourcePermissions/ResourcePermissionSubclass.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA0H;AAC1H,mDAAuD;AACvD,yEAAiH;AACjH,yEAAsE;AAEtE;;GAEG;AAEI,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,4CAAwB;IAC1E;;;;;;OAMG;IACM,KAAK,CAAC,IAAI,CAAC,OAA2B;QAC3C,MAAM,CAAC,GAA2B,IAAI,CAAC,aAAa,CAAC;QACrD,IAAI,CAAC,CAAC,YAAY,KAAK,UAAU,EAAE,CAAC;YAChC,mEAAmE;YACnE,yEAAyE;YACzE,MAAM,UAAU,GAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC;YACjE,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA,EAAE,CAAA,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,CAAC;YAClF,MAAM,0BAA0B,GAAG,IAAI,CAAC,OAAO,IAAI,WAAW,CAAC,KAAK,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC;YAElI,iHAAiH;YACjH,MAAM,MAAM,GAA8B,mDAAwB,CAAC,mBAAmB,CAA2B,CAAC,EAAE,mDAAwB,CAAC,CAAC;YAC9I,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACpD,MAAM,EAAE,GAAG,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,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,CAAC,SAAS,CAAC;4BAChD,oBAAoB,EAAE,IAAI,CAAC,EAAE,CAAC,gGAAgG;yBACjI,CAAC,CAAC;wBACH,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;oBACrC,CAAC;yBACI,CAAC;wBACF,OAAO,IAAI,CAAC,CAAC,2FAA2F;oBAC5G,CAAC;gBACL,CAAC;qBACI,CAAC;oBACF,OAAO,KAAK,CAAC,CAAC,uCAAuC;gBACzD,CAAC;YACL,CAAC;iBACI,CAAC;gBACF,MAAM,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,+DAA+D,CAAC,CAAC;YAC7G,CAAC;QACL,CAAC;aACI,CAAC;YACF,6CAA6C;YAC7C,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;CACJ,CAAA;AA3FY,4EAAgC;2CAAhC,gCAAgC;IAD5C,IAAA,sBAAa,EAAC,iBAAU,EAAE,sBAAsB,CAAC;GACrC,gCAAgC,CA2F5C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/core-entities",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.1",
|
|
4
4
|
"description": "Entity subclasses for the metadata layer of MemberJunction defined in the MJ_CORE schema (usually 'admin'), distributed as part of each release of MemberJunction",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/core": "2.
|
|
23
|
-
"@memberjunction/global": "2.
|
|
22
|
+
"@memberjunction/core": "2.19.1",
|
|
23
|
+
"@memberjunction/global": "2.19.1",
|
|
24
24
|
"zod": "^3.23.8"
|
|
25
25
|
}
|
|
26
26
|
}
|