Hide Tables based on user team

I have a project that will be used by both admins and users. Is it possible to hide tables bases on a user’s role/team?

I have several tables: Orders, Collections, Admins, Users, Buyers, etc…
I have two types of users: Admins and Users

In the scenario below:
User1 is a part of the admin group/team
User2 is a part of the user group/team

When User1 signs in to the system, she should be able to see all of the tables.
When User2 signs in to the system, I only want him to see the Orders table.

I know I can restrict user access to the routes with the lines below:

if (request.user.team != "Admin") {
  response.status(403).send('Sorry, this section is not viewable yet!') 
  return;
}

As my database grows, users will see continue to see tables they don’t have access too. I think it would be best if we could only display tables they have permissions to access.

Hi @james-janetech :wave:

That’s exactly the purpose of our team feature!

  1. Create Team1 and Team2 in your project settings.

  2. Assign User1 to Team1 and User2 to Team2 (you can assign users to teams in your project settings).

  3. Using the layout editor, show/hide tables on each team. Ex: Show only Orders on Team1. Show only Admins, Users, Buyers on Team2.

That’s it!

When User1 will log in, he/she will see only the Orders table.

:bulb: Only admin and editor roles can have access to the layout editor. See how to manage roles.

Hope this helps

2 Likes

Thanks, this is exactly what I was looking for.

I received an email; however, I’m getting the following error message when viewing my console.

Hi @james-janetech, when do you receive this error message exactly?

I get this error message once I click on the invite link that was sent to my email address.

@james-janetech have you added yourself to a team or another team member?

I added myself but with a different email address.

Hey @james-janetech,

I’ll try to reproduce :wink:

I cannot reproduce. Are you inviting someone that already has an account on forestadmin or a new one ?
Could you share a video reproducing the issue :thinking:?

Sure, I’ll create a video.

422-user-invite.gz (2.0 MB)

The site would not allow me to upload the video without compressing it.

Hmm, the content does not have extension :thinking:. You could use Loom it would be simpler :sweat_smile:

1 Like

Must have gotten lost with the compression. it’s .mp4 file.

422-user-invite.mp4.gz (2.0 MB)

Thank you for your feedback @james-janetech :pray: . I cannot reproduce this issue, however, I guess it could be something with browser configuration: Forest Admin API code for invitations relies partially on some request headers.

Could you try with another browser (chrome up-to-date, without extension)?

I don’t have chrome but I’ll see if it works with safari.

Okay, it was browser related. It works just fine with safari.

Thanks

1 Like

@james-janetech I’m glad it resolved your issue. However it seems there is a problem on our side :sweat_smile:, since it should have worked. I opened an issue on our bug tracker.

Note for future readers: This issue could be related: Invitation and Google Login issue