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

Add support for default role #2631

Merged
merged 2 commits into from Feb 6, 2022
Merged

Conversation

mithmatt
Copy link
Collaborator

@mithmatt mithmatt commented Feb 5, 2022

  • Add default field to role
  • Amend GET /roles to query default roles
  • Assign default role to new users being created

Describe your changes :

When a new user is created, the default role is assigned to the user automatically by the backend.
Default role can be queried through GET /roles API

There is one more part remaining -- to switch default role from existing one to another.

See #2460 for details

Type of change :

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Frontend Preview (Screenshots) :

For frontend related change, please link screenshots of your changes preview! Optional for backend related changes.

Checklist:

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my own.
  • I have tagged my reviewers below.
  • I have commented on my code, particularly in hard-to-understand areas.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • All new and existing tests passed.

Reviewers

Backend: @sureshms @harshach

@github-actions
Copy link

github-actions bot commented Feb 5, 2022

Schema Change Detected. Needs ingestion-core version bump

Please run make core_bump_version_dev in the project's root and commit the changes to _version.py in this PR. Please ignore if this has been handled already.

@sonarcloud
Copy link

sonarcloud bot commented Feb 5, 2022

[catalog] Please retry analysis of this Pull-Request directly on SonarCloud.

@mithmatt mithmatt force-pushed the role_query_param branch 3 times, most recently from cb153e0 to 802f5e4 Compare February 5, 2022 10:10
@sonarcloud
Copy link

sonarcloud bot commented Feb 5, 2022

[catalog] Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 12 Code Smells

79.6% 79.6% Coverage
0.0% 0.0% Duplication

@mithmatt
Copy link
Collaborator Author

mithmatt commented Feb 5, 2022

All py tests are failing - need to investigate outside of this PR

@mithmatt mithmatt changed the title Add default field to role Support default role Feb 5, 2022
@mithmatt mithmatt changed the title Support default role Add support for default role Feb 5, 2022
@mithmatt mithmatt self-assigned this Feb 5, 2022
@@ -0,0 +1,7 @@
-- Set default as false for all existing roles, to avoid unintended manipulation of roles during migration.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tested this manually with bootstrap migrate-all


@Override
public void entitySpecificUpdate() throws IOException {
recordChange("default", original.getEntity().getDefault(), updated.getEntity().getDefault());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a minor version change

create = createRequest(test, 2);
createUserAndCheckRoles(create, Arrays.asList(defaultRoleId));

// Given a default role has been set, when a user is created with a non default role, then the default role should
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"BDD given, when, then" description for different users being created for this test

@mithmatt mithmatt merged commit bfcd97e into open-metadata:main Feb 6, 2022
@mithmatt mithmatt deleted the role_query_param branch February 6, 2022 23:28
mithmatt added a commit to mithmatt/OpenMetadata that referenced this pull request Feb 7, 2022
mithmatt added a commit that referenced this pull request Feb 7, 2022
amiorin pushed a commit that referenced this pull request Feb 7, 2022
mithmatt added a commit to mithmatt/OpenMetadata that referenced this pull request Feb 19, 2022
- Add default field to role
- Amend GET /roles to query default roles
- Assign default role to new users being created
mithmatt added a commit that referenced this pull request Feb 19, 2022
- Add default field to role
- Amend GET /roles to query default roles
- Assign default role to new users being created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants