@restorecommerce/acs-client 3.1.1 → 3.1.2

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/config.js CHANGED
@@ -2,8 +2,59 @@ import { createServiceConfig } from '@restorecommerce/service-config';
2
2
  // Export cfg Object
3
3
  export let cfg = createServiceConfig(process.cwd());
4
4
  // errors mapped to code and message
5
- export const errors = cfg.get('errors');
5
+ export const errors = {
6
+ INVALID_CREDENTIALS: {
7
+ code: 401,
8
+ message: 'Invalid credentials'
9
+ },
10
+ USER_NOT_LOGGED_IN: {
11
+ code: 401,
12
+ message: 'User not logged in, please login first!'
13
+ },
14
+ ACTION_NOT_ALLOWED: {
15
+ code: 403,
16
+ message: 'Action not allowed on this resource'
17
+ },
18
+ SYSTEM_ERROR: {
19
+ code: 500,
20
+ message: 'System Error!'
21
+ },
22
+ };
23
+ Object.assign(errors, cfg.get('errors'));
24
+ export const urns = {
25
+ model: 'urn:restorecommerce:acs:model',
26
+ user: 'urn:restorecommerce:acs:model:user.User',
27
+ organization: "urn:restorecommerce:acs:model:organization.Organization",
28
+ entity: 'urn:restorecommerce:acs:names:model:entity',
29
+ role: 'urn:restorecommerce:acs:names:role',
30
+ roleScopingEntity: 'urn:restorecommerce:acs:names:roleScopingEntity',
31
+ roleScopingInstance: 'urn:restorecommerce:acs:names:roleScopingInstance',
32
+ hierarchicalRoleScoping: 'urn:restorecommerce:acs:names:hierarchicalRoleScoping',
33
+ unauthenticated_user: 'urn:restorecommerce:acs:names:unauthenticated-user',
34
+ property: 'urn:restorecommerce:acs:names:model:property',
35
+ ownerIndicatoryEntity: 'urn:restorecommerce:acs:names:ownerIndicatoryEntity',
36
+ ownerInstance: 'urn:restorecommerce:acs:names:ownerInstance',
37
+ subjectID: 'urn:oasis:names:tc:xacml:1.0:subject:subject-id',
38
+ resourceID: 'urn:oasis:names:tc:xacml:1.0:resource:resource-id',
39
+ actionID: 'urn:oasis:names:tc:xacml:1.0:action:action-id',
40
+ action: 'urn:restorecommerce:acs:names:action',
41
+ operation: 'urn:restorecommerce:acs:names:operation',
42
+ execute: 'urn:restorecommerce:acs:names:action:execute',
43
+ permitOverrides: 'urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-overrides',
44
+ denyOverrides: 'urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-overrides',
45
+ create: 'urn:restorecommerce:acs:names:action:create',
46
+ read: 'urn:restorecommerce:acs:names:action:read',
47
+ modify: 'urn:restorecommerce:acs:names:action:modify',
48
+ delete: 'urn:restorecommerce:acs:names:action:delete',
49
+ aclIndicatoryEntity: 'urn:restorecommerce:acs:names:aclIndicatoryEntity',
50
+ aclInstance: 'urn:restorecommerce:acs:names:aclInstance',
51
+ skipACL: 'urn:restorecommerce:acs:names:skipACL',
52
+ maskedProperty: 'urn:restorecommerce:acs:names:obligation:maskedProperty',
53
+ };
54
+ Object.assign(urns, cfg.get('authorization:urns'));
6
55
  export const updateConfig = (config) => {
7
56
  cfg = config;
57
+ Object.assign(errors, cfg.get('errors'));
58
+ Object.assign(urns, cfg.get('authorization:urns'));
8
59
  };
9
60
  //# sourceMappingURL=config.js.map
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,oBAAoB;AACpB,MAAM,CAAC,IAAI,GAAG,GAAQ,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AACzD,oCAAoC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAW,EAAE,EAAE;IAC1C,GAAG,GAAG,MAAM,CAAC;AACf,CAAC,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"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