Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change public role like gamma procedure #10674

Merged
merged 10 commits into from
Aug 28, 2020

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Aug 25, 2020

SUMMARY

Fixes #9807, by merging the Public role definition with pre-existing data access permissions (all other permissions not included on the template role are removed).

This PR also makes the definition of the Public role more configurable, for this PUBLIC_ROLE_LIKE_GAMMA is removed (breaking change) and a new key is introduced PUBLIC_ROLE_LIKE where a specific role can be set, like Admin, Alpha, Gamma or any other role preexisting on the DB or configured has a builtin role on the config itself.

To retain the same behaviour configure it the following way:

PUBLIC_ROLE_LIKE = "Gamma"

ADDITIONAL INFORMATION

@dpgaspar dpgaspar marked this pull request as ready for review August 26, 2020 08:30
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉 One small convenience suggestion, although I'm not sure if we should be cluttering the codebase with these deprecation warnings, as UPDATING.md should be read by everyone anyway before updating.

Comment on lines 612 to 623
if conf.get("PUBLIC_ROLE_LIKE_GAMMA", False):
self.set_role("Public", self._is_gamma_pvm)
if conf["PUBLIC_ROLE_LIKE"]:
self.copy_role(conf["PUBLIC_ROLE_LIKE"], self.auth_role_public, merge=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be super accomodating, we could do something like

if conf.get("PUBLIC_ROLE_LIKE_GAMMA", False):
    logger.warning("The config `PUBLIC_ROLE_LIKE_GAMMA` is deprecated and will be removed in Superset 1.0. Please use `PUBLIC_ROLE_LIKE ` instead.")
    self.copy_role("Gamma", self.auth_role_public, merge=True)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

@codecov-commenter
Copy link

Codecov Report

Merging #10674 into master will decrease coverage by 0.06%.
The diff coverage is 94.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10674      +/-   ##
==========================================
- Coverage   64.36%   64.30%   -0.07%     
==========================================
  Files         785      785              
  Lines       36981    37016      +35     
  Branches     3530     3530              
==========================================
  Hits        23803    23803              
- Misses      13070    13101      +31     
- Partials      108      112       +4     
Flag Coverage Δ
#cypress 54.09% <ø> (-0.73%) ⬇️
#javascript 60.91% <ø> (ø)
#python 59.87% <94.59%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/security/manager.py 91.01% <94.28%> (+0.85%) ⬆️
superset/config.py 90.38% <100.00%> (+0.03%) ⬆️
superset/connectors/sqla/models.py 89.72% <100.00%> (+0.13%) ⬆️
...et-frontend/src/SqlLab/reducers/getInitialState.js 33.33% <0.00%> (-16.67%) ⬇️
superset-frontend/src/reduxUtils.ts 70.88% <0.00%> (-8.87%) ⬇️
...rontend/src/SqlLab/components/TabbedSqlEditors.jsx 76.62% <0.00%> (-5.85%) ⬇️
superset-frontend/src/SqlLab/actions/sqlLab.js 60.25% <0.00%> (-4.28%) ⬇️
...rontend/src/SqlLab/components/SqlEditorLeftBar.jsx 44.00% <0.00%> (-4.00%) ⬇️
superset-frontend/src/SqlLab/reducers/sqlLab.js 37.75% <0.00%> (-3.32%) ⬇️
...end/src/SqlLab/components/TemplateParamsEditor.jsx 88.57% <0.00%> (-2.86%) ⬇️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b40d44...ad11aaa. Read the comment docs.

superset/config.py Outdated Show resolved Hide resolved
superset/config.py Outdated Show resolved Hide resolved
dpgaspar and others added 3 commits August 27, 2020 10:24
Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
@dpgaspar
Copy link
Member Author

Added a very simple landing page for the public/anonymous users, since rendering the login page is not correct if the Public role is "activated".
I think this is enough to establish a working workflow for the anonymous users, we can iterate on more pretty landing page on a following PR.

@dpgaspar dpgaspar merged commit 3e374da into apache:master Aug 28, 2020
@dpgaspar dpgaspar deleted the fix/public-role-like-gamma branch August 28, 2020 09:49
@dpgaspar dpgaspar added the v0.38 label Sep 9, 2020
dpgaspar added a commit to preset-io/superset that referenced this pull request Sep 10, 2020
* fix: change public role like gamma procedure

* lint and updating UPDATING with breaking change

* fix updating text

* add test and support PUBLIC_ROLE_LIKE_GAMMA

* fix, cleanup tests

* fix, new test

* fix, public default

* Update superset/config.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add simple public welcome page

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
villebro added a commit to preset-io/superset that referenced this pull request Sep 11, 2020
* fix: change public role like gamma procedure

* lint and updating UPDATING with breaking change

* fix updating text

* add test and support PUBLIC_ROLE_LIKE_GAMMA

* fix, cleanup tests

* fix, new test

* fix, public default

* Update superset/config.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add simple public welcome page

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
villebro added a commit that referenced this pull request Sep 11, 2020
* fix: change public role like gamma procedure

* lint and updating UPDATING with breaking change

* fix updating text

* add test and support PUBLIC_ROLE_LIKE_GAMMA

* fix, cleanup tests

* fix, new test

* fix, public default

* Update superset/config.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add simple public welcome page

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
Ofeknielsen pushed a commit to ofekisr/incubator-superset that referenced this pull request Oct 5, 2020
* fix: change public role like gamma procedure

* lint and updating UPDATING with breaking change

* fix updating text

* add test and support PUBLIC_ROLE_LIKE_GAMMA

* fix, cleanup tests

* fix, new test

* fix, public default

* Update superset/config.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add simple public welcome page

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* fix: change public role like gamma procedure

* lint and updating UPDATING with breaking change

* fix updating text

* add test and support PUBLIC_ROLE_LIKE_GAMMA

* fix, cleanup tests

* fix, new test

* fix, public default

* Update superset/config.py

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

* add simple public welcome page

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v0.38 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problems with Public role after updating
5 participants