Skip to content

Commit

Permalink
feat: user mgmt functions in SDK + new user API from old API + CLI us…
Browse files Browse the repository at this point in the history
…es SDK [DET-8495, DET-8496] (#5206)
  • Loading branch information
nrajanee authored Nov 17, 2022
1 parent 08f40af commit b279bb5
Show file tree
Hide file tree
Showing 29 changed files with 990 additions and 340 deletions.
3 changes: 3 additions & 0 deletions e2e_tests/tests/cluster/test_model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from determined.experimental import Determined, ModelSortBy
from tests import config as conf
from tests import experiment as exp
from tests.cluster.test_users import log_out_user


@pytest.mark.e2e_cpu
Expand All @@ -13,6 +14,8 @@ def test_model_registry() -> None:
None,
)

log_out_user() # Ensure that we use determined credentials.

d = Determined(conf.make_master_url())
mnist = None
objectdetect = None
Expand Down
20 changes: 15 additions & 5 deletions e2e_tests/tests/cluster/test_rbac.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
from tests.experiment import determined_test_session

from .test_groups import det_cmd, det_cmd_expect_error, det_cmd_json
from .test_users import ADMIN_CREDENTIALS, create_test_user, get_random_string, logged_in_user
from .test_users import (
ADMIN_CREDENTIALS,
create_test_user,
get_random_string,
log_in_user,
logged_in_user,
)


def roles_not_implemented() -> bool:
Expand All @@ -14,7 +20,8 @@ def roles_not_implemented() -> bool:
@pytest.mark.e2e_cpu
@pytest.mark.skipif(roles_not_implemented(), reason="ee is required for this test")
def test_rbac_permission_assignment() -> None:
test_user_creds = create_test_user(ADMIN_CREDENTIALS)
log_in_user(ADMIN_CREDENTIALS)
test_user_creds = create_test_user()

# User has no permissions.
with logged_in_user(test_user_creds):
Expand Down Expand Up @@ -240,7 +247,8 @@ def test_rbac_permission_assignment_errors() -> None:
"not find a workspace",
)

test_user_creds = create_test_user(ADMIN_CREDENTIALS)
log_in_user(ADMIN_CREDENTIALS)
test_user_creds = create_test_user()
group_name = get_random_string()
with logged_in_user(ADMIN_CREDENTIALS):
det_cmd(["user-group", "create", group_name], check=True)
Expand Down Expand Up @@ -328,7 +336,8 @@ def test_rbac_list_roles() -> None:
assert json_out["pagination"]["offset"] == 1

# Setup group / user to test with.
test_user_creds = create_test_user(ADMIN_CREDENTIALS)
log_in_user(ADMIN_CREDENTIALS)
test_user_creds = create_test_user()
group_name = get_random_string()
det_cmd(
["user-group", "create", group_name, "--add-user", test_user_creds.username], check=True
Expand Down Expand Up @@ -426,7 +435,8 @@ def test_rbac_describe_role() -> None:
)

# Role is assigned to our group and user.
test_user_creds = create_test_user(ADMIN_CREDENTIALS)
log_in_user(ADMIN_CREDENTIALS)
test_user_creds = create_test_user()
group_name = get_random_string()

det_cmd(["user-group", "create", group_name], check=True)
Expand Down
Loading

0 comments on commit b279bb5

Please sign in to comment.