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 #3067: Service Creation should only be done by Bots or admins and Update only by the owners #3068

Merged
merged 2 commits into from Mar 3, 2022

Conversation

harshach
Copy link
Collaborator

@harshach harshach commented Mar 2, 2022

Describe your changes :

See #3067

Type of change :

  • Bug fix

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

@sonarcloud
Copy link

sonarcloud bot commented Mar 2, 2022

[open-metadata-ingestion] 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 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@mithmatt
Copy link
Collaborator

mithmatt commented Mar 2, 2022

@harshach

Need to update test error message assertions

2022-03-02T07:54:21.1641509Z [INFO] Results:
2022-03-02T07:54:21.1642110Z [INFO] 
2022-03-02T07:54:21.1642377Z [ERROR] Failures: 
2022-03-02T07:54:21.1645041Z [ERROR]   DashboardServiceResourceTest>EntityResourceTest.put_entityUpdate_as_non_owner_4xx:924 expected: <Principal: CatalogPrincipal{name='test'} does not have permissions> but was: <Principal: CatalogPrincipal{name='test'} is not admin>
2022-03-02T07:54:21.1655072Z [ERROR]   DatabaseServiceResourceTest>EntityResourceTest.put_entityUpdate_as_non_owner_4xx:924 expected: <Principal: CatalogPrincipal{name='test'} does not have permissions> but was: <Principal: CatalogPrincipal{name='test'} is not admin>
2022-03-02T07:54:21.1656406Z [ERROR]   MessagingServiceResourceTest>EntityResourceTest.put_entityUpdate_as_non_owner_4xx:924 expected: <Principal: CatalogPrincipal{name='test'} does not have permissions> but was: <Principal: CatalogPrincipal{name='test'} is not admin>
2022-03-02T07:54:21.1657559Z [ERROR]   PipelineServiceResourceTest>EntityResourceTest.put_entityUpdate_as_non_owner_4xx:924 expected: <Principal: CatalogPrincipal{name='test'} does not have permissions> but was: <Principal: CatalogPrincipal{name='test'} is not admin>
2022-03-02T07:54:21.1658175Z [ERROR] Errors: 
2022-03-02T07:54:21.1683647Z [ERROR]   DashboardServiceResourceTest>EntityResourceTest.put_entityCreate_as_owner_200:865->EntityResourceTest.updateAndCheckEntity:1467->EntityResourceTest.updateEntity:1366 » HttpResponse
2022-03-02T07:54:21.1684810Z [ERROR]   DatabaseServiceResourceTest>EntityResourceTest.put_entityCreate_as_owner_200:865->EntityResourceTest.updateAndCheckEntity:1467->EntityResourceTest.updateEntity:1366 » HttpResponse
2022-03-02T07:54:21.1685802Z [ERROR]   MessagingServiceResourceTest>EntityResourceTest.put_entityCreate_as_owner_200:865->EntityResourceTest.updateAndCheckEntity:1467->EntityResourceTest.updateEntity:1366 » HttpResponse
2022-03-02T07:54:21.1686770Z [ERROR]   PipelineServiceResourceTest>EntityResourceTest.put_entityCreate_as_owner_200:865->EntityResourceTest.updateAndCheckEntity:1467->EntityResourceTest.updateEntity:1366 » HttpResponse
2022-03-02T07:54:21.1687241Z [INFO] 
2022-03-02T07:54:21.1687480Z [ERROR] Tests run: 919, Failures: 4, Errors: 4, Skipped: 0
2022-03-02T07:54:21.1687699Z [INFO] 
2022-03-02T07:54:21.1759250Z [INFO] ------------------------------------------------------------------------

@harshach harshach changed the title Fix #3067: Service Creation/Update should only be done by Bots or admins Fix #3067: Service Creation should only be done by Bots or admins and Update only by the owners Mar 3, 2022
@harshach
Copy link
Collaborator Author

harshach commented Mar 3, 2022

Updated the code to add another method in Authorizer interface

  1. isOwner, returns false if the owner is not found
  2. We want the services to be created by admin or bots only but admin can assign owners
  3. Owners should be able to update etc..
  4. currently in other entities such as tables, topics etc.. we allow users to update the table details and take ownership if no owner is set.
  5. However services have clear ownership and should only be created by admins and if there is no owner is assigned services must be managed by admin / bot only.

@harshach harshach merged commit e4e11a7 into main Mar 3, 2022
@harshach harshach deleted the issue-3067 branch March 3, 2022 05:20
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

3 participants