Skip to content

Disable private tenant for read only users#844

Closed
giocollina wants to merge 2 commits intoopensearch-project:mainfrom
giocollina:812-disable-private-for-readonly
Closed

Disable private tenant for read only users#844
giocollina wants to merge 2 commits intoopensearch-project:mainfrom
giocollina:812-disable-private-for-readonly

Conversation

@giocollina
Copy link

Signed-off-by: David Bennett david.bennett@eliatra.com

opensearch-project/security-dashboards-plugin pull request intake form

  1. Category: (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)

Bug fix

  1. Github Issue # or road-map entry, if available:

#812

  1. Description of changes:

If a user has a role that is configured as "read only" in opensearch_dashboards.yml, or if a user has the default read only role "kibana_read_only", make Dashboards behave as if the private tenant is disabled. You cannot choose "Private" in the tenant switch panel anymore, and a descriptive text is displayed in the tenant switch panel.

  1. Why these changes are required?

If a user has a read only role, offering the possibility to use the private tenant does not make much sense. The read only role implies that only read operations are allowed. Since no one other as the current user is able to access the private tenant, but due to read only the current user is also not allowed to make any changes, selecting the private tenant in this situation is useless.

  1. What is the old behavior before changes and new behavior after changes? (Please add any example/logs/screen-shot if available)

If a user has a read only role, the tenant switch panel would still allow to choose the private tenant.

  1. Testing done: (Please provide details of testing done: Unit testing, integration testing and manual testing)

Added additional tests to password-reset-panel.test.tsx. Manual testing for different combinations of roles and read only roles.

  1. TO-DOs, if any: (Please describe pending items and provide Github issues# for each of them)

None.

  1. Is it backport from main branch? (If yes, please add backport PR # and commits #)

No.

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: David Bennett <david.bennett@eliatra.com>
Signed-off-by: David Bennett <david.bennett@eliatra.com>
@codecov-commenter
Copy link

Codecov Report

Merging #844 (cc4cb61) into main (c71a46c) will increase coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #844      +/-   ##
==========================================
+ Coverage   71.98%   72.10%   +0.11%     
==========================================
  Files          87       87              
  Lines        1906     1914       +8     
  Branches      242      249       +7     
==========================================
+ Hits         1372     1380       +8     
  Misses        480      480              
  Partials       54       54              
Impacted Files Coverage Δ
...rds-plugin/public/apps/configuration/constants.tsx 85.71% <0.00%> (ø)
...plugin/public/apps/account/tenant-switch-panel.tsx 91.11% <0.00%> (+0.86%) ⬆️

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 c71a46c...cc4cb61. Read the comment docs.

@hsiang9431-amzn
Copy link
Contributor

hsiang9431-amzn commented Nov 15, 2021

Tested on local cluster and the fix is working

However, we can only merge this after following tasks are done:

Note that you will need to add signoff message to all commits as following:

Signed-off-by: [Name] <[email]>

Check the message on this commit for reference: a48786e

const isGlobalEnabled = props.config.multitenancy.tenants.enable_global;
const isPrivateEnabled = props.config.multitenancy.tenants.enable_private;

const DEFAULT_READONLY_ROLES = ['kibana_read_only'];

Choose a reason for hiding this comment

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

Is this the right scope for this constant?

config: SecurityPluginConfigType,
cookie: SecuritySessionCookie
): string | undefined {
const DEFAULT_READONLY_ROLES = ['kibana_read_only'];

Choose a reason for hiding this comment

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

here is the same constant defined again. is there a common scope for this constant that could be referenced in these two files?

@davidlago
Copy link

Closing in favor of #868

@davidlago davidlago closed this Feb 12, 2022
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.

4 participants