Skip to content
Permalink
Browse files

Added access property to entries for v3+ api

no-issue

This is done at the theme layer so that we do not introduce new concepts
to the api which may go away very quickly due to the beta status of
members.
  • Loading branch information
allouis committed Oct 15, 2019
1 parent fb07239 commit d6b0db39c0dd3c4b54883b776cb6d3ba206f4cc2
@@ -83,6 +83,11 @@ module.exports = function entryController(req, res, next) {
}));
}

// CASE: Add access property to entry for v3+ api
if (res.locals.apiVersion !== 'v0.1' && res.locals.apiVersion !== 'v2') {
entry.access = !!entry.html;

This comment has been minimized.

Copy link
@gargol

gargol Feb 11, 2020

Member

@allouis this comparison could probably be improved with check for visibility property available on entry object? Asking because this came out recently - #11574

This comment has been minimized.

Copy link
@allouis

allouis Feb 11, 2020

Author Contributor

TBH I think the access should come from the API. Because it's not just based on visibility it's based on the member/user that is requesting the resource too

This comment has been minimized.

Copy link
@gargol

gargol Feb 11, 2020

Member

Good point. At the moment it also creates a little inconsistency with the content API where we can use the {{access}} helper on any post as if it was it's property, but the it is not available as a part of API resource 🤔

This comment has been minimized.

Copy link
@allouis

allouis Feb 11, 2020

Author Contributor

Yeah exactly! I think we can add a ticket for that and do it as part of cleanup or something? Might wanna check with Hannah about it?

This comment has been minimized.

Copy link
@gargol

gargol Feb 11, 2020

Member

I'll put in a ticket on the board and we can prioritize/deal with it as usual

}

helpers.secure(req, entry);

const renderer = helpers.renderEntry(req, res);
@@ -48,7 +48,8 @@ describe('Unit - services/routing/controllers/entry', function () {
resourceType: 'posts'
},
render: sinon.spy(),
redirect: sinon.spy()
redirect: sinon.spy(),
locals: {}
};
});

0 comments on commit d6b0db3

Please sign in to comment.
You can’t perform that action at this time.