Skip to content

Commit

Permalink
feat: add segments to formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Thenkei committed Jun 16, 2021
1 parent befe3c7 commit fcb7c02
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/services/permissions-getter.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class PermissionsGetter {
: null;
}

_getScopePermissions(renderingId, collectionName, { environmentId } = {}) {
_getSegmentsPermissions(renderingId, collectionName, { environmentId } = {}) {
const getPermissionsInRendering = this._getPermissionsInRendering(
renderingId, { environmentId },
);
return getPermissionsInRendering
&& getPermissionsInRendering.data
&& getPermissionsInRendering.data[collectionName]
? getPermissionsInRendering.data[collectionName].scope
? getPermissionsInRendering.data[collectionName].segments
: null;
}

Expand Down Expand Up @@ -116,6 +116,7 @@ class PermissionsGetter {
exportEnabled: collection.export,
},
scope: modelPermissions.scope,
segments: modelPermissions.segments,
};

if (modelPermissions.actions) {
Expand Down Expand Up @@ -270,14 +271,14 @@ class PermissionsGetter {
const collectionPermissions = this._getCollectionPermissions(
renderingId, collectionName, { environmentId },
);
const scope = this._getScopePermissions(renderingId, collectionName, { environmentId });
const segments = this._getSegmentsPermissions(renderingId, collectionName, { environmentId });
const stats = this._getStatsPermissions({ environmentId });

return {
collection: collectionPermissions ? collectionPermissions.collection : null,
actions: collectionPermissions ? collectionPermissions.actions : null,
stats,
scope,
segments,
};
}
}
Expand Down

0 comments on commit fcb7c02

Please sign in to comment.