Closed suresh-kumara-gist closed 3 months ago
right now admin current permission 'view-content-permission-xyz' is '0'. I want to update it to 1 to verify that admin can access xyz folder. Getting error at below code.
const u = await app.c('authentication').user('admin');
// Updating permission for Admin user to access xyz.
app.c('authentication').userFieldValue(u, 'view-content-permission-xyz', '1');
ReferenceError: app is not defined
at Context.
I think these tests referring to main database, If run test script that is going to update the permission of a admin in main database. we need to look into this as well.
I have created the restricted by permissions folders, restricted by permissions module and loading it in versioned.yml.
As a anonymous user I am accessing restricted folder files
http://0.0.0.0:8428/private/restricted-by-permission/permission-xyz2/access/index.html http://0.0.0.0:8428/private/restricted-by-permission/permission-xyz/access/index.html
http://0.0.0.0:8428/private/restricted-by-permission/permission-xyz/access/styles.css
http://0.0.0.0:8428/private/restricted-by-permission/permission-xyz2/access/styles.css
I am getting response from no-access/index.html .
After that I have added permission to admin to view content xyz
await app.c('authentication').addNonUniqueFieldToUser('admin', 'permissions', {'view-content-xyz': 1});
then I have logged in as a admin and try to access above urls still I am getting content from no-access/index.html .
I have gone through logs ./scripts/log.sh .
I am getting req.user.permissions as undefined. I have to solve this issue now.