Skip to content

OAUTH, RLS and the case for {{ current_useremail }} #26808

Closed
@modidim2021

Description

Bug description

This is not a a bug per se, but is something missing and I don't believe it needs a SIP. Sorry if I miscalculated.

I have a superset instance with OAuth (google) authentication and I'm trying to implement RLS for the current user.

In ab_user I have the following row (I include only the relevant fields):

  {
    "id": 1,
    "username": "google_102854032914007021400",
    "email": "victor@gmail.com",
  }

In my model the table d_user has the following data (Only meaningful fields):

  {
    "user_key": 26,
    "user_id": 100026,
    "name": "Victor Diaz",
    "email": "victor@gmail.com",
  }

The templating page states that the available macros are: ** {{ current_username() }}** and {{ current_user_id() }}.

With {{ current_user_email() }}, I can apply an RLS right away instead of making ab_user part of the ingestion process to get the username.

How to reproduce the bug

  1. In superset instance that uses OAuth (google) try to add a "row level security filter" for the current_user.

d_user.email = {{ current_?? }}

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions