Role can't access record read detail configured

Feature(s) impacted

Roles

Observed behavior

We have created a new role with full read/write access to one specific table. When we assign that role to certain users then they can list the items in that table, but they can’t see the details of a given row.

Expected behavior

The user should be able to see the details.

Context

  • Project name: Brxs
  • Team name: Operations
  • Environment name: Production

This problem is for the role “Marketing”

Hey @timothyarmes :wave:

Could you confirm the project name?
Also, according to the multiple project I can find, I can’t spot any roles, so the project name will be valuable in order to help. Thanks :pray:

Hi,

I’ve updated my post to reflect the correct capitalisation (Brxs)

Thanks, I can now see your role configuration.

Could you also share:

  • A user name that can’t access details informations?
  • The specific collection you setup role onto?

Feel free to reach me as DM if you consider those private.

Thanks in advance :pray:

Hello @timothyarmes

I could not reproduce the bug on my end and your configuration appears to be correct.

Could you share your production agent servers logs ?

Restarting your production agent server may also help.

Thanks :pray:

Hello @timothyarmes,

As @jeffladiray mentioned, could you share with us:

  • A collection (table) name where you encounter the issue?
  • A screencast of the bug encountered?

It would help us reproducing the issue / solve your case.
Thanks!

Hi,

Sorry for the delay.

The collection is called Promocodes. In video you can see that I’m logged in using a test account (Testy Tim) which has the Marketing role. As such, I can see the collection. However, I can’t see the details when I click.

FA_Bug.tar (946.2 KB)

I’m happy to do a zoom session with a developer to demo the issue live.

P.S. Could you allow uploading of .mov and .zip files here?

Hi @timothyarmes,

Thanks a lot for your details.

Indeed, from what I can see, you should be able to see the details of this record.

Do you have any error in your browser console? In your server?
Can you see the number of records on the Promocodes list? Or is it hidden and the pagination shows 1 of 0?

Thanks.

@timothyarmes,

Also, if that’s something doable on your side, I will be interested in seeing the result of the call on your user:
In the browser console, in the tab Network, the result of call to https://app.forestadmin.com/api/users?id=[your-user-id]&include=role&projectId=[project-id], and especially the permissions associated to the current environment and the promocodes collection.

Something like this:

Hi,

It does see the correct number of records and shows page 1/1.

Here’s the console error when trying to view a record:

chunk.8.bd8e8ba….js:1 GET https://fa.brxsapp.com/forest/promocodes/7b9fc372-5b71-4b2a-bc67-26f1bc4b1c3d?timezone=Europe%2FParis 403

11:09:53.953

chunk.8.bd8e8ba….js:1 [forest] 🌳🌳🌳 Unexpected error in details view:

1. n {isAdapterError: true, stack: 'Error: Ember Data Request GET https://fa.brxsapp.c…m/assets/chunk.8.bd8e8ba96866ab6bafcd.js:1:47562)', description: undefined, fileName: undefined, lineNumber: undefined, …}

  1. description: undefined
  2. errors: Array(1)

    1. 0:

      1. detail: "Forbidden"
      2. name: "ForbiddenError"
      3. status: 403
      4. [[Prototype]]: Object

    2. length: 1
    3. []: (...)
    4. firstObject: (...)
    5. hasArrayObservers: (...)
    6. lastObject: (...)
    7. [[Prototype]]: Array(0)

  3. fileName: undefined
  4. isAdapterError: true
  5. lineNumber: undefined
  6. message: "Ember Data Request GET https://fa.brxsapp.com/forest/promocodes/7b9fc372-5b71-4b2a-bc67-26f1bc4b1c3d returned a 403\nPayload (application/json; charset=utf-8)\n[object Object]"
  7. name: "Error"
  8. number: undefined
  9. stack: "Error: Ember Data Request GET https://fa.brxsapp.com/forest/promocodes/7b9fc372-5b71-4b2a-bc67-26f1bc4b1c3d returned a 403\nPayload (application/json; charset=utf-8)\n[object Object]\n at n.i (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:229581)\n at new n (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:230339)\n at b.handleResponse (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:236678)\n at b.handleResponse (https://app.forestadmin.com/assets/client-8de26bba69d386698806f1b376c72e0f.js:1:3928609)\n at x (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:241065)\n at https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:237743\n at b.s.Promise.u.error (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:158:237754)\n at l (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:48:24786)\n at Object.fireWith [as rejectWith] (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:48:25534)\n at k (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:48:76509)\n at XMLHttpRequest.<anonymous> (https://app.forestadmin.com/assets/vendor-5ed7990a316446b58c5ac6ae987f51ea.js:48:78952)\n at XMLHttpRequest.r (https://app.forestadmin.com/assets/chunk.8.bd8e8ba96866ab6bafcd.js:1:47562)"
  10. [[Prototype]]: Error

    1. code: "ForbiddenError"

Here’s the requested result of the GET:

{"included":[{"type":"roles","id":"3467","attributes":{"name":"Marketing","created_at":"2022-01-10T14:19:02.313Z","permissions":{"environments":[{"enabled":true,"collections":[{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[{"triggerEnabled":false,"smartActionName":"Upload Property Photo(s)","approvalRequired":false,"selfApprovalEnabled":false,"userApprovalEnabled":false}],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"properties"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"transactions"},{"addEnabled":true,"editEnabled":true,"readEnabled":true,"smartActions":[],"browseEnabled":true,"deleteEnabled":true,"exportEnabled":true,"collectionName":"promocodes"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[{"triggerEnabled":false,"smartActionName":"Import pre-signup users","approvalRequired":false,"selfApprovalEnabled":false,"userApprovalEnabled":false}],"browseEnabled":true,"deleteEnabled":false,"exportEnabled":false,"collectionName":"preSignupUsers"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"users"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":true,"deleteEnabled":false,"exportEnabled":false,"collectionName":"credits"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"property_stats"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"propertyNeighbourhoods"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"neighbourhoods"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"neighbourhoodPriceHistory"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"photos"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"migrations"}],"environmentId":84105},{"enabled":false,"collections":[{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[{"triggerEnabled":false,"smartActionName":"Delete User","approvalRequired":false,"selfApprovalEnabled":false,"userApprovalEnabled":false}],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"users"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[{"triggerEnabled":false,"smartActionName":"Upload Property Photo(s)","approvalRequired":false,"selfApprovalEnabled":false,"userApprovalEnabled":false}],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"properties"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"transactions"},{"addEnabled":true,"editEnabled":true,"readEnabled":true,"smartActions":[],"browseEnabled":true,"deleteEnabled":true,"exportEnabled":true,"collectionName":"promocodes"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[{"triggerEnabled":false,"smartActionName":"Import pre-signup users","approvalRequired":false,"selfApprovalEnabled":false,"userApprovalEnabled":false}],"browseEnabled":true,"deleteEnabled":false,"exportEnabled":false,"collectionName":"preSignupUsers"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":true,"deleteEnabled":false,"exportEnabled":false,"collectionName":"credits"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"property_stats"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"propertyNeighbourhoods"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"neighbourhoods"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"neighbourhoodPriceHistory"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"photos"},{"addEnabled":false,"editEnabled":false,"readEnabled":false,"smartActions":[],"browseEnabled":false,"deleteEnabled":false,"exportEnabled":false,"collectionName":"migrations"}],"environmentId":84113}]}}}],"data":{"type":"users","id":"64508","attributes":{"first_name":"Testy","last_name":"Tim","username":"testytim","email":"<snip>@gmail.com","permission_level":"editor","permissions":["createApproval","listApprovals","countApprovals","exportApprovals","createActivityLog","listActivityLog","getBilling","listColumnForCollection","listColumnForSegment","listCollectionCustomActions","getCustomAction","listEnvironments","getEnvironment","getGuest","updateGuest","getLayout","updateLayout","listMessage","createMessage","updateMessage","removeMessage","listUserNotes","listUsersMentions","listCollectionNotes","createNote","updateNote","removeNote","resetPassword","listProjects","getProject","createProject","getProjectDevelopmentEnvironments","listEnvironmentRenderings","listTeamRenderings","getRendering","listRole","getTeamFromUser","listProjectUsers","listMentionables","listTeamUsers","listViews","getView","uploadView","listWidgets","getLayoutChangesCount","checkProjectExistence","getQuickTour","updateQuickTour","checkReviewExistance"],"created_at":"2022-01-31T14:51:46.999Z","tags":[],"two_factor_authentication_active":false,"has_password":true,"is_sso_account_only":false,"is_blocked":false},"relationships":{"role":{"data":{"type":"roles","id":"3467"}},"projects":{"data":[{"type":"projects","id":"74899"}]},"teams":{"links":{"related":"/api/users/64508/teams"}}}}}

Thanks @timothyarmes! :pray:

Ok, so the browser is receiving the correct permissions.
However, it seems like your forest agent is returning a 403 when being ask the record details :thinking:

Can you see any error log on your forest agent when trying to access this record?
Did you override this GET route of one promocode?
Can you check that you have the permissionMiddleware.details() as a middleware of the route?
If you didn’t touch it, it should look like something like this:

Hi,

It’s suddenly started working. Did you change something?

Hi @timothyarmes,

No we didn’t change anything :thinking: That’s strange.

Did you, on your agent? Or maybe just restarted it?

So, looking at the logs I saw a Forbidden access to a completely different collection. As a test, I allowed access to that collection and tried again, and I could then access the promocodes collection as expected.

I then removed the access to the irrelevant collection, but I found that I still had access to the promo code collection! Hence I though that maybe you had changed something else.

I’m waiting to see if the other users now have access…

@timothyarmes ok strange :thinking:

Let me know if everything is working as expected now.

Hi,

Well, the other accounts with this role still can’t access the details page! This is all really strange.

Ok, so with the other accounts you can see some 403 logs in your agent?
Do they contain any details?

Hello @timothyarmes,

Any news of this topic? :roll_eyes:

Thanks!