# Role management

**URL:** <https://community.weweb.io/t/role-management/19008>\
**Category:** Ask us anything\
**Tags:** authentication, supabase\
**Created:** [June 29, 2025, 5:48pm UTC](https://community.weweb.io/t/role-management/19008 "2025-06-29T17:48:38Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kappa](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@kappa](https://community.weweb.io/u/kappa)\
**Post date:** [June 29, 2025, 5:48pm UTC](https://community.weweb.io/t/role-management/19008/1 "2025-06-29T17:48:38Z")

</div>

Hi everyone, I’m working with Supabase and recently added role management by creating two new tables:

roles (id UUID, name)

userRoles (id UUID→ roles.id, userId → auth.users.id, roleId → roles.id)

I linked these tables properly in Supabase. Before adding them, user login in WeWeb was working perfectly. But after adding these tables—even with RLS policies disabled—the login stops working, and authenticated users don’t show up in WeWeb.

Could adding these tables somehow interfere with the authentication flow? Is it possible that missing roles for existing users or some hidden Supabase dependency is causing this? How can I implement role management without breaking the login/auth user loading in WeWeb?

Any advice or similar experiences would be really appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![Agustin\_Carozo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/agustin_carozo/32/13231_2.png) [@Agustin\_Carozo](https://community.weweb.io/u/Agustin_Carozo)\
**Post date:** [June 30, 2025, 2:21pm UTC](https://community.weweb.io/t/role-management/19008/2 "2025-06-30T14:21:08Z")

</div>

Hi Kappa 👋

You need to activate RLS in both tables for it to work.

I went through the same issues when I tried working with roles:

> [@Supabase roles, creating a client portal](https://community.weweb.io/t/supabase-roles-creating-a-client-portal/18531):
>
> Hello everyone waving_hand I just recorded a long video going through how to create a client portal with role base visibility and blocking pages for specific roles like admin and user. Most of the work is based on the docs: [Supabase authentication | Documentation](https://docs.weweb.io/plugins/auth-systems/supabase-auth.html#user-roles-permissions) But there is a lot of troubleshooting that will be super important for those trying to attempt this. Things like: Paying attention to your RLS policies in supabase tables. when creating the new tables: roles and userRoles you can…

---

<div class="post-metadata">

**Author:** ![kappa](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@kappa](https://community.weweb.io/u/kappa)\
**Post date:** [July 1, 2025, 8:29am UTC](https://community.weweb.io/t/role-management/19008/3 "2025-07-01T08:29:10Z")

</div>

Hi Agustin!

Thanks for sharing the video! I had read the documentation before, but I hadn’t seen the video, super helpful.

I followed the steps in the video: I enabled RLS and created the policies on both tables just like in the tutorial.

Here’s the schema again for reference:

- roles (id UUID, name)

- userRoles (id UUID, userId → auth.users.id, roleId → roles.id)

I’m still running into two main issues:

For users who registered before I implemented roles, even if I manually assign a role to them, WeWeb doesn’t seem to recognize them as authenticated anymore. Logging in doesn’t help, it’s as if they no longer exist in the auth.users view from WeWeb’s perspective.

When I use the “Manage User” panel, the Users section still shows no authenticated users, even though login appears to work with newly created users. For those new users, login works fine, and the role is correctly detected in variables, but does not show in the Auth/Users panel.

Thanks again for the help so far!

---

<div class="post-metadata">

**Author:** ![Agustin\_Carozo](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/agustin_carozo/32/13231_2.png) [@Agustin\_Carozo](https://community.weweb.io/u/Agustin_Carozo)\
**Post date:** [July 1, 2025, 12:35pm UTC](https://community.weweb.io/t/role-management/19008/4 "2025-07-01T12:35:22Z")

</div>

You might need to update their role manually directly from supabase.

Can you try that and let me know if it worked?

---

<div class="post-metadata">

**Author:** ![kappa](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@kappa](https://community.weweb.io/u/kappa)\
**Post date:** [July 1, 2025, 1:27pm UTC](https://community.weweb.io/t/role-management/19008/5 "2025-07-01T13:27:37Z")

</div>

Thanks for the follow-up!

Yes, I’ve already manually assigned the roles directly from Supabase.

Here’s what I’m observing:

For new users (those created after I added the two tables), everything works as expected: the role variable is populated in WeWeb, and authenticated = true. However, they still don’t appear in the Auth → Users panel in WeWeb.

For old users (created before the new tables), even if I assign them a role manually in Supabase, the variables in WeWeb are not populated at all. It’s like WeWeb doesn’t recognize them as authenticated anymore.

So the role assignment works only partially—variables are working for new users but not showing in the user panel, and old users seem completely disconnected.

Any ideas on what could be causing this?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/1/1f2c948f7cb9f2fac7ea581535589b9248cd7d01.png) **![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/cc64615ebd0c0ce2b737c963841cc563d8ce5164.png)**

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [July 1, 2025, 1:30pm UTC](https://community.weweb.io/t/role-management/19008/6 "2025-07-01T13:30:29Z")

</div>

This sounds like the WeWeb plugin can’t find the roles, if this is not RLS, then maybe an improper mapping? Have you updated the setting in the Supabase plugin to point to your tables?

 ![Screenshot 2025-07-01 at 15.35.47](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/7369f7b211d6e7cc790b6dbd060695a582a8ae4e.png)

---

<div class="post-metadata">

**Author:** ![kappa](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@kappa](https://community.weweb.io/u/kappa)\
**Post date:** [July 1, 2025, 3:19pm UTC](https://community.weweb.io/t/role-management/19008/7 "2025-07-01T15:19:45Z")

</div>

Yes, and as you can see in the photo, with the “new” user it works — the role shows up in the variable — but not in the panel. For the “old” it goes on error but only from weweb not in supabase.

 ![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/93a411ea84b69a495b6f7ee8fd780b0d0f980fa8.png) **![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/c/c6b56c1f355ebfdaa7c47a880f4eee72d5b896c5.png)** **![](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/d/db56ce64bc699da6363c89818b0a453680b3c80d.png)**

---

<div class="post-metadata">

**Author:** ![kappa](https://avatars.discourse-cdn.com/v4/letter/k/50afbb/32.png) [@kappa](https://community.weweb.io/u/kappa)\
**Post date:** [July 23, 2025, 7:17am UTC](https://community.weweb.io/t/role-management/19008/8 "2025-07-23T07:17:07Z")

</div>

Update regarding what I mentioned earlier: by rebuilding the project in Supabase with the same tables, the roles are now working. I’m not sure why they weren’t working before—maybe some trigger or function was interfering. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/bee40a614c5b74fbef4e7bb6f73d022e2b8203e3.png) [@system](https://community.weweb.io/u/system)\
**Post date:** [July 24, 2025, 7:17am UTC](https://community.weweb.io/t/role-management/19008/9 "2025-07-24T07:17:16Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
