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] test to check various user group access #1034

Merged
merged 3 commits into from
Nov 24, 2023

Conversation

jstourac
Copy link
Member

@jstourac jstourac commented Nov 21, 2023

The existing test checks that users from different groups have different
access and that this access can be setup via RHOAI User settings.

What this test does:

  • creates a custom-admins-group with TEST_USER2 user
  • creates a custom-users-group with TEST_USER3 user
  • configures first group as admins in RHOAI User settings
  • configures second group as users in RHOAI User settings

Once this was applied it tried to perform operations with three
different users:

  • TEST_USER - expected no privileges and simple Access permissions needed page presented
  • TEST_USER2 - all privileges
  • TEST_USER3 - no Administration page shown

Problem in this approach is that the TEST_USER is part of the
dedicated-admins group, which has a cluster-admin role in our
default cluster settings. Per this [1], such user is an admin by
default.

So my changes incorporates usage of the TEST_USER4 instead of
TEST_USER.

Also, unnecessary check for the product version is removed with this
commit.

[1] https://access.redhat.com/documentation/en-us/red_hat_openshift_data_science/1/html-single/managing_users_and_user_resources/index#defining-openshift-data-science-admin-and-user-groups_user-mgmt

By default, users with cluster admin permissions and users in the
dedicated-admins administrator group are OpenShift Data Science
administrators, but all users authenticated in OpenShift can access
OpenShift Data Science. A cluster admin is a superuser that can perform
any action in any project in the OpenShift cluster.

CI: rhods-ci-pr-test/2159

@jstourac jstourac added the enhancements Bugfixes, enhancements, refactoring, ... in tests or libraries (PR will be listed in release-notes) label Nov 21, 2023
@jstourac jstourac self-assigned this Nov 21, 2023
Copy link
Contributor

github-actions bot commented Nov 21, 2023

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
372 0 0 372 100

@jstourac jstourac marked this pull request as ready for review November 22, 2023 07:31
@jstourac jstourac requested review from lugi0 and bdattoma November 22, 2023 07:31
@jstourac jstourac added the verified This PR has been tested with Jenkins label Nov 22, 2023
diegolovison
diegolovison previously approved these changes Nov 22, 2023
@bdattoma
Copy link
Contributor

@jstourac

htpasswd-cluster-admin - expected no privileges and simple Access permissions needed page presented

I think this is not correct, because the test uses TEST_USER who is not htpasswd-cluster-admin

@jstourac
Copy link
Member Author

@jstourac

htpasswd-cluster-admin - expected no privileges and simple Access permissions needed page presented

I think this is not correct, because the test uses TEST_USER who is not htpasswd-cluster-admin

Uf, you're right, Berto; good catch:

TEST_USER:
  AUTH_TYPE: ldap-provider-qe
  USERNAME: ldap-admin1

I have it modified in my local properties settings, damn.

Anyway, I've checked the cluster config for the ldap-admin1 and the situation is same - it is part of the dedicated-admins group, which has a role of cluster-admin assigned. I'll update the description.

Not sure for how long this test been failing in which release this got changed.

@jstourac jstourac force-pushed the fixJupyterUserAccess branch from d2d225a to 1f69adf Compare November 22, 2023 13:06
@bdattoma
Copy link
Contributor

bdattoma commented Nov 22, 2023

@jstourac

htpasswd-cluster-admin - expected no privileges and simple Access permissions needed page presented

I think this is not correct, because the test uses TEST_USER who is not htpasswd-cluster-admin

Uf, you're right, Berto; good catch:

TEST_USER:
  AUTH_TYPE: ldap-provider-qe
  USERNAME: ldap-admin1

I have it modified in my local properties settings, damn.

Anyway, I've checked the cluster config for the ldap-admin1 and the situation is same - it is part of the dedicated-admins group, which has a role of cluster-admin assigned. I'll update the description.

Not sure for how long this test been failing in which release this got changed.

yeah, this is actually an environement issue rather than test issue, because the script our CI uses to create IDPs assignes wrong permissions to some users. We should fix it there, I haven't done it yet because I was working on a new script for IDPs (which is completed and used by interop team).

In the meantime I'm okay with fixing the test. You can have a look at how it's been done in ods_ci/tests/Tests/400__ods_dashboard/415__ods_dashboard_projects/415__ods_dashboard_projects_permissions_mgmt.robot where there is a test setup which ensure the users have the right permissions: Set User Groups For Testing kw.

@jstourac jstourac force-pushed the fixJupyterUserAccess branch from 1f69adf to a55aad4 Compare November 22, 2023 13:54
@jstourac jstourac requested a review from bdattoma November 23, 2023 09:59
The existing test checks that users from different groups have different
access and that this access can be setup via RHOAI User settings.

What this test does:

* creates a `custom-admins-group` with `TEST_USER2` user
* creates a `custom-users-group` with `TEST_USER3` user
* configures first group as admins in RHOAI User settings
* configures second group as users in RHOAI User settings

Once this was applied it tried to perform operations with three
different users:

* TEST_USER - expected no privileges and simple `Access
  permissions needed` page presented
* TEST_USER2 - all privileges
* TEST_USER3 - no Administration page shown

Problem in this approach is that the `TEST_USER` is part of the
`dedicated-admins` group, which has a `cluster-admin` role in our
default cluster settings. Per this [1], such user is an admin by
default.

So my changes incorporates usage of the `TEST_USER4` instead of
`TEST_USER`.

Also, unnecessary check for the product version is removed with this
commit.

[1] https://access.redhat.com/documentation/en-us/red_hat_openshift_data_science/1/html-single/managing_users_and_user_resources/index#defining-openshift-data-science-admin-and-user-groups_user-mgmt
```
By default, users with cluster admin permissions and users in the
dedicated-admins administrator group are OpenShift Data Science
administrators, but all users authenticated in OpenShift can access
OpenShift Data Science. A cluster admin is a superuser that can perform
any action in any project in the OpenShift cluster.
```
@jstourac jstourac dismissed bdattoma’s stale review November 24, 2023 11:01

requested changes have been incorporated already, dismissing to be able to merge this one

@jstourac jstourac merged commit c719b70 into red-hat-data-services:master Nov 24, 2023
Copy link

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

@jstourac jstourac deleted the fixJupyterUserAccess branch November 24, 2023 11:04
jstourac added a commit to jstourac/ods-ci that referenced this pull request Dec 14, 2023
This fixes the `Verify Unauthorized User Is Not Able To Spawn Jupyter Notebook`
test. It is basically similar change as done in [1,2].

Note: looks like the behavior of the RHOAI is a bit different now - the
user without permissions is shown directly the `Access permissions
needed` page. Nothing else is shown. Based on the test structure, in
previous versions we could see the application but weren't able to start
a JupyterHub tile in the `Applications -> Enabled` menu.

Also, unnecessary check for the product version is removed with this
commit and a small typo fix.

[1] red-hat-data-services#1034
[2] c719b70
jstourac added a commit that referenced this pull request Dec 15, 2023
This fixes the `Verify Unauthorized User Is Not Able To Spawn Jupyter Notebook`
test. It is basically similar change as done in [1,2].

Note: looks like the behavior of the RHOAI is a bit different now - the
user without permissions is shown directly the `Access permissions
needed` page. Nothing else is shown. Based on the test structure, in
previous versions we could see the application but weren't able to start
a JupyterHub tile in the `Applications -> Enabled` menu.

Also, unnecessary check for the product version is removed with this
commit and a small typo fix.

[1] #1034
[2] c719b70
ChughShilpa pushed a commit to ChughShilpa/ods-ci that referenced this pull request Jan 2, 2024
…1034)

The existing test checks that users from different groups have different
access and that this access can be setup via RHOAI User settings.

What this test does:

* creates a `custom-admins-group` with `TEST_USER2` user
* creates a `custom-users-group` with `TEST_USER3` user
* configures first group as admins in RHOAI User settings
* configures second group as users in RHOAI User settings

Once this was applied it tried to perform operations with three
different users:

* TEST_USER - expected no privileges and simple `Access
  permissions needed` page presented
* TEST_USER2 - all privileges
* TEST_USER3 - no Administration page shown

Problem in this approach is that the `TEST_USER` is part of the
`dedicated-admins` group, which has a `cluster-admin` role in our
default cluster settings. Per this [1], such user is an admin by
default.

So my changes incorporates usage of the `TEST_USER4` instead of
`TEST_USER`.

Also, unnecessary check for the product version is removed with this
commit.

[1] https://access.redhat.com/documentation/en-us/red_hat_openshift_data_science/1/html-single/managing_users_and_user_resources/index#defining-openshift-data-science-admin-and-user-groups_user-mgmt
```
By default, users with cluster admin permissions and users in the
dedicated-admins administrator group are OpenShift Data Science
administrators, but all users authenticated in OpenShift can access
OpenShift Data Science. A cluster admin is a superuser that can perform
any action in any project in the OpenShift cluster.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements Bugfixes, enhancements, refactoring, ... in tests or libraries (PR will be listed in release-notes) verified This PR has been tested with Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants